A home sale exclusion is a federal tax rule that lets you leave some or all of the profit from selling your main home out of taxable income. It is not a blanket exemption from capital gains tax; it is a ceiling on the gain you can exclude before tax applies. If you are still shopping, the Home Affordability Calculator can help you set a price range.

What is the home sale exclusion?

The home sale exclusion is a federal income tax benefit that removes a set amount of gain from taxable income when you sell a primary residence. The amount depends on filing status: a single filer can exclude up to $250,000 of gain, and a married couple filing jointly can exclude up to $500,000. The gain must come from a home you owned and used as your main home for at least two of the five years before the sale.

Excluded gain is not reported as capital gain and is also not subject to the 3.8% net investment income tax. The exclusion does not apply to a vacation home, a rental property you never lived in, or a home you flip as a business. It also does not create a deductible loss if you sell for less than your basis.

A loss on a personal home is not deductible, and the $3,000 capital loss limit applies to investment losses, not to a loss on your main home. That distinction matters if you are comparing a home sale with the sale of stocks or other investments.

How do the ownership and use tests work?

You must own the home and use it as your main home for at least two of the five years ending on the sale date. The two years do not have to be consecutive. Short absences, such as a vacation or a temporary work assignment, generally count as time lived in the home if you kept it as your main home.

The ownership test and the use test are separate. You could own a home for five years but rent it out for four and fail the use test. Married couples filing jointly: one spouse can meet the ownership test, but both spouses must meet the use test.

You can generally use the exclusion once every two years. If you used it on another home within that window, the full exclusion may not be available. If you are deciding between renting and buying, the rent vs buy guide shows how break-even math works.

How do you calculate taxable gain on a home sale?

Subtract selling costs and your adjusted basis from the sale price, then subtract the exclusion. The remaining gain is taxable.

Step 1: Figure the amount realized

The amount realized is the sale price minus selling expenses. Selling expenses include real estate commissions, title fees, attorney fees, and transfer taxes. If the buyer pays some of your closing costs, those payments can increase the amount realized.

Step 2: Add up adjusted basis

Basis starts with what you paid for the home. Add qualifying capital improvements, such as a new roof, an addition, or a major plumbing replacement. Add certain closing costs from the purchase.

Subtract any depreciation you claimed if you used the home for rental or business. Routine repairs and maintenance do not add to basis.

Step 3: Subtract basis from amount realized

The difference is your realized gain or loss. A gain is taxable; a loss on a personal home is not deductible. This is one of the most common mistakes.

Step 4: Apply the home sale exclusion

If you meet the ownership and use tests, subtract the exclusion from the gain. A single filer can exclude up to $250,000; a married couple filing jointly can exclude up to $500,000. If the gain is below the exclusion, the taxable gain is zero.

Step 5: Tax the remaining gain

Gain above the exclusion is generally long-term capital gain if you owned the home more than one year. It is taxed at 0%, 15%, or 20%, depending on taxable income. Short-term gain, from a home owned one year or less, is taxed at ordinary income rates, with a top 2026 rate of 37%.

For example, assume a single filer bought a home for $300,000, added $50,000 of qualifying improvements, and sold it for $650,000. Selling costs were $40,000. Amount realized is $650,000 − $40,000 = $610,000.

Adjusted basis is $300,000 + $50,000 = $350,000. Realized gain is $610,000 − $350,000 = $260,000. After the $250,000 exclusion, taxable gain is $10,000.

At the 15% long-term capital gain rate, tax is $1,500. Her other taxable income is $60,000, which already fills the 0% bracket, so the entire $10,000 gain falls in the 15% bracket. She is below the $200,000 NIIT threshold, so no 3.8% tax.

What capital gains rate applies to gain above the exclusion?

Gain above the exclusion is long-term capital gain if you owned the home more than one year. For 2026, the federal rates are 0%, 15%, or 20%, depending on taxable income. The 2026 figures apply to returns filed in 2027.

Filing status0% rate up to15% rate up to20% rate above
Single$49,450$545,500Over $545,500
Married filing jointly$98,900$613,700Over $613,700
Head of household$66,200$579,600Over $579,600
Married filing separately$49,450$306,850Over $306,850

The 20% rate applies only to the amount above the 15% ceiling. A large taxable gain may require estimated tax payments, especially if you do not have enough withholding. The extra mortgage payments guide is useful if you are still paying off a mortgage and want to compare interest savings.

How does the 3.8% net investment income tax affect a home sale?

The 3.8% NIIT can apply to taxable gain above the exclusion, but it does not apply to gain that is excluded from regular tax. NIIT is 3.8% of the lesser of net investment income or modified adjusted gross income above the threshold.

The thresholds are $250,000 for married filing jointly, $200,000 for single or head of household, and $125,000 for married filing separately. For example, a married couple with $300,000 MAGI and $20,000 of taxable home gain could owe 3.8% × $20,000 = $760. That assumes the gain is net investment income and the excess MAGI is at least $20,000.

Excluded gain does not count as net investment income. The 0.9% Additional Medicare Tax applies to wages and self-employment income, not to this gain, so do not add it to the home sale calculation.

What happens if you rented out the home or used it for business?

The exclusion can still apply after you convert a rental to your main home, but depreciation and nonqualified use can reduce it. Depreciation taken on the home generally cannot be excluded. That gain is taxed at a maximum 25% rate as unrecaptured Section 1250 gain.

If you rented the home for part of the five-year period, you may fail the use test unless you lived in it for at least two of the five years. Nonqualified use, such as renting the home before you moved in, can also reduce the exclusion. Keep depreciation schedules and rental tax returns.

What if you fail the two-year tests?

You may still qualify for a reduced exclusion if the sale is due to a change in workplace, health, or an unforeseen circumstance. The reduced amount is generally a fraction of the full exclusion based on the time you owned and used the home.

A job change must be a change in the location of your work, not just a new employer. Health reasons include a doctor’s recommendation for a move. Unforeseen circumstances include events such as divorce, death, or multiple births.

If you simply decide to sell early, the full exclusion is not available. The gain may be taxable, and you may need to make an estimated tax payment.

What records should you keep?

Keep records that prove your purchase price, qualifying improvements, selling costs, and time lived in the home. Closing statements, receipts, permits, and tax returns for rental years support your adjusted basis and the exclusion.

The IRS can ask for them years later, so keep them until the statute of limitations for that tax year has run. If you used the home for rental, keep depreciation schedules and any Form 1099-S you receive. Report the sale on Form 8949 and Schedule D when you have taxable gain or receive Form 1099-S.

The first-time home buyer checklist has a recordkeeping list you can adapt.

Common mistakes

  • Reporting the entire sale price as gain instead of subtracting adjusted basis.
  • Forgetting to add qualifying improvements to basis, which raises the taxable gain.
  • Assuming the exclusion is automatic; you must meet the tests and keep records.
  • Using the full exclusion more than once within two years without a reduced-exclusion reason.
  • Missing the 3.8% NIIT on gain above the exclusion.
  • Deducting a loss on a personal home.
  • Ignoring state tax rules, which may not follow the federal exclusion.