For most Americans, the family home is their largest asset — and the Section 121 capital gains exclusion is one of the most valuable tax provisions in the entire tax code. A married couple who bought their home for $300,000 and sell it for $800,000 can exclude the entire $500,000 gain from federal income tax — paying $0 in federal capital gains on a $500,000 profit. But the exclusion has specific requirements, and several factors can reduce it or eliminate it: short ownership periods, business use, prior depreciation deductions, and high-value gains above the exclusion limit. This guide covers every aspect of the home sale tax calculation — from the basic exclusion to partial exclusions, depreciation recapture, and state tax considerations.
Planning the timing and structure of a home sale can significantly impact the tax outcome, particularly for homes with large appreciated values.
The 2-year use test runs back from the date of sale. If you need to sell but have not yet hit 2 years of use, consider delaying the sale until you cross the 2-year mark. The difference between selling at 23 months vs 25 months of primary residence use can be the difference between paying full capital gains tax and paying $0. Example: you bought a condo in January 2024 and have been living in it. Planning to sell in late 2025? Waiting until January 2026 (24+ months) to list ensures you qualify. The date of closing (not listing) is what counts for the use test.
If you move out and rent the home before selling, the clock on the 5-year lookback window continues. You have up to 3 years after moving out to sell while still counting your prior occupancy toward the 2-year use test. Example: you lived in the home for 2 years, then rented it for 2 years, then sold. You still qualify for the full exclusion (2 years of use within the 5-year window). Wait too long after moving out (more than 3 years), and you lose the benefit for any years prior to the rental period exceeding the 5-year lookback.
For married couples to claim the $500,000 exclusion, both spouses must meet the 2-year use test (lived in the home 2 of last 5 years). Only one spouse needs to meet the ownership test. Practical issue: if one spouse moved into the home shortly before marriage and the couple sells quickly after marriage, the recently-joined spouse may not meet the 2-year use test. In that case, the maximum exclusion is $250,000 (based on the qualifying spouse only). Solution: wait until both spouses have met the 2-year use test before selling if maximising the exclusion to $500,000 is a priority.
If you inherit a home, the basis steps up to fair market value at the date of death. If you move in and use it as your primary residence for 2 years, you can then sell and claim the Section 121 exclusion on any gain above the stepped-up basis. Note: if you sell immediately after inheriting without moving in, the Section 121 exclusion does not apply (you did not meet the use test) — but there will likely be minimal or no capital gain since the basis was just stepped up to FMV.
The Section 121 exclusion applies only to your principal residence. Vacation homes, rental properties, and investment real estate do not qualify. The alternative for investment properties is the 1031 Like-Kind Exchange.
A principal residence is the place where you primarily live — not a vacation home, investment property, or rental. If you own multiple properties, you can only have one principal residence at a time. The IRS looks at: where you spend the most time; where your mail goes; where you are registered to vote; where your car is registered; where your doctors and employers are. You can convert a rental property into your principal residence (move in), but depreciation recapture still applies to the period it was used as a rental, and partial exclusion rules apply if you haven't met the full 2-year use test on the residential use.
If you sell an investment property, a 1031 exchange allows you to defer all capital gains taxes by reinvesting the proceeds into a new 'like-kind' investment property. Rules: you must identify replacement property within 45 days of sale; close on the replacement property within 180 days; the replacement property's value must be equal to or greater than the relinquished property; proceeds must be held by a qualified intermediary. 1031 exchanges defer but do not eliminate capital gains — they carry forward to the eventual taxable sale. For investors with large gains on a rental property, a 1031 exchange is typically far more powerful than any other tax planning tool.
CountryTaxCalc.com is reader-supported. When you use our partner links, we may earn a commission at no cost to you. Learn more about our affiliate partnerships
★ 4.8 verified reviews · 3,758 reviews
Home sales with large gains, depreciation recapture, partial exclusion situations, or state tax complications require a CPA review before you close. TaxHub connects you with real estate tax specialists.
⚠ Not for simple single-state returns. Free filing is fine for straightforward W-2 situations.
Get Home Sale Tax Planning Help →Interested in reaching this audience? Advertise on CountryTaxCalc →