The capital gains exemption on a primary residence, set out in Section 121 of the Internal Revenue Code, lets you exclude up to $250,000 of profit from selling your main home, or up to $500,000 if you’re married filing jointly. You qualify by owning and living in the home for at least two of the five years before the sale, and you can use the exclusion again on a future home as long as at least two years have passed since your last one.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
Who Qualifies
Two tests decide whether you get the full exclusion, and both look back over the five years ending on the sale date. The ownership test requires you to have owned the home for at least two years within that window. The use test requires you to have lived in it as your main home for at least two years, or 730 days, 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. Shorter stretches of living in the home can be added together to reach 730 days, so a rental period or extended travel in the middle doesn’t automatically disqualify you.
Only one home can be your primary residence at a time. If you own more than one, the IRS looks at practical indicators to decide which is your main home: where you vote, the address on your tax returns, where you work, and where you bank. The home you spend the most time in during the year usually wins.
How Much You Can Exclude
Single filers and those married filing separately can exclude up to $250,000 of gain. Married couples filing jointly can exclude up to $500,000.2Internal Revenue Service. Topic No. 701, Sale of Your Home
Joint filers face extra conditions to reach the $500,000 ceiling. Either spouse can satisfy the ownership test, but both spouses must independently meet the use test, and neither can have used the exclusion on another home sale in the two years before the current sale.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 isn’t shut out; they can still claim whatever individual exclusion the qualifying spouse would have been entitled to alone.
Figuring Your Actual Gain
Your taxable gain is not sale price minus purchase price. The IRS uses adjusted basis, which folds in costs you’ve paid over the years. Getting this number right can shave thousands off your tax bill, or push your gain under the exclusion entirely.
Building Your Cost Basis
Start with what you originally paid for the home. Add many of the settlement fees from the purchase: title search and title insurance, legal fees, recording fees, transfer taxes, survey costs, and utility connection charges.3Internal Revenue Service. Publication 551, Basis of Assets If you assumed back taxes or other seller obligations at closing, those count too.
Capital improvements during ownership also increase basis. The IRS draws a firm line between improvements and routine maintenance. A new deck, a replaced roof, a finished basement, or central air are improvements. Patching a leaky faucet, repainting, or cleaning gutters are repairs and don’t count. The test is whether the work materially added to the home’s value, extended its useful life, or adapted it to a new use.
Reducing the Sale Price
On the selling side, you subtract selling expenses from the sale price before calculating gain. Real estate commissions, title insurance for the buyer, transfer taxes, escrow fees, and legal fees all reduce your amount realized. Cosmetic prep like staging or carpet cleaning doesn’t qualify.
A quick example. You bought for $300,000, paid $8,000 in qualifying closing costs, and later spent $40,000 on a kitchen renovation. Your adjusted basis is $348,000. You sell for $575,000 and pay $35,000 in commissions and closing costs, giving you an amount realized of $540,000 and a gain of $192,000. A single filer owes zero federal tax on that sale.
When You Sell Before Two Years
Falling short of the two-year requirements doesn’t automatically wipe out the exclusion. If you sold primarily because of a job change, a health issue, or an unforeseen circumstance, you qualify for a prorated exclusion.4Internal Revenue Service. Publication 523, Selling Your Home
Qualifying Reasons
A work-related move qualifies if your new workplace is at least 50 miles farther from the home than your previous workplace was. If you had no prior job, the new workplace just needs to be at least 50 miles from the home. Health-related moves qualify when you relocate for treatment, to care for a sick family member, or on a doctor’s recommendation.4Internal Revenue Service. Publication 523, Selling Your Home
The IRS also recognizes specific unforeseen events as safe harbors: destruction or condemnation of the home, a natural disaster, the death of a qualifying person, job loss that qualifies you for unemployment, a change in employment that leaves you unable to cover basic living expenses, divorce or legal separation, and multiple births from the same pregnancy.5eCFR. 26 CFR 1.121-3 – Reduced Maximum Exclusion for Taxpayers Failing to Meet Certain Requirements
The Prorated Amount
Take the shortest of three periods: how long you owned the home, how long you lived in it, or how long since you last used the exclusion on another sale. Divide by 730 days (or 24 months), then multiply by $250,000, or $500,000 for qualifying joint filers.4Internal Revenue Service. Publication 523, Selling Your Home
A single filer who lived in the home for 12 months before a qualifying job move would calculate 12 ÷ 24 = 0.5, then 0.5 × $250,000 = $125,000. That’s the ceiling on excludable gain.
Situations With Special Rules
Surviving Spouses
If your spouse dies and you sell within two years of the death, you can still claim the full $500,000 exclusion, provided you haven’t remarried by the sale date and the couple would have met the joint-exclusion requirements immediately before the death.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence After the two-year window closes, you revert to the $250,000 single-filer limit.
There’s a second benefit at play. When a spouse dies, the surviving spouse typically gets a stepped-up basis on the inherited portion of the home, reset to fair market value at the date of death. In community property states, both halves step up; in common-law states, only the deceased spouse’s share does. Combined with the $500,000 window, many surviving spouses owe nothing.
Military and Foreign Service
Members of the uniformed services, Foreign Service, intelligence community, and Peace Corps can elect to suspend the five-year lookback for up to 10 years while on qualified official extended duty. That effectively stretches the ownership-and-use window to as long as 15 years, so a decade-long overseas posting doesn’t cost you the exclusion.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
Divorce
If you receive the home from a spouse or former spouse as part of a divorce, you inherit their period of ownership for the ownership test. You also get credit for any time your ex-spouse lived in the home under a divorce decree or separation agreement, which counts toward your use test.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Without these rules, a divorced homeowner who moved out but kept the home would often fail the use test on a later sale.
What Can Still Be Taxed Even If You Qualify
Two situations can carve into your exclusion: periods when the home wasn’t your main residence, and depreciation you claimed for a rental use or home office.
Nonqualified Use
Any period after 2008 during which neither you nor your spouse used the property as a main home is generally nonqualified use. The share of gain allocated to those days can’t be excluded.4Internal Revenue Service. Publication 523, Selling Your Home
The formula divides post-2008 nonqualified-use days by total days of ownership. If you owned the home 3,650 days and 730 of them were nonqualified use, roughly 20% of your gain would fall outside the exclusion. Order matters: any nonqualified-use period after the last date the home was your main residence isn’t counted against you. So if you lived there for years and rented it out right before selling, that final rental stretch doesn’t reduce your exclusion.
Certain absences are excused as well: active military duty of up to 10 years, and temporary absences for job changes, health, or other unforeseen circumstances totaling up to two years.4Internal Revenue Service. Publication 523, Selling Your Home
Depreciation Recapture
If you claimed depreciation on the home for a rental use or home office, Section 121 does not shelter it. Depreciation taken after May 6, 1997, is recaptured and taxed at up to 25%, no matter how much of your other gain the exclusion covers. Even if your total gain is well under $250,000, the depreciation portion is still taxable.
Rates on Gains That Exceed the Exclusion
Profit above the exclusion is taxed as long-term capital gain, assuming you owned the home more than a year. For 2026, the federal long-term rates are:
- 0% on taxable income up to $49,450 (single) or $98,900 (married filing jointly)
- 15% on taxable income from $49,451 to $545,500 (single) or $98,901 to $613,700 (married filing jointly)
- 20% on taxable income above $545,500 (single) or $613,700 (married filing jointly)
Most home sellers with taxable gain land in the 15% bracket. Higher earners can owe an additional 3.8% Net Investment Income Tax if modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly), which raises the effective top federal rate on home-sale gains to 23.8%. State income taxes may apply on top of that.
Reporting the Sale
Whether you have to report the sale depends on three things: whether any of the gain is taxable, whether you received a Form 1099-S, and whether you’re electing to report a gain you could otherwise exclude to preserve the exclusion for a bigger future sale.4Internal Revenue Service. Publication 523, Selling Your Home If none of those apply, you don’t need to report it.
Many sellers avoid getting a 1099-S in the first place by signing a written certification at closing that the home is a primary residence and the gain is fully excludable. If you sign it and the sale price is $250,000 or less ($500,000 if married), the closing agent isn’t required to file a 1099-S.6Internal Revenue Service. Instructions for Form 1099-S
When reporting is required, use Form 8949 to record the sale details and carry the results to Schedule D of your Form 1040.7Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets Keep records of your original purchase price, closing costs, and every capital improvement. Receipts, contractor invoices, and settlement statements are what defend your basis if the IRS asks. Most people toss these after a few years, and it’s the single most common mistake in home-sale tax planning.