

Founder of Arcanomy
Ph.D. engineer and MBA writing about wealth psychology, financial clarity, and why most money advice misses the point.
Subscribe for more insights, tips, and updates, straight to your inbox.
We respect your privacy and will never share your information.
You don't need to buy another home to avoid capital gains tax on a home sale. You don't need to be a certain age. And you don't need to "roll over" the proceeds into anything.
That was the rule before 1997. It hasn't been the rule for almost 30 years.
Under Section 121 of the Internal Revenue Code, homeowners who meet two simple tests can exclude up to $250,000 of profit ($500,000 for married couples) when selling a primary residence. The median U.S. home sale gain is about $109,000, which means most sellers owe nothing at all. But with home prices climbing, 7.9% of sales in 2023 exceeded the $500,000 cap, up from just 1.3% two decades earlier.
Here's how the exclusion works, when it doesn't, and what to do when your gain exceeds the limit.
The 30-Second Version: Sell your primary home and exclude up to $250K (single) or $500K (married) from capital gains tax. Requirements: own it and live in it for 2 of the last 5 years. You can use this exclusion once every 2 years. Partial exclusions are available if you moved for work, health, or unforeseen circumstances.
To claim the full exclusion, you must pass both:
Ownership test: You owned the home for at least 2 years during the 5-year period before the sale.
Use test: You lived in the home as your primary residence for at least 2 years during that same 5-year period.
The two years don't need to be consecutive. You could live there for 14 months, move away for a year, come back for 10 months, then sell. That's 24 months total. You qualify.
What counts as your "main home"? The IRS looks at where you vote, where you receive mail, the address on your tax returns, and where you spend the most time.
For married couples claiming the full $500,000 exclusion, both spouses must meet the use test, but only one needs to meet the ownership test. If only one spouse qualifies, the couple gets $250,000 instead.
And you can only claim this exclusion once every two years. Sell two homes in 18 months? Only the first sale qualifies.
| Item | Amount |
|---|---|
| Purchase price (2018) | $350,000 |
| Capital improvements (roof, kitchen) | +$45,000 |
| Adjusted basis | $395,000 |
| Sale price (2025) | $625,000 |
| Selling expenses (commissions, closing) | −$37,000 |
| Net proceeds | $588,000 |
| Total gain | $193,000 |
| Section 121 exclusion available | $250,000 |
| Taxable gain | $0 |
The gain is fully excluded. No capital gains tax. This owner pockets the entire profit.
| Item | Amount |
|---|---|
| Purchase price (2005) | $400,000 |
| Improvements over 20 years | +$50,000 |
| Adjusted basis | $450,000 |
| Sale price (2025) | $1,300,000 |
| Selling expenses | −$78,000 |
| Net proceeds | $1,222,000 |
| Total gain | $772,000 |
| Section 121 exclusion applied | −$500,000 |
| Taxable capital gain | $272,000 |
That $272,000 is subject to long-term capital gains tax (likely 15% or 20% depending on their other income) and potentially the 3.8% NIIT if their total income exceeds $250,000. In a high-appreciation market like the San Francisco Bay Area, where 28.8% of home sales exceeded the $500k cap in 2023, this scenario is increasingly common.
If you bought your place in 2005 and are sitting on a massive gain, you're not alone. This is the good kind of problem to have, but it's still a problem that requires planning.
Sometimes life moves faster than the 2-year requirement. The IRS recognizes this.
You may qualify for a partial exclusion if you sell because of:
The partial exclusion is prorated by time. Live there 12 months instead of 24? You get 50% of the full exclusion.
| Months Lived | Single Exclusion | Married Exclusion |
|---|---|---|
| 6 | $62,500 | $125,000 |
| 12 | $125,000 | $250,000 |
| 18 | $187,500 | $375,000 |
| 24 | $250,000 | $500,000 |
A single owner who lived in their home for one year and moved 60 miles for a new job would get a $125,000 partial exclusion. If their gain is $140,000, only $15,000 is taxable.
This exclusion is specifically for your primary residence. No exceptions for:
If you used the home partly for rental income, the IRS requires you to allocate the gain between personal and rental use. The rental portion doesn't qualify for the exclusion, and any depreciation claimed must be recaptured at 25%.
Your cost basis isn't just the purchase price. Add the cost of capital improvements:
Adds to your basis (reduces taxable gain):
Does NOT add to basis:
The higher your basis, the smaller your gain. A $50,000 kitchen renovation effectively saves you $7,500 in taxes if it brings your gain below the exclusion limit (at a 15% rate). Save those contractor invoices. All of them. Even the ones crumpled in the junk drawer.
Document everything. Keep purchase records, closing statements, and improvement receipts. The IRS may not ask for 10 years, but when they do, you need proof.
Calculate your estimated gain before listing. Subtract your adjusted basis and estimated selling costs from the expected sale price. If the gain exceeds $250K/$500K, consult a tax professional about timing strategies.
Consider timing a sale around income changes. If one spouse is between jobs, total income drops, and the taxable portion (if any) of your gain may fall into a lower bracket or avoid the NIIT.
Use our compound interest calculator to model what reinvesting your home sale proceeds could generate over time.
Don't assume you owe nothing. Even if the gain is fully excluded, you may receive a Form 1099-S from your closing agent. Report it on your tax return if required.
For the broader context on how the IRS treats different types of investment gains, see our beginner's guide to investment taxes. And to understand how capital gains tax deadlines and payments work, we cover that separately. If you're thinking about what to do with the proceeds from a sale, our guide on building a diversified portfolio can help.