Capital Gains Tax on Home Sale: The Complete 2026 Guide
Selling your home is likely the largest financial transaction of your life — and understanding the capital gains tax implications can save you tens of thousands of dollars. The good news: most homeowners owe zero federal tax on their home sale profits thanks to the generous Section 121 exclusion. But if your gain exceeds $250,000 (single) or $500,000 (married filing jointly), or if you don't meet the qualification rules, you could face a substantial tax bill. This comprehensive guide explains exactly how capital gains tax on home sales works in 2026, who qualifies for the exclusion, and how to calculate what you owe.
Whether you're selling a primary residence you've lived in for decades, converting a rental property, or navigating a home sale after divorce, this guide covers every scenario with clear examples and IRS-accurate rules. Use our free capital gains calculator to instantly estimate your tax, or read on for the complete picture.
How Home Sales Are Taxed in 2026
When you sell your home for more than you paid (including improvements), the profit is a capital gain. The IRS treats this gain the same as any other investment gain — but with one critical difference: Section 121 of the Internal Revenue Code provides a massive exclusion that shelters most homeowners from any tax at all.
Here's the basic framework for how home sale taxation works in 2026:
- Step 1: Calculate your gain (selling price minus adjusted cost basis)
- Step 2: Apply the Section 121 exclusion ($250,000 single / $500,000 married) if you qualify
- Step 3: Any remaining gain above the exclusion is taxed at long-term capital gains rates (0%, 15%, or 20%) if you owned the home for more than one year
- Step 4: High earners may also owe the 3.8% Net Investment Income Tax (NIIT) on the taxable portion
- Step 5: State income taxes may apply depending on where you live
For most homeowners — especially those with gains under the exclusion threshold — the federal tax bill is $0. According to the National Association of Realtors, the median existing home sale price in 2026 is approximately $410,000, with median gains well below the exclusion limits. However, homeowners in high-appreciation markets (coastal California, the Northeast, major metros) frequently exceed the exclusion, making proper tax planning essential.
If you sell your home at a loss, unfortunately you cannot deduct that loss on your tax return. Losses on personal-use property (your primary residence) are not deductible. This is different from investment property, where losses can offset gains.
The Section 121 Exclusion — $250k / $500k Explained
The Section 121 exclusion is the single most valuable tax benefit available to American homeowners. It allows you to exclude from income up to $250,000 of gain if you're single, or up to $500,000 if married filing jointly. This isn't a deduction — it's a complete exclusion. The gain simply doesn't exist for tax purposes.
How the exclusion amounts work
| Filing Status | Maximum Exclusion | Requirements |
|---|---|---|
| Single | $250,000 | Ownership + use tests met |
| 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 independently |
| Surviving Spouse | $500,000 | Sale within 2 years of spouse's death; other tests met |
For married couples to claim the full $500,000 exclusion, both spouses must meet the use test (lived in the home as primary residence for 2 of the past 5 years), but only one spouse needs to meet the ownership test. Neither spouse can have used the exclusion on another home sale within the past 2 years.
There is no limit to how many times you can use the Section 121 exclusion over your lifetime — you just have to wait at least 2 years between uses. Some homeowners strategically move every few years to capture tax-free gains in appreciating markets, though practical moving costs often limit this strategy.
Qualification Requirements: The Ownership and Use Tests
To claim the full Section 121 exclusion, you must pass three tests:
1. The Ownership Test
You must have owned the home for at least 2 years (730 days) during the 5-year period ending on the date of sale. The 2 years do not need to be consecutive — they can be any 24 months of ownership within the 5-year window.
2. The Use Test
You must have used the home as your principal residence for at least 2 years (730 days) during the same 5-year period. Again, the 2 years need not be consecutive. Temporary absences for vacation or seasonal travel count as periods of use, but extended absences (such as renting the home out for 3 years) do not.
3. The Look-Back Test
You must not have excluded gain from another home sale within the 2 years preceding this sale. If you claimed a Section 121 exclusion on a different property within the past 2 years, you cannot claim it again.
The 2-out-of-5-years rule in practice
The "2-out-of-5-years" rule provides significant flexibility. Consider these scenarios:
- Lived in, then rented out: You buy a home in 2021, live in it through 2023 (2 years), then rent it out in 2024–2026. If you sell in mid-2026, you still qualify — you used it as a primary residence for 2 of the past 5 years.
- Alternating use: You live in the home for 8 months per year and travel the rest. As long as your total residence time equals 24 months within the 5-year window, you qualify.
- Multiple homes: If you own two homes, the one where you spend the majority of your time and which appears on your tax returns, voter registration, and driver's license is generally your "principal residence."
The IRS determines your principal residence based on facts and circumstances, including where you spend most of your time, your mailing address, the address on your tax returns, your state voter registration, and where your bank accounts and employer are located.
Calculating Your Gain on a Home Sale
Your capital gain is the difference between your selling price (amount realized) and your adjusted cost basis. Getting the basis calculation right is critical — every dollar added to your basis is a dollar less in taxable gain.
The formula
Gain = Amount Realized − Adjusted Basis
- Amount Realized = Selling price − selling expenses (agent commissions, closing costs, transfer taxes, staging, title insurance)
- Adjusted Basis = Original purchase price + buying costs + capital improvements − any depreciation claimed − any casualty loss deductions − any energy credits received
Worked example: Calculating gain on a home sale
David and Susan (married, filing jointly) bought their home in 2015 for $350,000. They spent $45,000 on a kitchen remodel and $22,000 on a new roof. They sell in 2026 for $780,000 with $47,000 in selling costs.
- Amount Realized: $780,000 − $47,000 = $733,000
- Adjusted Basis: $350,000 + $12,000 (buying costs) + $45,000 (kitchen) + $22,000 (roof) = $429,000
- Total Gain: $733,000 − $429,000 = $304,000
- Section 121 Exclusion: $500,000 (married filing jointly)
- Taxable Gain: $304,000 − $500,000 = $0 (gain is fully excluded)
What increases your cost basis
Your original purchase price is just the starting point. These items increase your adjusted basis:
- Closing costs when you bought (title insurance, recording fees, surveys, attorney fees)
- Capital improvements made during ownership (see next section for details)
- Special assessments for local improvements (sidewalks, sewer connections)
- Amounts spent to restore damaged property (beyond what insurance covered)
- Legal fees to defend or perfect title to the property
What decreases your cost basis
- Depreciation claimed (if you ever used part of the home for business or rented it)
- Casualty loss deductions previously taken
- Insurance reimbursements for casualties that you didn't use to repair the property
- Residential energy credits received (solar panels, energy-efficient improvements)
- Any deferred gain from a pre-1997 home sale rollover (under the old rules)
What Counts as Home Improvements That Increase Basis
Not every dollar you spend on your home increases your cost basis. The IRS distinguishes between capital improvements (which add to basis) and repairs/maintenance (which do not). Understanding this distinction can save you thousands in taxes when you sell.
Capital improvements (add to basis)
A capital improvement must do one of three things: add value to the home, prolong its useful life, or adapt it to a new use. Common examples include:
- Additions: New rooms, decks, patios, porches, garages, swimming pools, fencing
- Kitchen & bath remodels: New cabinets, countertops, appliances (built-in), fixtures
- Systems: New HVAC, water heater, electrical wiring, plumbing, septic system, security system
- Exterior: New roof, siding, windows, doors, driveway, landscaping (permanent)
- Interior: New flooring (hardwood, tile), built-in shelving, insulation, fireplace
- Accessibility: Wheelchair ramps, widened doorways, grab bars, modified kitchen/bath
- Energy: Solar panels, geothermal systems, energy-efficient windows (note: some reduce basis if you took an energy credit)
Repairs and maintenance (do NOT add to basis)
Routine maintenance that keeps your home in its existing condition does not increase basis:
- Painting (interior or exterior)
- Fixing leaks, patching drywall, replacing broken windows
- Cleaning gutters, servicing HVAC, pest control
- Replacing a few shingles (vs. a full roof replacement)
- Fixing plumbing clogs, replacing faucet washers
- Wallpapering, carpet cleaning, general upkeep
The gray area: repair vs. improvement
Sometimes a repair becomes an improvement. Patching a few holes in your roof is a repair, but replacing the entire roof is an improvement. Fixing a leaky pipe is a repair, but re-plumbing the entire house is an improvement. The key question: does the work substantially add value or extend the life of the home, or does it merely maintain its current condition?
If you're doing repairs as part of a larger renovation project, the IRS may treat the entire project as a capital improvement under the "plan of improvement" doctrine. A $2,000 paint job done as part of a $50,000 kitchen remodel can be folded into the improvement cost.
Partial Exclusion Rules: When You Don't Meet the Full Requirements
If you sell your home before meeting the full 2-year ownership and use requirements, you may still qualify for a partial exclusion under IRC §121(c). The IRS allows a prorated exclusion when you sell due to:
1. Job relocation
You qualify if your new job is at least 50 miles farther from your old home than your previous job was. This applies whether you changed employers, got transferred, or started a new job. Self-employed individuals also qualify if their new principal place of business meets the distance test.
2. Health reasons
You qualify if you sell to obtain, provide, or facilitate diagnosis, cure, mitigation, or treatment of disease, illness, or injury for yourself, a spouse, co-owner, or certain family members. A doctor's recommendation to move (even for general health improvement) can satisfy this requirement.
3. Unforeseen circumstances
The IRS specifically recognizes these as unforeseen circumstances:
- Death of a spouse, co-owner, or family member
- Divorce or legal separation
- Becoming eligible for unemployment compensation
- Multiple births from a single pregnancy (twins, triplets — needing more space)
- Natural or man-made disaster, war, or terrorism resulting in a casualty to the home
- Condemnation, seizure, or involuntary conversion of the property
Calculating the partial exclusion
The partial exclusion equals the full exclusion amount multiplied by the fraction of the 2-year requirement you completed:
Partial Exclusion = Full Exclusion × (Days of Qualified Use ÷ 730 days)
Example: Sarah (single) bought a home and lived in it for 15 months (456 days) before being relocated for work. Her partial exclusion is: $250,000 × (456 ÷ 730) = $156,164. If her gain is $140,000, she owes no tax because the partial exclusion covers the full gain.
Home Sale After Divorce — Special Rules
Divorce adds complexity to the home sale exclusion. The IRS provides specific rules for how property transfers and sales are handled in divorce situations.
Transfer between spouses (or incident to divorce)
Under IRC §1041, property transfers between spouses (or former spouses if incident to divorce) are tax-free. The receiving spouse takes over the transferring spouse's cost basis. This means no capital gains tax is triggered at the time of transfer — but the receiving spouse inherits the embedded gain.
Ownership and use test: the ex-spouse rule
If your divorce decree or separation agreement grants your former spouse use of the home, you can count their time living in the property toward your own use test. This is critical when one spouse moves out but retains ownership. Specifically:
- If you own the home but your ex-spouse lives in it per the divorce decree, their occupancy counts as your "use" for Section 121 purposes
- This prevents the situation where the departing spouse loses Section 121 eligibility simply because they moved out during a prolonged divorce
Common divorce scenarios
Scenario 1: Sell immediately during divorce. Both spouses still meet the ownership and use tests. Each spouse can exclude up to $250,000 of their share of the gain (or $500,000 on a joint final return if filing jointly for the year of sale).
Scenario 2: One spouse keeps the home, sells later. The spouse who keeps the home can count the departing spouse's prior use toward the use test (under the decree rule). They get a $250,000 exclusion as a single filer. If they received the home in the divorce, the time the other spouse owned it also counts toward the ownership test (basis carries over under §1041).
Scenario 3: Deferred sale per agreement. Some divorce agreements require the home to be sold when the youngest child turns 18. The spouse living in the home qualifies for the exclusion directly. The spouse who moved out qualifies because the decree grants continued occupancy that counts toward their use test.
Rental to Primary Residence Conversions
Converting a rental property to your primary residence and then selling it is a common strategy to access the Section 121 exclusion. However, Congress closed a major loophole in 2008 with the Housing Assistance Tax Act, introducing the concept of "nonqualified use" that limits the exclusion.
The nonqualified use rule (post-2008)
If you used the home as a rental (or any non-primary-residence purpose) after January 1, 2009, a portion of your gain is allocated to that period and cannot be excluded. The formula:
Non-Excludable Gain = Total Gain × (Period of Nonqualified Use After 2008 ÷ Total Ownership Period)
Example: Marcus bought a condo in 2017 and rented it out for 4 years (2017–2020). He then moved in and lived there as his primary residence for 3 years (2021–2023). He sells in 2024 with a $200,000 gain.
- Total ownership: 7 years
- Nonqualified use (rental period): 4 years
- Non-excludable portion: $200,000 × (4 ÷ 7) = $114,286
- Excludable portion: $200,000 × (3 ÷ 7) = $85,714 (well under the $250,000 limit)
- Taxable gain: $114,286 (taxed at long-term capital gains rates)
Important exception: nonqualified use AFTER primary residence use
Periods of nonqualified use that occur after you stop using the home as your primary residence are not counted as nonqualified use for this calculation. This means the classic strategy of "live in it for 2 years, then rent it out" still works perfectly — the rental period after your primary-residence use doesn't reduce your exclusion (as long as you sell within the 5-year window).
Depreciation recapture: the unavoidable tax
Even if you qualify for the Section 121 exclusion, you cannot exclude gain attributable to depreciation claimed (or allowable) after May 6, 1997. This depreciation recapture is taxed at a maximum rate of 25% (the unrecaptured Section 1250 rate).
Example: If you claimed $40,000 in depreciation while renting the property, you owe 25% × $40,000 = $10,000 in depreciation recapture tax, regardless of whether the rest of your gain is excluded under Section 121.
What If Your Gain Exceeds the Exclusion?
In high-appreciation markets, it's increasingly common for home sale gains to exceed the $250,000/$500,000 exclusion. When this happens, you owe capital gains tax on the excess amount only.
How the excess gain is taxed
The amount above the exclusion is taxed as a long-term capital gain (assuming you owned the home for more than one year). It's stacked on top of your ordinary taxable income to determine the applicable rate:
| Rate | Single Filer Income Range | Married Filing Jointly |
|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 |
| 15% | $49,451 – $545,500 | $98,901 – $613,700 |
| 20% | Over $545,500 | Over $613,700 |
Additionally, if your modified adjusted gross income (MAGI) exceeds $200,000 (single) or $250,000 (married filing jointly), the 3.8% NIIT applies to the lesser of your net investment income or the excess MAGI. Learn more about long-term capital gains rates and the NIIT.
Worked example: Gain exceeds the exclusion
Robert and Maria (married filing jointly) sell their San Francisco home for $2,200,000. They bought it in 2010 for $850,000 and spent $150,000 on improvements. Selling costs are $132,000 (6% commission).
- Amount Realized: $2,200,000 − $132,000 = $2,068,000
- Adjusted Basis: $850,000 + $30,000 (buying costs) + $150,000 (improvements) = $1,030,000
- Total Gain: $2,068,000 − $1,030,000 = $1,038,000
- Section 121 Exclusion: −$500,000
- Taxable Gain: $538,000
Assuming their other taxable income is $200,000 (combined wages):
- The 15% bracket ceiling for MFJ is $613,700. Their ordinary income fills $200,000, leaving $413,700 of room in the 15% bracket.
- First $413,700 of gain at 15%: $62,055
- Remaining $124,300 at 20%: $24,860
- NIIT: MAGI = $200,000 + $538,000 = $738,000. Excess over $250,000 = $488,000. Net investment income = $538,000. Lesser = $488,000 × 3.8% = $18,544
- Total federal tax on home sale: $105,459
This is why proper basis documentation and improvement tracking is so important — every dollar of additional basis directly reduces this tax bill. See our guide on strategies to reduce capital gains tax for more approaches.
State Taxes on Home Sales
Federal taxes are only part of the equation. Most states impose their own income tax on capital gains from home sales, and unlike the federal system, many states do not offer a preferential rate for long-term gains — they simply tax them as ordinary income.
States with no income tax on home sales
These states impose zero state income tax on home sale gains:
- Alaska, Florida, Nevada, New Hampshire (no tax on capital gains), South Dakota, Tennessee, Texas, Washington (but has a 7% capital gains excise tax on gains over $262,000), Wyoming
States that conform to the federal Section 121 exclusion
Most states that impose an income tax conform to the federal Section 121 exclusion — meaning they also exclude up to $250,000/$500,000 of home sale gain from state taxation. If your gain is fully covered by the federal exclusion, you typically owe nothing at the state level either.
What happens when gain exceeds the exclusion
If your gain exceeds the federal exclusion, the excess is taxed at your state's ordinary income tax rate. The effective rates on that excess can be substantial:
| State | Top Rate on Excess Gain | Notes |
|---|---|---|
| California | 13.3% | No preferential rate for gains; taxes at full ordinary rate |
| Hawaii | 11.0% | Plus 7.25% capital gains tax rate available |
| New York | 10.9% | Plus NYC surcharge (3.88%) for city residents |
| New Jersey | 10.75% | Conforms to federal exclusion |
| Oregon | 9.9% | No sales tax but high income tax |
| Colorado | 4.4% | Flat rate |
| Arizona | 2.5% | Flat rate |
| Florida / Texas | 0% | No state income tax |
For a California homeowner with $538,000 in taxable gain (like our example above), the state tax adds approximately $71,500 (13.3% × $538,000) on top of the $105,459 federal bill — for a combined tax of over $176,000. This is why some homeowners relocate before selling. See our California capital gains tax guide for detailed brackets and strategies.
Compare all state rates on our state capital gains tax comparison page.
Frequently Asked Questions
How much capital gains tax do I pay when selling my home?
Most homeowners pay zero federal capital gains tax thanks to the Section 121 exclusion, which shelters up to $250,000 of gain (single) or $500,000 (married filing jointly). You only owe tax on gain that exceeds these amounts, and only if you meet the ownership and use tests. The excess is taxed at long-term capital gains rates: 0%, 15%, or 20% depending on your total taxable income. High earners may also owe the 3.8% NIIT.
Do I have to report my home sale to the IRS if I qualify for the exclusion?
If your gain is fully excluded under Section 121 and you receive a Form 1099-S from the closing agent, you should report the sale on your tax return (Schedule D) to show the IRS why you don't owe tax. If you did not receive a Form 1099-S and your gain is fully excludable, you are not required to report the sale. However, reporting it anyway provides a clean paper trail. If any portion of your gain is taxable, you must report the sale.
Can I use the Section 121 exclusion more than once?
Yes — there is no lifetime limit on how many times you can use the exclusion. The only restriction is that you cannot claim it more than once every 2 years. If you sell a home and claim the exclusion in 2024, you must wait until 2026 or later to claim it again on a different property. This makes it possible to use the exclusion repeatedly over a lifetime of homeownership.
What if I used part of my home as a home office — does that affect the exclusion?
If your home office is within the home (a dedicated room, not a separate structure), it does not disqualify any portion of your gain from the Section 121 exclusion. However, you must recapture any depreciation claimed on the office space — that portion is taxed at up to 25%. If the office is in a separate structure (a detached building), the gain allocated to that structure may not qualify for the exclusion and would be taxed as investment property.
How does the home sale exclusion work for surviving spouses?
A surviving spouse can claim the full $500,000 exclusion if the home is sold within 2 years of the spouse's death, the home was used as the primary residence by both spouses for 2 of the last 5 years, and neither spouse used the exclusion within the prior 2 years. After the 2-year window closes, the surviving spouse reverts to the $250,000 single-filer exclusion. Additionally, the deceased spouse's share receives a stepped-up basis to fair market value at death, which can significantly reduce or eliminate the taxable gain.
Should I do a 1031 exchange instead of claiming the Section 121 exclusion?
The Section 121 exclusion is almost always better for a primary residence because it permanently eliminates tax on the excluded gain — you don't need to reinvest the proceeds. A 1031 exchange only defers tax and requires reinvestment into like-kind property. However, if you're selling a home that was primarily used as rental property and doesn't qualify for Section 121, a 1031 exchange may be your best option to defer the gain. In some cases, you can use both — applying Section 121 to the primary-residence portion and a 1031 exchange to the investment portion. Consult a tax advisor for this complex planning.