For many Americans, their home is their largest asset — and its sale can generate the largest capital gain they will ever realize. The good news is that the tax code provides a substantial exclusion specifically for primary residence sales. The bad news is that the rules have details and exceptions that catch homeowners off guard. Understanding them before you sell can save tens of thousands of dollars.
The Home Sale Exclusion: The Core Rule
Under Section 121 of the Internal Revenue Code, you can exclude from capital gains tax up to:
- $250,000 of gain if you are a single filer
- $500,000 of gain if you are married filing jointly
To qualify, you must have owned and used the home as your primary residence for at least 2 of the last 5 years before the sale. The 2 years do not need to be consecutive — you just need a cumulative total of 24 months of primary residence use in the 60 months before the sale date.
This exclusion can be used once every two years. If you sell two homes within two years, only the first sale qualifies.
Calculating Your Home Sale Gain
Your taxable gain is not simply the selling price minus what you paid. The correct calculation is:
Gain = Selling Price - Selling Costs - Adjusted Cost Basis
Selling Costs
These reduce your proceeds and are subtracted before calculating the gain:
- Real estate agent commissions (typically 5-6% of sale price)
- Transfer taxes and recording fees
- Attorney fees for the closing
- Title insurance paid by seller
- Advertising costs if you sold without an agent
Adjusted Cost Basis
Your cost basis is not just your original purchase price. It includes:
- Purchase price — what you originally paid
- Closing costs at purchase — title insurance, recording fees, attorney fees, transfer taxes you paid as buyer
- Capital improvements — additions, renovations, and improvements that added value or extended the home's useful life (new roof, kitchen remodel, addition, HVAC replacement, finished basement). Regular maintenance does not count.
- Minus depreciation — if you ever used any portion of the home for business or as a rental, you must reduce your basis by the depreciation you claimed (or were entitled to claim) for those periods
Example: You bought a home in 2012 for $280,000. You paid $4,500 in closing costs. Over the years, you added a $35,000 kitchen renovation and a $12,000 deck. Your adjusted cost basis is $280,000 + $4,500 + $35,000 + $12,000 = $331,500. You sell in 2026 for $620,000 with $18,000 in selling costs. Your gain is $620,000 - $18,000 - $331,500 = $270,500. As a single filer who lived there 10 years, you exclude $250,000 and owe capital gains tax on $20,500.
When the Full Exclusion Is Not Available
The 2-of-5-year rule has exceptions that allow a partial exclusion if you do not fully meet the test:
- Job relocation: If you sold because of a job change that required moving at least 50 miles farther from the home
- Health reasons: If the sale was required due to a qualified health condition for you or a family member
- Unforeseen circumstances: IRS-defined events such as divorce, death, multiple births from a single pregnancy, or natural disaster
In these cases, the exclusion is prorated based on how many months of the 24-month requirement you actually met. If you met 18 of the required 24 months, you can exclude 18/24 (75%) of the maximum exclusion amount.
Home Used Partly for Business or Rental
If any portion of your home was used for business (home office deduction) or rented out during your ownership, the exclusion becomes more complex:
- Home office within your residence: If you claimed the home office deduction using the actual expense method (not simplified), you may owe depreciation recapture on the portion claimed, taxed as ordinary income at up to 25%.
- Former rental property: If the entire property was a rental and you later converted it to your primary residence, the exclusion applies only to the portion of the gain allocated to the primary residence period. Gain allocated to rental periods does not qualify for the exclusion, and depreciation claimed must be recaptured.
Depreciation Recapture: The Tax Most People Miss
If you claimed depreciation on any part of your home — whether through a home office deduction or as a rental — the IRS requires you to "recapture" that depreciation when you sell, even if your overall gain is below the exclusion limit. Depreciation recapture on residential property is taxed at a maximum rate of 25%, not at regular capital gains rates.
This is one of the most frequently missed tax obligations in home sales. If you deducted a home office for 10 years, carefully track the accumulated depreciation and factor it into your tax calculation.
Reporting the Sale on Your Tax Return
If your gain is fully covered by the exclusion, you generally do not need to report the sale on your return — though some tax professionals recommend reporting it anyway to create a clear record. If any portion of the gain is taxable (above the exclusion), you must report it on Form 8949 and Schedule D.
You will receive Form 1099-S from the closing agent if the sale price exceeds $250,000 (single) or $500,000 (married). The IRS receives a copy, so the transaction is known to them regardless of whether you report it.
Married Couples: Special Situations
The $500,000 exclusion for married couples requires that both spouses meet the use test (2 of 5 years as primary residence), but only one spouse needs to meet the ownership test (owning the home for 2 of 5 years). If one spouse owned the home before marriage and they later sell it together, the exclusion can still be $500,000 as long as both lived there for the required period.
If one spouse dies and the surviving spouse sells the home within two years of the death, the full $500,000 exclusion is still available — even though only one spouse remains.
Use our capital gains tax calculator to estimate your federal tax on any gain above the exclusion, and see our 2026 capital gains rate guide for the current long-term rate thresholds.
Partial Exclusions: When You Do Not Fully Qualify
Even if you do not meet the full 2-of-5-year requirement, you may qualify for a partial exclusion if the sale was due to a change in employment, health reasons, or unforeseen circumstances. The partial exclusion is calculated as the fraction of the 24-month requirement you actually met, multiplied by the maximum exclusion amount.
For example, if you lived in the home for 12 months (half of the required 24 months) before a job relocation required you to sell, you can exclude up to $125,000 of gain as a single filer (50% of $250,000) or $250,000 as a married couple (50% of $500,000). Document the qualifying reason carefully — a letter from your employer showing the job change, or medical documentation — and attach Form 8949 with an explanation.
Planning Ahead: Timing Your Sale
If you are considering selling and are close to but not yet at the 2-year threshold, waiting can be worth significant money. The difference between selling at 23 months (no exclusion) and 24 months (full exclusion) on a $400,000 gain is potentially $60,000 or more in capital gains tax for a single filer. Run the numbers with our capital gains tax calculator to see whether waiting makes financial sense in your specific situation.
Also consider the year of sale: if 2026 will be a high-income year due to other events (a bonus, a business sale, Roth conversions), selling the home in that year could push your gain into the 20% capital gains bracket rather than 15%. In some cases, timing the sale to a lower-income year reduces the tax rate on any gain above the exclusion.