Capital Gains Tax When You Sell a House: Exclusion, Rates, and Worked Examples
Most American homeowners never pay a dollar of capital gains tax on their home sale — not because of a loophole, but because of a single, generous exclusion in the tax code. This guide explains who qualifies, how the $250,000 and $500,000 limits work, what happens above them, and how to compute the taxable gain on your own sale.
Key takeaways
- Section 121 lets single filers exclude up to $250,000 of gain on a primary residence, and joint filers up to $500,000 — if ownership and use tests are met.
- Both tests need two years of ownership and two years of residence within the five years before the sale; the years need not be consecutive.
- Only the gain above the exclusion is taxed, at long-term capital gains rates; basis (purchase price plus improvements) is what makes the gain smaller than the sale price.
What counts as gain
Capital gain is not the sale price. It is the sale price minus your basis, minus selling costs. Basis starts as what you paid for the home, including certain closing costs from the purchase, and grows with capital improvements: a new roof, an addition, a rewired electrical system, a replaced HVAC unit. Repairs that merely maintain the home — repainting, fixing a leak — do not add to basis. Selling costs — agent commission, title fees, transfer taxes — reduce the amount realised, which shrinks the gain further.
Worked sketch: you bought for $300,000, added a $40,000 kitchen remodel and a $15,000 roof, and sell for $520,000 with $31,200 of selling costs (6%). Amount realised is $520,000 − $31,200 = $488,800. Basis is $300,000 + $40,000 + $15,000 = $355,000. Gain is $488,800 − $355,000 = $133,800. That $133,800 — not $520,000 — is the number the tax rules apply to. Keep improvement receipts for as long as you own the home; without them, basis is whatever you can prove, and the IRS accepts documentation, not memory.
Run the same arithmetic on your own sale with the home sale calculator before you talk to anyone about tax: most surprises in home-sale tax come from forgetting selling costs or improvements, not from the tax rates.
The Section 121 exclusion
Section 121 of the Internal Revenue Code excludes gain on the sale of a principal residence from income: up to $250,000 for single filers (and married filing separately), and up to $500,000 for married couples filing jointly. It is an exclusion, not a deferral — excluded gain is never taxed later, and there is no requirement to buy another home. It is also not indexed for inflation, which is why it shelters a smaller share of gains in high-price markets than it did when the limits were set in 1997.
For a joint return to claim the full $500,000, one spouse must meet the ownership test, both spouses must meet the use test, and neither spouse may have claimed the exclusion on another sale in the previous two years. If only one spouse meets the use test, the couple may still exclude up to $250,000. The exclusion applies to one sale at a time and can be reused, but not more than once every two years.
The ownership and use tests
Both tests look at the five years ending on the sale date. Ownership: you must have owned the home for at least two years (24 months) in that window. Use: you must have lived in it as your principal residence for at least two years in the same window. The two periods do not have to overlap, and neither has to be continuous — 14 months living there, a year away, then 10 more months still adds up to 24 months of use.
Principal residence means the home you live in most of the time. A vacation home does not qualify, and a rental property does not qualify until it becomes your principal residence and the tests are met — with a catch covered below (nonqualified use). Special rules help people whose move was forced: military service, divorce, death of a spouse, and certain job changes can preserve eligibility or support a partial exclusion even when the two years are not met.
Worked examples
| Sale | Gain | Filing status | Excluded | Taxable gain |
|---|---|---|---|---|
| Bought $200,000, sold $700,000 (gain $500,000) | $500,000 | Joint | $500,000 | $0 |
| Same sale | $500,000 | Single | $250,000 | $250,000 |
| Bought $500,000, sold $1,200,000 (gain $700,000) | $700,000 | Joint | $500,000 | $200,000 |
| Bought $300,000, sold $420,000 (gain $120,000) | $120,000 | Either | $120,000 | $0 |
The last row is the commonest case in America: a gain fully inside the exclusion, with nothing owed and, usually, nothing to report — unless you received a Form 1099-S from the closing, in which case the sale is reported and the exclusion claimed on the return. If your gain is within the exclusion and no 1099-S was issued, the IRS generally does not require the sale to be reported at all.
Above the exclusion: rates and extras
Gain above the exclusion is taxed as a long-term capital gain (the home was held more than a year) at 0%, 15%, or 20% depending on taxable income, with thresholds that rise with inflation each year. On top of that, the 3.8% Net Investment Income Tax can apply to some or all of the taxable gain if modified adjusted gross income exceeds $200,000 (single) or $250,000 (joint). State tax is separate and varies: some states tax capital gains as ordinary income, others exclude part of the gain, and a few have no income tax at all.
Example: a single seller with a $250,000 taxable gain above the exclusion, in the 15% bracket, owes $37,500 in federal capital gains tax before any NIIT or state tax. The same gain for a joint couple with a $500,000 exclusion would owe nothing. Filing status and basis records, not clever planning, are what move this number most.
Traps: rentals, depreciation, and partial exclusions
Three traps catch honest sellers. First, nonqualified use: time after 2008 when the home was not your principal residence (for example, years as a rental before you moved in) produces gain that cannot be excluded, allocated pro-rata. Second, depreciation: if you claimed depreciation while renting the home out, that portion of the gain is “unrecaptured” and taxed at up to 25% even if the rest is excluded. Third, the once-every-two-years rule: selling two homes in quick succession means the second sale may get no exclusion at all.
Partial exclusions exist for sellers who fail the two-year tests because of a change in employment, health reasons, or other unforeseen circumstances — the exclusion is prorated by the fraction of the two years actually met. Someone who lived in the home for 12 of the required 24 months for a qualifying reason can exclude half the maximum: $125,000 single, $250,000 joint. The rules are detailed (IRS Publication 523 is the authoritative guide), and for any sale involving a rental period, a divorce, or an inherited home, professional advice pays for itself.
Frequently asked questions
How much capital gains tax do I pay when I sell my house?
Usually nothing, if it was your primary residence and the gain is within the Section 121 exclusion: $250,000 for single filers, $500,000 for joint filers. Only gain above the exclusion is taxed, at long-term capital gains rates of 0%, 15%, or 20%, plus possible state tax and the 3.8% Net Investment Income Tax at higher incomes.
Do I qualify if I lived in the home for two years but not consecutively?
Yes. The ownership and use tests each require 24 months within the five years before the sale, and the months do not have to be consecutive or overlapping. Fourteen months, a year away, and ten months back still adds up to 24 months of use.
Does the exclusion apply to a second home or rental property?
No. Section 121 covers a principal residence only. A rental converted to a principal residence can eventually qualify, but gain allocated to post-2008 nonqualified use periods cannot be excluded, and depreciation taken during rental years is taxed separately.
What is my basis, and why does it matter?
Basis is what you paid plus capital improvements (additions, new systems, major remodels), not repairs. A higher basis means a smaller gain, which means less tax above the exclusion. Keep improvement receipts for the whole time you own the home.
Do I need to report the sale if no tax is due?
If the gain is fully excluded and you did not receive Form 1099-S, generally no. If a 1099-S was issued, report the sale and claim the exclusion on your return so the IRS record matches.
Can I use the exclusion more than once?
Yes, but not more than once every two years. Each qualifying sale can use the full exclusion, provided the ownership, use, and frequency tests are met for that sale.
Work out your own sale proceeds and gain
Run your own numbers instead of guessing from someone else’s example.
