Capital Gains Tax When Selling Your Home: Section 121 Exclusion, the 2-of-5 Rule & How to Keep More Money
Complete guide to capital gains tax when selling your primary residence in 2026. Learn how the Section 121 exclusion works, who qualifies for the $250K/$500K tax-free limit, the 2-of-5-year occupancy rule, partial exclusions for unexpected moves, and strategies to minimize your tax bill on a home sale.

The Tax Break That Saves Homeowners Billions
I had a couple sitting in my office last month — let me call them Tom and Maria. They bought their house in 2014 for $320,000. Over twelve years, the neighborhood got hot, they did some renovations, and they just sold for $780,000. That is a $460,000 profit. Tom was convinced they were going to owe a fortune in taxes. Maria thought they owed nothing. They were both half right.
Here is why. The IRS gives homeowners one of the biggest tax breaks in the entire code: the Section 121 exclusion. If you meet the requirements, you can exclude up to $250,000 of gain if you are single, or up to $500,000 if you are married filing jointly. That is not a deduction — it is a full exclusion. The excluded amount is never taxed. Never.
For Tom and Maria, their $460,000 gain falls within the $500,000 married exclusion. They owe zero federal capital gains tax on the sale. Zero. That is a tax savings of roughly $69,000 at the 15% rate. Not bad for living in your own house.
But — and this is a big but — you do not get this break automatically. You have to meet specific rules, and the IRS enforces them strictly. Miss one requirement and the entire exclusion can disappear.
Who Qualifies for the Section 121 Exclusion
The rules sound simple on the surface. In practice, people mess them up all the time. Here are the three requirements you must meet:
- 1Ownership test: You must have owned the home for at least two of the five years immediately before the sale.
- 1Use test: You must have lived in the home as your primary residence for at least two of the five years immediately before the sale.
- 1Waiting period: You cannot have used the exclusion on another home sale within the last two years.
The two years do not need to be consecutive. You could live in the house for eighteen months, rent it out for two years, move back for six months, and you would still meet the two-year use test. The IRS counts the total months of occupancy within the five-year window.
What Counts as "Primary Residence"
A primary residence is the home where you spend most of your time. The IRS looks at several factors:
- Where you are registered to vote
- The address on your tax returns
- Where your driver's license is registered
- Where you receive your mail
- The location of your bank accounts
A vacation home you visit twice a year does not count. A rental property where you never lived does not count. But a condo where you lived for three years before renting it out? That might still qualify, depending on the timing.

