$LevyIO
Real EstateMarch 7, 202615 min read

Tax Implications of Selling Your Home: Exclusion Rules & Capital Gains

Selling your home can result in significant capital gains, but the Section 121 exclusion allows most homeowners to exclude up to $250,000 (single) or $500,000 (married filing jointly) of profit from taxes. This guide explains who qualifies, how to calculate your cost basis, when partial exclusions apply, and what happens when you do not meet the full requirements. Understanding these rules before you sell can save you tens of thousands of dollars.

The Section 121 Home Sale Exclusion

Under Section 121 of the Internal Revenue Code, you can exclude up to $250,000 of capital gains from the sale of your primary residence if you are single, or up to $500,000 if you are married filing jointly. This exclusion is one of the most valuable tax benefits available to homeowners. On a home that has appreciated $400,000 since purchase, a married couple could owe zero federal tax on the entire gain.

To qualify for the full exclusion, you must meet the ownership test and the use test. The ownership test requires that you owned the home for at least two of the five years before the sale. The use test requires that you used the home as your primary residence for at least two of the five years before the sale. The two years do not need to be consecutive, and the ownership and use periods do not need to overlap (though they typically do). You can use this exclusion once every two years.

Calculating Your Capital Gain

Your capital gain on a home sale is the selling price minus your adjusted cost basis minus selling expenses. The cost basis is not simply what you paid for the home. It includes the original purchase price plus closing costs paid at purchase (title insurance, recording fees, attorney fees) plus the cost of capital improvements made during ownership minus any casualty loss deductions claimed minus any depreciation taken (if you rented part of the home or claimed a home office deduction using the regular method).

Capital improvements are expenditures that add value to your home, prolong its useful life, or adapt it to new uses. Examples include a new roof, kitchen remodel, bathroom addition, HVAC replacement, new windows, deck construction, landscaping, and driveway repaving. Repairs and maintenance (painting, fixing leaks, replacing broken fixtures) do not increase your basis. Keep receipts for all improvements because they directly reduce your taxable gain. If you spent $80,000 on improvements over 15 years, that reduces your taxable gain by $80,000.

Example Calculation

ItemAmount
Sale price$750,000
Original purchase price($350,000)
Purchase closing costs($8,000)
Capital improvements($65,000)
Selling expenses (agent commissions, etc.)($45,000)
Capital gain$282,000
Section 121 exclusion (married)($282,000)
Taxable gain$0

In this example, the married couple's $282,000 gain is fully covered by the $500,000 exclusion, so they owe zero tax. If the same homeowner were single, the $282,000 gain exceeds the $250,000 exclusion by $32,000. That $32,000 would be taxed as a long-term capital gain at 0%, 15%, or 20% depending on income. Use our Capital Gains Calculator to determine your rate.

The Married Filing Jointly $500,000 Exclusion

To claim the full $500,000 exclusion when married filing jointly, all of the following must be true: you file a joint return for the year of sale, at least one spouse meets the ownership test (owned the home for 2 of the last 5 years), both spouses meet the use test (each lived in the home as primary residence for 2 of the last 5 years), and neither spouse used the exclusion in the prior 2 years. If only one spouse meets the use test, the couple is limited to a $250,000 exclusion.

This creates important planning opportunities. If you are getting married and one spouse owns a home, both spouses should live in the home for at least two years before selling to qualify for the full $500,000 exclusion. If you are getting divorced and one spouse will keep the home, the departing spouse should try to sell within three years of moving out (while they can still meet the 2-of-5-year use test). For more on filing status considerations, see our guide on Married Filing Jointly vs Separately and our Marriage Tax Calculator.

Partial Exclusions: When You Do Not Meet Full Requirements

If you do not meet the full two-year ownership and use requirements, you may still qualify for a partial exclusion if the sale was due to a change in place of employment, health reasons, or certain unforeseen circumstances. The partial exclusion is prorated based on the fraction of the two-year requirement you met. If you lived in your home for 12 months (50% of the 24-month requirement) before selling due to a job relocation, you can exclude up to $125,000 (50% of $250,000) or $250,000 (50% of $500,000 if married).

