Retirement & Tax Planning Answers

Capital Gains Tax on Selling Your Primary Residence

Reviewed by Raman Singh, CFP® · Enrolled AgentUpdated
Tax Planning

Quick answer

Under Internal Revenue Code Section 121, you can exclude up to $250,000 of gain from the sale of your primary residence from federal capital gains tax, or $500,000 if you're married filing jointly, provided you owned and used the home as your main residence for at least 2 of the 5 years immediately before the sale. The 2-year ownership and 2-year use periods don't have to overlap perfectly and don't have to be continuous, but you generally can't have used this exclusion on the sale of a different home within the two years before this sale. Any gain above the exclusion amount is taxed as a long-term capital gain, assuming you held the property more than a year, which almost everyone who meets the 2-year use test will have. A surviving spouse who sells within 2 years of the other spouse's death, and otherwise still meets the requirements, can generally still claim the full $500,000 exclusion rather than dropping to $250,000.

The ownership and use tests are both measured over the 5 years before the sale, but they're independent counts. You need to have owned the home for at least 2 of those 5 years and used it as your main residence for at least 2 of those 5 years. Short absences, such as a vacation, a temporary work assignment, or a hospital stay, generally don't break the use period. The two periods don't need to be the same 2 years or run continuously.

The taxable gain isn't the sale price, it's the sale price minus selling costs (commissions, transfer taxes, certain closing costs) minus your adjusted basis. Adjusted basis starts with what you paid for the home and increases by the cost of capital improvements, a new roof, an addition, a remodeled kitchen, but not by routine repairs and maintenance. Keeping records of capital improvements over the years you own a home permanently reduces the taxable gain when you eventually sell, and it's much easier to reconstruct that history before you sell than after.

If you sell before satisfying the full 2-year ownership-and-use test, you may still qualify for a partial exclusion if the sale was due to a change in workplace location, health reasons, or other IRS-recognized unforeseen circumstances. The partial exclusion is prorated based on the portion of the 2-year period you actually satisfied, not an all-or-nothing forfeiture.

If the home was ever rented out, used for a home office deduction, or otherwise depreciated for tax purposes, the depreciation you took, or were entitled to take, isn't eligible for the Section 121 exclusion. That portion is taxed separately as unrecaptured Section 1250 gain, capped at a 25% federal rate, regardless of how much of the remaining gain the exclusion shelters.

For an Arizona couple, this exclusion often works alongside, not instead of, the community property step-up in basis available to a surviving spouse. A jointly owned home in Arizona, a community property state, typically gets a full step-up in basis on both halves of the property at the first spouse's death, not just the deceased spouse's half. Combined with the $250,000/$500,000 exclusion available on a later sale, the practical result for many surviving-spouse home sales in Arizona is little or no federal capital gains tax at all, even on a home that appreciated substantially over decades of ownership.

Track capital improvements with receipts and dates for as long as you own a home. That documentation reduces your taxable gain dollar for dollar when you eventually sell, and it's the kind of record that's nearly impossible to reconstruct accurately after the fact.

If you're a widow or widower planning to sell an appreciated home, check the 2-year post-death window and confirm you still qualify for the full $500,000 exclusion before assuming you're limited to $250,000.

  • Assuming the entire gain on a home sale is automatically tax-free. The exclusion caps out at $250,000 single or $500,000 married; gain above that is taxed as a long-term capital gain.
  • Not tracking capital improvements over the years, which results in a higher, avoidable taxable gain when the home is eventually sold.
  • Overlooking depreciation recapture on a home that was ever rented out or used for a home office deduction, that portion doesn't qualify for the exclusion.
  • Assuming a surviving spouse automatically drops to the $250,000 exclusion, without checking whether the sale falls within the 2-year window that preserves the full $500,000.

Sources

Authoritative references that back the claims on this page.

Continue exploring

Deeper resources on this topic: guides, calculators, and the planning process.

Run the numbers yourself

Free tools, no login required. Results delivered to your inbox.

Related Questions

Need a coordinated retirement tax strategy?

Selling an appreciated home is one of the few tax decisions worth modeling before you list it, not after. Schedule a Strategic Fit Interview and we'll check your basis, your exclusion eligibility, and your timing together.