Capital gains on your home sale: will you owe tax?

Short answer

If you owned and lived in the home as your main home for at least 2 of the 5 years before the sale, you can exclude up to $250,000 of gain from federal income tax, or $500,000 if you are married filing jointly. Your gain is not the sale price minus what you paid: it is the sale price minus selling costs, minus what you paid plus the improvements you made. For many long-time owners that brings the taxable amount to zero.

Not tax advice. Rules change; confirm with the IRS (Publication 523) or a tax professional.

At a glance

Rule (federal, 2025 returns)
Exclusion, singleUp to $250,000 of gain
Exclusion, married filing jointlyUp to $500,000 of gain
Ownership testYou owned the home 2 of the 5 years before the sale
Use testYou lived in it as your main home 2 of the 5 years before the sale (need not be consecutive)
Joint returnEither spouse meets the ownership test; both meet the use test
Used the exclusion on another home in the last 2 yearsGenerally not eligible
Received a Form 1099-SReport the sale even if all the gain is excluded

How to figure your gain

IRS Publication 523 works it out in steps:

1. Selling price of the home. 2. Selling expenses: the costs directly tied to selling, such as agent commission and the seller's closing costs. 3. Amount realized = selling price minus selling expenses. 4. Adjusted basis = what you paid (plus certain purchase costs) plus the improvements you made, such as a new roof, an addition or a kitchen remodel. Repairs and upkeep don't count. 5. Gain = amount realized minus adjusted basis. Then subtract your exclusion.

Source: IRS, Publication 523 (2025), Figuring Gain or Loss.

Two examples

These use our standard 6% estimate for selling costs; your actual costs may be lower or higher.

Single, sells for $400,000Married, sells for $900,000
Selling costs (6% estimate)$24,000$54,000
Amount realized$376,000$846,000
Paid + improvements (adjusted basis)$180,000 + $40,000 = $220,000$150,000 + $50,000 = $200,000
Gain$156,000$646,000
Exclusion$250,000$500,000
Taxable gain$0$146,000

In the second example, $146,000 would be a long-term capital gain on the federal return, and your state may tax it too. Keep receipts for improvements: they lower your gain dollar for dollar.

If you don't meet the 2-out-of-5 test

You may still get a partial exclusion if the main reason for the sale was a change in where you work, a health issue, or an unforeseeable event. Publication 523 has a worksheet that prorates the $250,000 or $500,000 by how long you met the tests. Source: IRS, Publication 523 (2025), Does Your Home Qualify for a Partial Exclusion of Gain.

Surviving spouses

A surviving spouse who sells within 2 years of the spouse's death can generally still use the $500,000 limit if the other requirements were met just before the death. Publication 523 lists the conditions. Source: IRS, Publication 523 (2025).

What the sale leaves you to buy with

Our retirement destination pages start from the same math: your sale price, minus 6% for selling costs, minus what you still owe. If taxes apply to your sale, set that money aside before you count what is left. Ask Chris →

FAQ

Do I pay capital gains tax when I sell my house?
Usually not on the first $250,000 of gain ($500,000 married filing jointly) if you owned and lived in it for 2 of the last 5 years.
Do selling costs reduce my gain?
Yes. Commission and the seller's closing costs come off the sale price before you figure the gain.
Do home improvements reduce capital gains?
Yes. Improvements add to your basis. Repairs and routine upkeep don't.
Do I have to report the sale if I owe nothing?
If you received a Form 1099-S, yes, even if the whole gain is excluded.
Can I use the exclusion more than once?
Yes, but generally not if you used it on another home in the 2 years before this sale.

Sources

Last reviewed October 21, 2026. Not tax advice.