Selling a home for far more than you paid is a taxable event in principle, and for most sellers of a primary residence it produces no federal tax at all. The reason is a specific and generous exclusion — and the reason it sometimes fails is that people misunderstand what the gain actually is.
The exclusion
Internal Revenue Code section 121 lets you exclude up to $250,000 of gain on the sale of your main home if you file single, and up to $500,000 if you are married filing jointly.
These amounts have not been indexed for inflation since they were set, which is quietly significant. A $500,000 exclusion covered essentially any residential gain when it was enacted; after decades of home price appreciation in high-cost markets, long-tenured owners increasingly exceed it.
The two tests you must pass
The ownership test: you owned the home for at least two years during the five-year period ending on the sale date.
The use test: you lived in it as your main home for at least two years during that same five-year period.
The two-year periods need not be continuous, and they need not be the same two years, as long as both fall inside the five-year window. There is also a look-back rule: you generally cannot claim the exclusion if you already claimed it on another home sale within the two years before this sale.
For married couples filing jointly, either spouse can satisfy the ownership test, but both must satisfy the use test to get the full $500,000. If only one spouse lived there, the exclusion drops to $250,000.
Computing the gain correctly
The single most common error is measuring the gain against the mortgage. The loan has nothing to do with it. A seller who owes $50,000 on a home bought for $300,000 and sold for $400,000 has a $100,000 gain, not a $350,000 one.
Start with the amount realized: sale price minus selling costs — agent commissions, transfer taxes, title fees, and similar closing charges paid by the seller.
Then compute adjusted basis: original purchase price, plus certain costs of acquisition, plus every qualifying capital improvement you made over the years of ownership.
Gain is amount realized minus adjusted basis. Work an example. Bought at $320,000, spent $75,000 across a roof, a kitchen, and central air, so adjusted basis is $395,000. Sold at $700,000 with $45,000 of selling costs, so amount realized is $655,000. Gain is $260,000 — comfortably inside a joint filer's exclusion, and $10,000 over a single filer's.
Why keeping improvement receipts pays
Capital improvements raise your basis and therefore reduce the gain dollar for dollar. Work that adds value, prolongs the home's useful life, or adapts it to new uses qualifies: additions, a new roof, a full kitchen or bathroom remodel, new HVAC, a finished basement, landscaping that is a permanent improvement.
Repairs and maintenance do not qualify: repainting, fixing a leak, replacing a broken window pane. The line is between restoring and improving.
In the example above, the $75,000 of improvements moved $75,000 straight out of the taxable gain. A single filer who lost those receipts would face a $85,000 gain instead of $10,000. Twenty years of paperwork discipline is worth real money at exactly one moment.
What you owe if you exceed the exclusion
Gain above the exclusion is a long-term capital gain, assuming you owned the home more than a year. For 2026, long-term rates are 0% on taxable income up to $49,450 for single filers and $98,900 for married filing jointly, 15% up to $545,500 and $613,700, and 20% above.
Importantly, the thresholds apply to your total taxable income including the gain, so a large home sale gain can push you into the 15% or 20% band even if your ordinary income would not.
A 3.8% net investment income tax may also apply to gain above the exclusion once modified adjusted gross income exceeds $200,000 for single filers or $250,000 for married filing jointly. And state tax is separate — some states tax capital gains as ordinary income, and a few have no income tax at all.
The special situations worth knowing
A partial exclusion is available if you fail the two-year test for a qualifying reason — a change in place of employment, a health-related move, or certain unforeseen circumstances the IRS defines. The exclusion is prorated by the fraction of the two-year period you completed, so eighteen months of a required twenty-four could still shelter three-quarters of the normal amount.
If the home was ever a rental, depreciation you claimed or could have claimed is recaptured and is not covered by the exclusion. Periods of non-qualified use after 2008 can also reduce the excludable portion.
And a loss on the sale of a personal residence is not deductible, which strikes many sellers as unfair given the gain is taxable above the exclusion. It is nonetheless the rule.
This is educational information about how the rules are structured. A sale involving rental history, a partial exclusion claim, or a gain near the threshold is worth running past a CPA before you file.