HOME SALE CAPITAL-GAINS EXCLUSION

How much of the gain on your home sale is taxable. Rules from IRS Publication 523 (2025). Education, not tax advice.

Education, not tax advice. Source: IRS Publication 523 (2025), Selling Your Home, read 2026-11-25. Nonqualified use, depreciation (home office or rental use), and spouses with different ownership or residence periods change the answer: take those to a tax professional.

sec121

Home Sale Capital-Gains Exclusion

Price paid, improvements, selling costs, sale price, months owned and lived in, and filing status in; the gain, the $250,000 or $500,000 exclusion (or the partial one), and the taxable remainder.

How this is calculated
  • Adjusted basis = price you paid + purchase settlement costs that add to basis + improvements (additions and improvements add to basis; repairs and maintenance do not). Amount realized = sale price - selling expenses. Gain = amount realized - adjusted basis. A loss on the sale of a main home is not deductible.
  • Full exclusion: you owned the home AND used it as your main home for at least 24 months (730 days) of the 5 years ending on the sale date, and you did not exclude gain on another home in the 2 years before. Up to $250,000; $500,000 married filing jointly when both spouses meet the residence test and either meets the ownership test; an unmarried surviving spouse who sells within 2 years of the death can also use $500,000 when the other conditions are met.
  • Partial exclusion (work move of a new job at least 50 miles farther away, a doctor-recommended health move, or an unforeseeable event on the Publication 523 list): the shortest of months owned, months lived in, and months since the last exclusion, / 24, x the maximum. Publication 523 figures this per spouse ($250,000 each) for joint filers; with the same periods for both spouses that equals the fraction x $500,000.
  • Taxable remainder = gain - exclusion. It is a long-term capital gain when you owned the home more than a year (federal rates 0%, 15% or 20% by income, IRS Topic no. 409; state tax not shown), short-term (ordinary income) otherwise.
  • Not computed, flagged for a tax professional: nonqualified use (periods after 2008 when it was not your main home, such as a rental or second home before you moved in) and depreciation claimed after May 6, 1997 (that part of the gain cannot be excluded). Spouses with different periods: each spouse's exclusion is figured separately.
  • Source: IRS Publication 523 (2025), Selling Your Home, read 2026-11-25. Verdict: OK when the whole gain is excluded and no flag is set; WARN when part of the gain is taxable, the exclusion is partial, or a flag is set; BAD when there is a gain and no exclusion applies.
The home sale exclusion, explained

How much home sale gain can I exclude from tax?

Up to $250,000 of gain, or up to $500,000 for a married couple filing jointly, under IRS Publication 523 (2025), Selling Your Home (read 2026-11-25). For the $500,000 limit both spouses must meet the residence test and at least one the ownership test. An unmarried surviving spouse who sells within 2 years of the death can also use $500,000 when the other conditions are met.

At the sample inputs, joint filers who paid $300,000, spent $60,000 on improvements and sell for $950,000 have a gain of $529,000: $500,000 is excluded and $29,000 is taxable. A single filer with the same sale would owe tax on $279,000.

What is the 2-out-of-5-year rule for selling a home?

To take the full exclusion you must have owned the home and used it as your main home for at least 24 months (730 days) each during the 5 years before the sale, and not have excluded gain on another home in the 2 years before. The 24 months do not have to be continuous.

The tool asks for months owned and months lived in within those 5 years. Short of 24 in either, and with no qualifying reason, the whole gain is taxable: at the sample price with 12 months each, that is $529,000.

Can I get a partial exclusion if I sell before 2 years?

Yes, if the main reason for the sale is a work move (a new job at least 50 miles farther from the home than the old one), a health move a doctor recommended, or an unforeseeable event on the Publication 523 list. The reduced limit is the shortest of your months owned, months lived in and months since your last exclusion, divided by 24, times the full limit.

For joint filers Publication 523 figures it per spouse at $250,000 each; with the same periods for both, that equals the fraction times $500,000. In the sample, 12 months each after a work move gives 12 / 24 x $500,000 = $250,000 excluded.

What counts in the cost basis of a home?

The price you paid, certain settlement costs from the purchase, and the cost of improvements: additions and work that adds value or extends the home's life, such as a new roof, a remodel or a new heating system. Repairs and routine maintenance do not count. Selling expenses (commissions, title and legal fees) are subtracted from the sale price to get the amount realized.

Gain = amount realized - basis. In the sample: $895,000 - $366,000 = $529,000. Every receipt for an improvement lowers the gain, so keep them.

When does a home sale need a tax professional?

The tool flags three cases and does not compute them. Nonqualified use: periods after 2008 when the home was not your main home (for example a rental or second home before you moved in) make part of the gain non-excludable. Depreciation: if you claimed depreciation for a home office or rental use after May 6, 1997, that part of the gain is taxed, not excluded. And joint filers whose spouses have different ownership or residence periods, where each spouse's exclusion is figured separately.

The rental depreciation and recapture tool shows the recapture band for a property that was a rental.

How is the taxable part of a home sale gain taxed?

If you owned the home more than a year, the remainder is a long-term capital gain, taxed federally at 0, 15 or 20 percent depending on your taxable income (IRS Topic no. 409). The tool shows the 15 and 20 percent figures; state tax is not shown. Owned a year or less, it is a short-term gain taxed as ordinary income.

Report the sale on your return if you have a gain you cannot fully exclude or you received Form 1099-S.

Frequently asked questions

Do I have to buy another home to use the exclusion?

No. The exclusion does not depend on buying a replacement home; it depends on the ownership, use and look-back tests.

Can I deduct a loss on selling my home?

No. A loss on the sale of your main home is not deductible. The tool shows the shortfall and says so.

Does the 24 months have to be in one stretch?

No. Publication 523 counts a total of 24 months (730 days) within the 5 years before the sale, not necessarily continuous.

Is the exclusion the same for married filing separately?

Each spouse filing separately uses the $250,000 limit on their own gain when they meet the tests. The tool treats married filing separately at $250,000.

Where does the tool get its rules?

From IRS Publication 523 (2025), Selling Your Home, read on 2026-11-25, with the capital gains rates from IRS Topic no. 409. Rules change; check the current publication for the year you sell.

Is this tax advice?

No. It is education: arithmetic on the numbers you enter under the rules it cites. Nonqualified use, depreciation and spouses with different periods are flagged for a tax professional.

HomeSmith gives educational estimates in US dollars, not financial, lending or tax advice. Rates, taxes and fees vary; your Loan Estimate and tax return are the binding numbers.

Also from Smith: AutoSmith: car money, from buying to selling

How HomeSmith works

What is new