Taxes When Selling a House: Capital Gains & Exclusion Rules
Meet David and Maria. They bought their Chicago home in 2018 for $380,000, added a finished basement and new kitchen for $85,000, and just accepted a $750,000 offer. Their potential capital gain is $370,000 — and if they make one wrong assumption about the tax rules, they could overpay the IRS by tens of thousands of dollars. This guide walks through the complete calculation: how the Section 121 exclusion works, what counts as basis, where depreciation recapture comes from, and the scenarios where the rules don't work the way people expect.
Key Takeaways
- • Single filers exclude up to $250,000 of capital gain; married filing jointly excludes up to $500,000 under IRC Section 121
- • You must pass the ownership AND use tests — 2 years out of the last 5 for both — to claim the full exclusion
- • Adjusted basis is not just what you paid — it includes closing costs, capital improvements, and affects every dollar of taxable gain
- • Depreciation recapture is taxed at up to 25%, separately from regular capital gains, if the property was ever used for business or rental
- • According to the National Association of Realtors, the median existing-home price in early 2026 is $398,400 — with typical holding periods of 8–10 years, many homeowners are selling with gains that approach or exceed the exclusion limits
David and Maria's Home Sale: The Numbers
Let's build out the full tax picture for this scenario before breaking down each component. Here are the facts:
Case Study: Chicago Home Sale, 2026
Purchase price (2018):
$380,000
Purchase closing costs:
$7,500
Kitchen remodel (2021):
$45,000
Basement finish (2023):
$40,000
Sale price (2026):
$750,000
Selling costs (agent, fees):
$45,000
Filing status:
Married Filing Jointly
Both lived in home since 2018:
Yes (8 years)
Any prior rental use:
No
Step 1: Calculate Adjusted Cost Basis
Your cost basis is not simply what you paid for the house. According to IRS Publication 523, your adjusted cost basis starts with the purchase price and adds every dollar you spent acquiring and improving the property. Getting this number right reduces your taxable gain — sometimes substantially.
What adds to your basis:
- Purchase price — the amount you paid to the seller
- Closing costs when you bought — title insurance, legal fees, recording fees, transfer taxes paid by buyer, real estate commissions paid at purchase (uncommon but possible), loan origination fees (not deductible as points) counted as basis
- Capital improvements — additions, renovations, major systems (new roof, HVAC, electrical), finished basement, kitchen remodel, deck additions, landscaping that adds permanent value. These are different from repairs.
- Special assessments — charges by local government for improvements like sewer lines or sidewalks that benefit your property
What does NOT add to your basis:
- Repairs — fixing a leaky roof, painting, replacing a broken appliance
- Mortgage payments, homeowners insurance, property taxes (these are operating expenses)
- Maintenance costs — regular upkeep that keeps the home in current condition
Adjusted Basis Calculation — David and Maria
Purchase price: $380,000
+ Purchase closing costs: $7,500
+ Kitchen remodel: $45,000
+ Basement finish: $40,000
= Adjusted Basis: $472,500
If David and Maria didn't track their improvements and used only their $380,000 purchase price as basis, their taxable gain would be $92,500 higher. That's the financial consequence of poor record-keeping — at a 15% long-term capital gains rate, it would cost them $13,875 in unnecessary taxes.
Step 2: Calculate the Amount Realized on the Sale
The amount realized is your gross selling price minus the costs of selling. Deductible selling costs include:
- Real estate commissions (typically 5–6% of sale price in most markets, though buyer agent commission rules have shifted post-NAR settlement)
- Title insurance, attorney fees, escrow fees
- Transfer taxes paid by the seller
- Recording fees
- Advertising costs (staging, photography)
- Any seller concessions paid to the buyer (repairs credited at closing, closing cost contributions)
Amount Realized — David and Maria
Sale price: $750,000
− Real estate commissions & fees: $45,000
= Amount Realized: $705,000
Step 3: Calculate the Raw Capital Gain
Capital Gain Calculation
Amount Realized: $705,000
− Adjusted Basis: $472,500
= Capital Gain: $232,500
Step 4: Apply the Section 121 Exclusion
This is the rule that makes most home sales completely tax-free. Under IRC Section 121, you can exclude gain from the sale of your principal residence if you meet two tests:
Ownership test: You must have owned the home for at least 2 years during the 5-year period ending on the sale date. The 2 years don't need to be consecutive.
Use test: You must have used the home as your principal residence for at least 2 years during the same 5-year lookback period. Again, the 2 years don't need to be consecutive.
Frequency limitation: You can use the exclusion only once every 2 years. If you excluded gain on a prior home sale within the past 24 months, you cannot use it again.
Exclusion amounts for 2026 (unchanged from prior years):
- Single filers: up to $250,000
- Married filing jointly: up to $500,000
David and Maria meet both tests — they've owned and lived in the home since 2018, well over 2 years. Their $232,500 gain falls entirely within the $500,000 MFJ exclusion.
Section 121 Exclusion — David and Maria
Capital Gain: $232,500
− Section 121 Exclusion (MFJ): up to $500,000
= Taxable Gain: $0
Federal capital gains tax owed: $0
Their entire $232,500 gain is excluded. They owe no federal capital gains tax on this sale. No Schedule D entry required for an excluded gain below the threshold.
When the Gain Exceeds the Exclusion: Tax Rate Calculation
The situation changes dramatically for sellers in high-appreciation markets. Consider a different scenario: a single homeowner in San Francisco who bought in 2010 for $650,000 (adjusted basis $720,000 after improvements) and sells in 2026 for $1,450,000 (net proceeds $1,380,000 after selling costs).
High-Appreciation Sale — Single Filer, San Francisco
Amount Realized: $1,380,000
− Adjusted Basis: $720,000
= Capital Gain: $660,000
− Section 121 Exclusion (single): $250,000
= Taxable Capital Gain: $410,000
This seller has $410,000 of taxable capital gain. What rate applies? For 2026, the long-term capital gains rates for single filers are:
| Rate | Single Filer Income Threshold (2026) | MFJ Income Threshold (2026) |
|---|---|---|
| 0% | $0 – $49,450 | $0 – $98,950 |
| 15% | $49,451 – $544,850 | $98,951 – $614,050 |
| 20% | Above $544,850 | Above $614,050 |
If this single seller has $150,000 in ordinary income plus $410,000 in capital gains, their total income is $560,000. The capital gains rate is applied to the portion that falls within each bracket. Per the CBO's analysis of capital gains taxation, most of the $410,000 gain would fall in the 15% bracket, with a portion potentially reaching the 20% bracket.
Additionally, the 3.8% Net Investment Income Tax (NIIT) applies to the lesser of net investment income or the excess of MAGI over $200,000 (single) or $250,000 (MFJ). At $560,000 MAGI, this seller would owe NIIT on $360,000 of the gain, adding roughly $13,680 to the federal tax bill. Use our capital gains tax guide for a full rate analysis.
Depreciation Recapture: The Hidden Tax for Former Rental Owners
If you ever rented your home — even for part of the time you owned it — or claimed a home office deduction, depreciation recapture will affect your tax calculation. This is one of the most frequently misunderstood aspects of home sale taxation.
Here's how it works: when you use a home as a rental, you can deduct depreciation (generally the building value divided by 27.5 years annually). The IRS allows this deduction to reduce your taxable rental income each year. But when you sell, you must "recapture" the total depreciation you claimed — paying a maximum 25% tax on that amount, regardless of whether the gain would otherwise be excluded under Section 121.
Example: Suppose a homeowner converted their home to a rental for 3 years, claiming $12,000/year in depreciation ($36,000 total). Even if the home sale qualifies for the Section 121 exclusion, the seller owes tax on $36,000 of depreciation recapture at up to 25% = up to $9,000 in additional tax that cannot be excluded.
The home office deduction creates a similar issue, though typically on a much smaller scale. If you deducted a home office for 10 years and claimed $3,000/year in depreciation for that portion of the home, you have $30,000 in depreciation that must be recaptured at sale. The Section 121 exclusion protects the capital gain but not the depreciation recapture.
For homeowners who rented their property before converting it back to a primary residence, the Section 121 exclusion amount must also be allocated between the qualified and non-qualified use periods, which can reduce the exclusion amount. See our detailed guide on rental property tax deductions and the 1031 exchange guide for strategies to defer these taxes if you're selling a rental.
Partial Exclusion: When You Don't Meet the Full 2-Year Rule
Life doesn't always wait 2 years. Job relocations, health emergencies, divorces, and other circumstances can force a sale before the ownership and use tests are met. The IRS recognizes this with a partial exclusion rule.
Under IRS Publication 523, a partial exclusion is available when the primary reason for the sale is:
- Change in employment location — a new job that is at least 50 miles farther from your old home than your former job was
- Health reasons — a doctor-recommended move related to illness, injury, or disability affecting you, your spouse, or certain other family members
- Unforeseen circumstances — the IRS defines this broadly to include natural disasters, involuntary conversion, death, job loss, multiple births, divorce, or legal separation
The partial exclusion is calculated as a fraction of the full exclusion: (months of qualifying use ÷ 24 months) × full exclusion amount.
Partial Exclusion Example — Job Relocation After 15 Months
Filing status: Single
Qualifying use: 15 months of 24-month full period
Partial exclusion ratio: 15 ÷ 24 = 62.5%
Maximum exclusion: $250,000 × 62.5% = $156,250
Capital gains above $156,250 would be taxable. Qualifying reason for early sale is required.
State Income Taxes on Home Sale Gains
Most states conform to the federal Section 121 exclusion — if you exclude the gain federally, you also exclude it for state tax purposes. However, key differences apply:
| State | Section 121 Conformity | Capital Gains Treatment | Top Rate on Gain Above Exclusion |
|---|---|---|---|
| California | Yes — conforms | Taxed as ordinary income | Up to 13.3% |
| New York | Yes — conforms | Taxed as ordinary income | Up to 10.9% |
| Texas/Florida | N/A — no income tax | No state tax | 0% |
| Arizona | Yes — conforms | Taxed at flat rate | 2.5% |
| Colorado | Yes — conforms | Taxed at flat rate | 4.40% |
| North Carolina | Yes — conforms | Taxed at flat rate | 3.99% |
| Pennsylvania | Partial | PA uses own rules; generally excluded if meet tests | 3.07% |
| Washington | N/A — no income tax | 7% CGT on gains above $250K (separate from income tax) | 7% on gains over $250K |
California deserves special attention. If your home sale generates $500,000 of gain and you're a married couple, all of it falls within the federal exclusion. But if your gain is $700,000, the $200,000 above the exclusion is taxed federally at capital gains rates — and California taxes it as ordinary income at up to 13.3%. A California high earner with $200,000 of non-excluded gain could owe $26,600 in California tax on top of any federal capital gains tax.
Common Mistakes That Cost Sellers Money
Mistake 1: Not Tracking Capital Improvements
According to the National Association of Realtors, the median tenure in a home before selling is 8 years as of their 2025 Home Buyer and Seller Generational Trends report. Eight years is enough time to renovate a kitchen, finish a basement, add a deck, and replace major systems — improvements that could total $50,000–$150,000 or more. Without documentation (receipts, permits, contractor invoices), you can't prove the higher basis. The IRS can challenge a basis claim without documentation. Start a home improvement folder from the day you buy.
Mistake 2: Assuming the Exclusion Is Automatic
The Section 121 exclusion is not automatic. You elect it by not reporting the sale on your return when the gain is fully excluded. But if you receive a Form 1099-S (Proceeds from Real Estate Transactions), the IRS has a record of the sale. If the gain exceeds the exclusion, you must report it on Schedule D. Failing to report when required — even if you believe you owe nothing — can trigger a CP2000 notice questioning the unreported income.
Mistake 3: Overlooking the 2-Year Use Test During Rental Periods
People who converted their primary residence to a rental and later sell can still qualify for the Section 121 exclusion — but they must have lived in the home as a primary residence for at least 2 of the last 5 years before the sale. If you moved out in 2021 and sell in 2026, that's 5 years since you lived there — just barely outside the window. Selling in 2025 would qualify; selling in 2026 would not. The timing of your sale relative to when you moved out is critical.
Mistake 4: Conflating Selling Costs and Repairs Made at Sale
When preparing a home for sale, sellers often spend $10,000–$30,000 on paint, landscaping, minor repairs, and staging. These costs are not selling costs (which reduce amount realized) and they are not capital improvements to basis. They are non-deductible personal expenses. Only costs that are directly related to the transaction itself — commissions, transfer taxes, title fees, legal fees — reduce the amount realized. Knowing this distinction prevents an overestimate of deductible selling costs.
Planning Strategies to Minimize Home Sale Taxes
1. Time the Sale to Reset the Exclusion
If you used the Section 121 exclusion on a prior home sale, you must wait 2 years before using it again. If you're approaching the 2-year mark, waiting a few extra months to confirm eligibility is worth it — the exclusion saves up to $500,000 of capital gains that would otherwise be taxed.
2. Re-establish Primary Residence Before Selling a Rental
If you own a rental property with significant appreciation, moving back into it and reestablishing it as your primary residence for 2 years may allow you to use the Section 121 exclusion. There are important limitations — the exclusion doesn't apply to the portion of gain attributable to non-qualified use periods before May 6, 1997 or after 2008 for periods of non-primary residential use — but for many long-term owners the strategy remains viable.
3. Manage Other Income in the Year of Sale
If any gain will be taxable, your ordinary income in the sale year determines your capital gains rate. A single filer who is otherwise at $40,000 of ordinary income in 2026 has $9,450 of headroom in the 0% long-term capital gains bracket. Deferring deductible retirement contributions, taking sabbatical income reductions, or timing other income into adjacent years can shift more gain into the 0% or 15% bracket versus the 20% bracket. Use our long-term vs. short-term capital gains guide to plan your rate exposure.
4. Document Everything That Could Be a Capital Improvement
When in doubt about whether an expense is a repair or an improvement, document it anyway and let your tax professional make the classification at sale time. The cost of keeping a receipt is zero; the cost of not having it when you need to claim a $40,000 kitchen renovation as basis can be thousands of dollars.
Frequently Asked Questions
Do I have to pay capital gains tax when selling my house?
Not necessarily. Under IRS Section 121, single filers can exclude up to $250,000 of gain and married couples up to $500,000 — provided you owned and used the home as your principal residence for at least 2 of the last 5 years and haven't used the exclusion in the past 2 years. Most long-term homeowners qualify and owe zero capital gains tax.
How do I calculate capital gains on a home sale?
Capital gain = amount realized (sale price minus selling costs) minus adjusted cost basis (purchase price + closing costs + capital improvements). Subtract the Section 121 exclusion. If the result is positive, you owe capital gains tax on that amount. Thorough basis documentation — tracking every capital improvement — is the single most valuable tax-reduction step.
What capital gains tax rate applies to home sales?
If you owned the home more than one year, long-term rates apply: 0% (single income up to $49,450), 15% ($49,451–$544,850), or 20% (above $544,850) in 2026. Plus a potential 3.8% NIIT surcharge if MAGI exceeds $200,000 single/$250,000 MFJ. Gains on homes held one year or less are taxed as ordinary income at rates up to 37%.
What is depreciation recapture on a home sale?
If you rented the home or claimed a home office deduction, you must pay tax on depreciation taken at up to 25%, even if the overall gain falls within the Section 121 exclusion. A homeowner who rented the property for 5 years and claimed $10,000/year in depreciation owes tax on $50,000 of recapture regardless of exclusion eligibility.
Can I get a partial exclusion if I don't meet the 2-year rule?
Yes, if the primary reason for the early sale is job relocation (new job 50+ miles farther away), health issues, or an unforeseen circumstance (divorce, job loss, natural disaster). The partial exclusion is proportional: months of qualifying use ÷ 24 months × full exclusion amount.
Does the $500,000 exclusion apply if only one spouse used the home?
No. The $500,000 MFJ exclusion requires both spouses to meet the use test (2-year primary residence), at least one to meet the ownership test, and neither to have used the exclusion in the past 2 years. If only one spouse meets the use test, the exclusion is limited to $250,000.
Do I owe state income tax on my home sale gain?
Most states conform to the federal exclusion, so excluded gain is also state-tax-exempt. Gain above the exclusion is taxed as ordinary income in most states (unlike the preferential federal rate). California taxes non-excluded gain at up to 13.3%, making the combined federal + state rate for high earners potentially exceed 33% on gain above $500,000.
Estimate Your Home Sale Capital Gains Tax
Use our capital gains calculator to see exactly how much tax you'd owe after applying the Section 121 exclusion.
Calculate Capital Gains Tax →