The $250,000 / $500,000 Exclusion Amounts
The exclusion amounts are straightforward but they work differently for single and married filers:
| Filing Status | Maximum Exclusion | How to Qualify |
|---|---|---|
| Single | $250,000 | Own + live 2 of 5 years |
| Married filing jointly | $500,000 | Both spouses meet use test, at least one meets ownership test |
| Married filing separately | $250,000 each | Each spouse qualifies individually |
For married couples, both spouses must meet the use test, but only one needs to meet the ownership test. So if Tom owned the house before they got married and Maria moved in after the wedding, Maria still needs to have lived there for two years, but she does not need to be on the title.
What Happens If Your Gain Exceeds the Exclusion
If your profit is above the exclusion limit, the excess is taxed as a capital gain. If you owned the home for more than one year, the excess gets the long-term capital gains rate of 0%, 15%, or 20%. If you owned it for one year or less — rare for a primary residence — it is a short-term capital gain taxed at ordinary income rates.
Example: You are single, your gain is $380,000. You exclude $250,000. The remaining $130,000 is taxed at the long-term rate. At 15%, that is $19,500 in federal tax. Still way better than paying tax on the full $380,000.
Calculating Your Gain Correctly
This is where most people make expensive mistakes. Your gain is not just the sale price minus the purchase price. It is the sale price minus your adjusted basis. And your basis includes more than what you paid.
Your adjusted basis = original purchase price + capital improvements - depreciation claimed
Let me break that down:
- 1Purchase price: What you actually paid for the house, including closing costs like title insurance, legal fees, and transfer taxes.
- 1Capital improvements: Any addition or renovation that adds value, extends the life of the property, or adapts it for a new use. New roof, kitchen remodel, adding a bathroom, installing central air — all of these increase your basis.
- 1Depreciation: If you ever used part of your home for business or rented it out, and you claimed depreciation on your tax return, that amount reduces your basis. This is the one that catches people off guard.
- 1Selling costs: Real estate agent commissions, staging fees, advertising, legal fees for the sale, and escrow fees can all be subtracted from the sale price before calculating gain.
Common mistake: Forgetting to add improvements to basis. I had a client who spent $45,000 on a kitchen renovation and $18,000 on a new HVAC system but never added these to their basis. By forgetting, they overpaid tax by about $9,450. Keep records of every improvement you make. Every dollar added to basis is a dollar of gain you do not pay tax on.
Use our home sale capital gains calculator to run the numbers with your specific situation.
The 2-of-5 Year Rule Explained Simply
This rule confuses more people than anything else in home sale taxation. Let me make it crystal clear.
You have a five-year window that ends on the date of sale. Within that window, you need to have both owned the home and lived in it as your primary residence for at least 24 months total. The 24 months do not need to be consecutive.
Scenario 1: You buy a house, live in it for three years, rent it out for two years, then sell. You qualify because you lived there for 36 months within the five-year window.
Scenario 2: You buy a house, live in it for one year, get transferred for work, rent it out for three years, move back for one year, then sell. You qualify — total occupancy is 24 months.
Scenario 3: You buy a house, live in it for one year, rent it out for four years, then sell. You do NOT qualify — only 12 months of occupancy within the five-year window.
The key insight: you can rent out your home for up to three of the five years and still qualify for the full exclusion. This is a powerful planning tool if you need to relocate temporarily.
Partial Exclusions: When You Do Not Meet the Full Requirements
The IRS is not completely heartless. If you cannot meet the two-year tests because of specific unforeseen circumstances, you may qualify for a reduced exclusion. This means you get a prorated portion of the $250,000 or $500,000 limit based on how long you actually lived in the home.
The formula is simple:
Partial exclusion = Full exclusion x (months of occupancy / 24)
You can claim a partial exclusion if your move was caused by:
- 1Change in employment: Your job location changed and the new workplace is at least 50 miles farther from your home than your old workplace was.
- 1Health reasons: A doctor recommends a move for diagnosis, treatment, or mitigation of a health condition. This can include moves to be closer to a family member who needs care.
- 1Unforeseen circumstances: Events you could not reasonably have anticipated before buying the home. The IRS specifically lists:
- Death of a spouse or co-owner
- Divorce or legal separation
- Multiple births from the same pregnancy
- Natural or man-made disasters
- War or terrorism
- Involuntary conversion (eminent domain)
Example: You are single and lived in your home for 14 months before getting transferred for work. Your partial exclusion is $250,000 x (14/24) = $145,833. Any gain above that amount is taxable.
Without the partial exclusion, you would owe tax on the entire gain. With it, you might still exclude most or all of your profit depending on how much you made.