Qualifying unforeseen circumstances include job loss, divorce or legal separation, death, natural disaster, multiple births from the same pregnancy, and other events determined by the IRS. The employment change must involve a new principal place of work at least 50 miles farther from the home than your old workplace. Health-related sales must be prescribed by a doctor. These partial exclusion rules are specifically outlined in IRS Publication 523 and Regulation Section 1.121-3.

Selling a Home That Was Rented or Used for Business

If you rented out your home or used part of it for business before selling, the tax treatment becomes more complex. Under the nonqualified use rules, any gain attributable to periods of nonqualified use after 2008 cannot be excluded. Nonqualified use is any period when the home was not used as your primary residence (excluding temporary absences of up to two years, military service of up to 10 years, and the period after last use as a primary residence).

For example, if you owned a home for 10 years, rented it out for 4 years, then lived in it as your primary residence for 6 years before selling, 40% of the gain (4 years out of 10) is allocable to nonqualified use and cannot be excluded. On a $400,000 gain, $160,000 would be taxable even though you meet the 2-of-5-year requirement. Additionally, any depreciation claimed during the rental period must be recaptured at a 25% rate regardless of the exclusion. If you claimed $30,000 in depreciation, you owe $7,500 in depreciation recapture tax.

The Home Office Depreciation Trap

If you claimed a home office deduction using the regular method (which includes depreciation), the depreciation portion is subject to recapture at 25% when you sell, regardless of whether you qualify for the Section 121 exclusion. The gain allocable to the office space, however, can still be excluded under Section 121 as long as the office is within the home (not a separate structure like a detached garage office). If you used the simplified method ($5 per square foot), no depreciation is claimed and there is no recapture.

For example, if your home office was 10% of your home and you claimed $15,000 in depreciation over the years, you owe $3,750 (25% of $15,000) in depreciation recapture when you sell, even if the rest of your gain is fully excluded. This is a common surprise for home sellers who claimed the regular home office deduction. The simplified method avoids this issue entirely, which is one reason many tax professionals recommend it despite the lower deduction amount.

Selling Expenses That Reduce Your Gain

Selling expenses are subtracted from the sale price when calculating your gain. These include real estate agent commissions (typically 5-6% of the sale price), attorney fees for the sale, title insurance, escrow fees, recording fees, transfer taxes, staging costs, inspection fees paid by the seller, and advertising costs. On a $750,000 home sale with a 5.5% agent commission, selling expenses alone could be $41,250 plus additional costs, reducing your gain by that amount. Always track these costs carefully.

Net Investment Income Tax (NIIT)

Even if your gain exceeds the exclusion, you may owe an additional 3.8% Net Investment Income Tax on the taxable portion if your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). Capital gains from home sales that exceed the Section 121 exclusion count as net investment income. On a $100,000 taxable gain above the exclusion, a high-income taxpayer could owe an additional $3,800 in NIIT on top of the regular capital gains tax. Use our Income Tax Calculator to factor in the NIIT.

State Tax on Home Sales

Most states with income taxes also tax capital gains from home sales. Some states follow the federal Section 121 exclusion, while others have their own rules or additional taxes. Pennsylvania exempts gains on a principal residence entirely. New York and California follow the federal exclusion but tax any excess gains at state capital gains rates. Some states impose transfer taxes on the sale itself (not the gain), such as New York's mansion tax (1% on sales over $1 million) and Connecticut's conveyance tax (0.75% on the first $800,000 plus 1.25% on the excess). Use our Sales Tax by State guide and check your state's income tax rules using our state income tax pages.

Converting a Rental to Primary Residence Before Selling

