The primary residence capital gains tax exclusion lets you keep up to $250,000 of the gain from selling your home tax-free if you file single, or up to $500,000 if you’re married filing jointly.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence To claim it, you have to have owned and lived in the home as your principal residence for at least two of the five years ending on the sale date, and you can’t have used the exclusion on another home within the past two years. Anything about your gain that falls outside those rules is taxable.
The Ownership and Use Tests
Section 121 of the tax code sets two separate tests, both measured against the five-year period ending on the sale date. The ownership test asks whether you held title to the home for at least two years within that window. The use test asks whether the home was your principal residence for at least two years within the same window.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
The two years don’t have to be consecutive. The ownership and use periods don’t have to overlap either. You could rent the home for a stretch, buy it later, and still qualify as long as each test is satisfied somewhere inside the five-year lookback. Short absences like vacations count as time you lived in the home, even if you rented it out while you were away.2Internal Revenue Service. Publication 523 – Selling Your Home
The frequency limit is separate. Even if you clearly meet both tests, you cannot use the exclusion if you already claimed it on the sale of a different home within the two years before this sale.
How Much Gain You Actually Have
Before the exclusion matters, you need to know the size of your gain. The formula is the sale price, minus selling expenses, minus your adjusted basis. Get any piece of that wrong and you’ll either overpay or underreport.
Adjusted Basis
Basis starts with what you paid for the home, including borrowed money.2Internal Revenue Service. Publication 523 – Selling Your Home Add certain purchase-side closing costs: title search and title insurance, legal fees, recording fees, transfer or stamp taxes, survey fees, and charges for installing utility service.3Internal Revenue Service. Publication 551 – Basis of Assets
Then add the cost of capital improvements you made while you owned the home. A capital improvement adds value, extends the home’s useful life, or adapts it to a new use: a new roof, a kitchen renovation, a finished basement, a central HVAC system, an addition. Ordinary repairs and maintenance don’t count. Fixing a leaky faucet is a repair. Replacing all the plumbing is an improvement.
Two adjustments cut the other direction. If you received a tax credit or subsidy for an energy improvement like solar panels, subtract the credit or subsidy from your basis.2Internal Revenue Service. Publication 523 – Selling Your Home And if any part of the home was ever used as a rental or a home office, you have to reduce basis by the depreciation that was claimed or was allowable, whether or not you actually took the deduction.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5
Selling Expenses
Selling expenses come off the sale price before you compare it to basis. The typical ones are:
- Real estate commissions paid to the listing and buyer’s agents, usually the largest item
- Attorney fees related to the closing
- Advertising costs, if you marketed the property yourself
- Mortgage points you paid on the buyer’s behalf that would normally be the buyer’s responsibility5Internal Revenue Service. Topic No. 504 – Home Mortgage Points
Sale price minus selling expenses is your amount realized. Amount realized minus adjusted basis is your gain.2Internal Revenue Service. Publication 523 – Selling Your Home If that number is less than $250,000 (or $500,000 for a joint return) and you meet the tests, you owe no federal tax on the sale.
Married Couples, Surviving Spouses, Divorce, and Military
The $500,000 amount for joint filers has its own conditions. Only one spouse needs to meet the ownership test, but both spouses have to meet the use test, and neither spouse can have used the exclusion within the past two years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence If only one spouse meets the use test, the couple is capped at $250,000.
A surviving spouse who sells within two years of the date of death can claim the full $500,000 as an unmarried individual, provided the couple would have met the joint-return requirements immediately before the death.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence After that window closes, the $250,000 single-filer limit applies.
If you got the home in a divorce or separation, you can count your former spouse’s ownership time as your own. You still have to meet the use test yourself, unless the divorce or separation agreement lets your former spouse live in the home and they actually use it as their main home. In that case, their use satisfies your use requirement.2Internal Revenue Service. Publication 523 – Selling Your Home
Members of the uniformed services, foreign service, and intelligence community on qualified official extended duty can elect to suspend the five-year test period for up to 10 years. That stretches the lookback to as long as 15 years, so time before a deployment or reassignment still counts.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
Partial Exclusion When You Sell Early
If you sell before hitting the two-year mark, you may still get a reduced exclusion when the sale is triggered by a qualifying life event. The IRS recognizes three categories:
- A change in employment where your new workplace is at least 50 miles farther from the home than your old workplace was
- Health reasons, where a physician recommends the move
- Unforeseen circumstances, including a natural disaster damaging the home, involuntary conversion, job loss with unemployment compensation eligibility, death of a household member, divorce, or an inability to pay basic living expenses tied to a change in employment status
The reduced exclusion is the maximum ($250,000 or $500,000) multiplied by the fraction of the 24-month requirement you actually met. A single filer who owned and used the home for 12 months before a qualifying job move gets 12/24 of $250,000, or $125,000.2Internal Revenue Service. Publication 523 – Selling Your Home
When Part of the Gain Can’t Be Excluded
Two rules can shrink the exclusion even when you clear the tests: depreciation recapture and non-qualified use. Order matters.
Depreciation comes first. Any depreciation that was claimed or allowable during rental or home-office use is carved out of your total gain and cannot be excluded. It gets taxed as unrecaptured Section 1250 gain at a federal rate of up to 25%.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5
What remains then runs through the non-qualified use allocation. Any period after December 31, 2008, when the home was not your principal residence (or your spouse’s) counts as non-qualified use.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Divide non-qualified months by total ownership months, and that fraction of the remaining gain is ineligible for the exclusion.
An example: you own a home for 10 years, rent it for the first 3 (all after 2008), then live in it for 7. You claimed $50,000 of depreciation during the rental years, and your total gain is $300,000. The $50,000 of depreciation is pulled aside and taxed at up to 25%. Of the $250,000 that’s left, 30% (36 non-qualified months divided by 120 total months) is allocated to non-qualified use. That $75,000 gets taxed at regular capital gains rates. The remaining $175,000 is eligible for the Section 121 exclusion.
Tax on Gain Above the Exclusion
Any gain that isn’t excluded is taxed as long-term capital gain at 0%, 15%, or 20%, depending on your taxable income and filing status.6Internal Revenue Service. Topic No. 409 – Capital Gains and Losses For 2026, the 15% rate begins at $49,450 of taxable income for single filers and $98,900 for joint filers. The 20% rate applies above $545,500 for single filers and $613,700 for joint filers.
High-income sellers face a second layer. The 3.8% Net Investment Income Tax applies to any recognized gain from a home sale (gain that wasn’t excluded under Section 121) when modified adjusted gross income exceeds $250,000 for joint filers, $200,000 for single filers, or $125,000 for married filing separately.7Internal Revenue Service. Questions and Answers on the Net Investment Income TaxTopic No. 559 – Net Investment Income Tax Those thresholds don’t adjust for inflation. The tax is 3.8% of the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds the threshold. A joint-filing couple with $300,000 of modified AGI and $100,000 of recognized home-sale gain owes 3.8% on $50,000, or $1,900, on top of the regular capital gains tax.
Reporting and State Rules
Whether you report the sale depends on the numbers. If your entire gain fits inside the exclusion and the closing agent confirms it, you may not receive a Form 1099-S and generally don’t need to report the sale.8Internal Revenue Service. Instructions for Form 1099-S (04/2025)
If you do receive a Form 1099-S, or if any part of the gain is taxable, you report the sale on Form 8949 with the purchase date, sale date, proceeds, and adjusted basis.9Internal Revenue Service. About Form 8949 – Sales and Other Dispositions of Capital Assets The resulting gain flows to Schedule D and then to your Form 1040.10Internal Revenue Service. About Schedule D (Form 1040) – Capital Gains and Losses
Most states follow the federal exclusion, but a few do not fully conform and may require you to add the excluded gain back on your state return. Check your state’s rules before you assume the federal treatment carries over.