When selling a personal residence, taxpayers who have owned and used the home as their main personal residence for two out of the last five years can be eligible for an exclusion of up to $250,000 ($500,000 if filing married filing joint) of the gain recognized on the sale of their home. The gain is calculated by figuring the price received for the sale of the home less the cost basis. Cost basis includes what you paid for the residence, capital improvements and closing costs.