If you own a rental property and want to take advantage of the Section 121 exclusion, you can convert it to your primary residence, live in it for at least two years, and then sell it. However, gains attributable to the rental period after 2008 cannot be excluded under the nonqualified use rules. If you owned the rental for 8 years and lived in it for 2 years before selling, 80% of the gain is allocable to nonqualified use and taxable. The exclusion only applies to the 20% of gain from the 2 years of personal use.

Depreciation recapture at 25% also applies to any depreciation claimed during the rental period. This strategy is still valuable because it excludes a portion of the gain, but it is not the complete tax elimination that some investors expect. For deferring the full gain on investment properties, a 1031 exchange is typically more effective if you plan to continue investing in real estate.

Inherited and Gifted Homes

If you inherited a home, your cost basis is the fair market value on the date of the deceased's death (the stepped-up basis). If the home was worth $400,000 when inherited and you sell it for $420,000 after living in it for two years, your gain is only $20,000, well within the exclusion. You do not need to meet the ownership test for inherited homes if the deceased met it before death. However, you still need to meet the two-year use test.

If you received a home as a gift, your basis is the donor's original basis (carryover basis), which could be much lower than the current market value. A gifted home that was purchased for $100,000 decades ago and is now worth $600,000 has a $500,000 built-in gain. If you are single, only $250,000 is excludable, leaving $250,000 taxable. This is why gifts of appreciated property require careful tax planning. For more on gifting strategies, read our Estate Tax Planning Guide.

Tax Reporting: What to File

If your gain is fully excluded and you meet all requirements, you generally do not need to report the sale on your tax return (though it is good practice to keep records). If you have a taxable gain above the exclusion, depreciation recapture, or if you receive a Form 1099-S from the closing agent, report the sale on Schedule D and Form 8949. Even if the gain is fully excludable, if you receive a 1099-S, the IRS matches that amount against your return, so consider reporting the sale and exclusion to avoid a mismatch notice. Use our Tax Bracket Calculator to understand how a taxable home sale gain affects your overall tax bracket.

Strategies to Minimize Tax on Home Sales

  • Track every capital improvement receipt throughout ownership to maximize your basis
  • Ensure both spouses meet the 2-year use test before selling to claim the $500,000 exclusion
  • Time the sale so that your gain stays within the exclusion amount when possible
  • If your gain exceeds the exclusion, time the sale for a year when your income is lower to minimize the capital gains rate
  • Use the simplified home office method to avoid depreciation recapture
  • If you are selling an inherited home, sell quickly to minimize gain above the stepped-up basis
  • If you cannot meet the full 2-year test, document qualifying events for a partial exclusion
  • Consider a 1031 exchange if converting a personal residence to investment use

Frequently Asked Questions

How much profit can I make selling my home tax-free?

If you are single, you can exclude up to $250,000 in capital gains from the sale of your primary residence. Married couples filing jointly can exclude up to $500,000. To qualify, you must have owned and lived in the home as your primary residence for at least 2 of the 5 years before the sale, and you must not have used the exclusion in the prior 2 years.

Do I have to report the sale of my home on my tax return?

If your gain is fully excluded under Section 121, you generally do not need to report it. However, if you receive a Form 1099-S from the closing agent, you should report the sale on Schedule D and show the exclusion to avoid an IRS mismatch notice. If your gain exceeds the exclusion, you must report the taxable portion on Schedule D and Form 8949.

Can I get a partial exclusion if I lived in my home for less than two years?

Yes, you may qualify for a partial exclusion if you sold due to a change in employment (new job at least 50 miles farther), health reasons (recommended by a doctor), or unforeseen circumstances (job loss, divorce, natural disaster). The exclusion is prorated based on the fraction of the 2-year requirement you met. For example, 12 months of use gives you 50% of the full exclusion amount.

Calculate Your Capital Gains on a Home Sale

Use our free calculator to determine your capital gains tax rate and estimate what you owe after the Section 121 exclusion.

Use the Capital Gains Calculator

Related Articles