The formula for calculating your capital gain is your gross proceeds minus your adjusted basis minus any primary residence exclusion for which you qualify. Using the numbers in this example, subtract the adjusted basis of $615,000 from the net proceeds of $905,000 to find your capital gain on the house is $290,000.