What If You Converted Your Home to a Rental
This is a situation I see all the time in my practice. You live in a house for a few years, then move and rent it out instead of selling. A few years later, you decide to sell. Do you still get the Section 121 exclusion?
The answer is maybe. You still need to meet the two-of-five-year tests. If you lived in the home for at least two years before renting it out, and you sell within three years of moving out, you still qualify for the full exclusion.
But here is the catch: any depreciation you claimed (or should have claimed) while the property was a rental must be recaptured at 25%. This is called unrecaptured Section 1250 gain, and the Section 121 exclusion does not apply to it.
Example: You lived in your home for four years, then rented it out for two years and claimed $22,000 in depreciation. You sell the property within the five-year window and have a $300,000 gain. You can exclude up to $250,000 (single) of the gain, but the $22,000 depreciation recapture is still taxed at 25% — that is $5,500 you cannot avoid. The remaining $28,000 above the exclusion is taxed at the long-term capital gains rate.
This is different from selling a pure investment property. For more on that, see our guide on capital gains tax on investment property, which covers depreciation recapture and 1031 exchanges in depth.
The NIIT and State Tax Layers
Just like with any capital gain, the Net Investment Income Tax adds 3.8% on top of your federal rate if your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married). Home sale gains above the Section 121 exclusion count as investment income for NIIT.
Your state capital gains tax rate stacks on top of everything. In California, the combined federal plus NIIT plus state rate can push past 33% on the taxable portion of your gain. Even in no-income-tax states like Florida or Texas, you still owe federal tax on any gain above the exclusion.
For most people whose gain falls within the exclusion, this is not an issue. But if you have a large gain above $250,000 or $500,000, the combined tax bite can be significant.
How to Report the Home Sale Exclusion on Your Tax Return
If your entire gain is excluded, you might not need to report the sale at all. The IRS only requires you to report a home sale on your tax return if:
- You received a Form 1099-S (Proceeds From Real Estate Transactions)
- Your gain exceeds the exclusion amount
- You choose to report it anyway (some people do for record-keeping)
If you do need to report, the sale goes on Form 8949 and Schedule D, just like other capital gains. For the full walkthrough, our guide on how to report capital gains on your tax return covers every line.
If you received a 1099-S but your entire gain is excluded, you still need to report the sale on Form 8949 to show the IRS why you are not paying tax on it. Enter the sale, then enter the exclusion amount as an adjustment so the net gain is zero.
Smart Strategies Before You Sell
Strategy 1: Time Your Sale Around the Two-Year Mark
If you are at month twenty of living in the home, wait. Four more months and you qualify for the full exclusion. The tax savings from qualifying versus not qualifying can be tens of thousands of dollars. There is almost no situation where selling a few months early makes financial sense if you are close to meeting the two-year test.
Strategy 2: Add Every Improvement to Your Basis
Go through your records before you sell. Every capital improvement increases your basis and reduces your taxable gain. New roof, new windows, kitchen renovation, bathroom addition, deck, landscaping that adds value, fence, driveway — add them all up. Most people forget at least a few improvements, and that forgetfulness costs them real money.
Strategy 3: Track Your Selling Costs
Real estate commissions of 5-6% on a $700,000 home sale are $35,000 to $42,000. These costs reduce your gain dollar for dollar. Keep the closing statement from the sale — it documents these deductions.
Strategy 4: Consider a 1031 Exchange Only for Investment Property
If you are selling a former primary residence that you converted to a rental, you might be tempted to do a 1031 like-kind exchange to defer the entire gain. This works for the investment portion of the property, but you cannot use a 1031 exchange for the portion of the property that was your primary residence. The Section 121 exclusion and 1031 exchange rules interact in complex ways — get professional advice before attempting both on the same property.
Strategy 5: Sell During a Low-Income Year
If your gain slightly exceeds the exclusion limit, the excess is taxed as a capital gain. The rate depends on your total income for the year. Selling when your income is lower — after retiring, during a sabbatical, or in a year with fewer bonuses — can push the taxable portion into the 0% long-term rate bracket.
The Bottom Line
The Section 121 exclusion is one of the most generous tax breaks available to ordinary homeowners. Up to $250,000 of gain tax-free for singles, $500,000 for married couples. But you have to meet the rules. Own the home for two of the last five years. Live in it as your primary residence for two of the last five years. Do not use the exclusion on another home within the last two years. If you cannot meet the full requirements, check whether a partial exclusion applies — it can still save you thousands. Track your basis carefully, add every improvement, subtract every selling cost. And if you converted your home to a rental, remember that depreciation recapture still applies even if you qualify for the exclusion. A little planning before you list the property can save you a fortune at tax time.
Fact-Checked & Reviewed
This article was written by Sarah Mitchell (CPA, MST (Master of Science in Taxation)) and reviewed for accuracy by David Chen (JD, LLM in Taxation (New York University)). All tax rates, thresholds, and rules referenced are based on IRS publications and current tax law as of the date published. Tax laws change frequently — always consult a qualified tax professional for advice specific to your situation.
Disclaimer: This article is for informational purposes only and does not constitute tax, legal, or financial advice. Tax laws and regulations change frequently, and the information presented here may not reflect the most current updates. You should consult with a qualified CPA, tax attorney, or financial advisor before making any tax-related decisions. TaxGainsCalc is not responsible for any actions taken based on the information provided in this article.