Skip to main content
capitalgaintaxcalc.com

Home sale · beginner · 9 min

Avoid Capital Gains Tax on a House: 7 Ways (2026)

Updated 2026-10-12

Educational only. Not tax advice.

Short answer

You can exclude up to $250,000 of gain on a main home in 2026, or $500,000 if you file jointly, when you owned and lived there for 2 of the last 5 years. The other six ways change basis, timing, or the type of property. None of them erases tax by itself.

Key takeaways

  • The largest lever for a main home is the Section 121 exclusion.
  • Improvements and selling costs change the gain before any exclusion.
  • A rental uses the 1031 path, not the home exclusion.
  • In the example, tax falls from $48,080.00 to $4,500.00.
  • Installment sales and the seniors myth are named here and are not linked, because those pages are not live.

Before you start

Section 121 exclusion
Section 121 lets you exclude up to $250,000 of gain on a main home, or $500,000 on a joint return, after the ownership and use tests.
Adjusted basis
Adjusted basis starts with the purchase price, adds improvements, and subtracts depreciation on a rental. Selling costs reduce the amount realized.

Live there 2 of the last 5 years

Own the home for at least 2 years of the 5 years before the sale. Live in it as your main home for at least 2 years of that same period. The two periods do not have to be continuous, and they do not have to be the same months.

The cap is $250,000 for a single filer and $500,000 for a joint return. Gain above the cap is taxable. The Section 121 guide is the home for the tests. This page does not repeat every exception.

Add improvements to basis

A new roof, a room addition, and a replaced system add to basis. A repair that only keeps the home in working order does not. Higher basis means a smaller gain.

Keep invoices. The calculator has a field for improvement costs. Do not put repairs in that field.

Count selling costs

Real estate commission, transfer taxes, and other selling costs reduce the amount you realized. A lower amount realized means a smaller gain.

Do not subtract the same commission twice. If the closing statement already netted it from the price, leave the selling-cost field at zero.

Time the sale

A sale after you have held the property more than one year uses the long-term rates. A sale on the anniversary date is still short-term. Other taxable income fills the brackets first.

Waiting can also finish the 2-of-5 test. Selling a month early can lose the exclusion. Count the months before you list the home. A calendar, not a guess, should decide the date. Write that date down.

Use a 1031 exchange for investment property

Section 121 is for a main home. A rental or other investment property uses the like-kind rules when you want to defer gain. You identify a replacement within 45 days and you close within 180 days.

The 1031 guide covers the clocks. The calculator can compare a taxable sale with a full rollover. It does not hold the funds or file Form 8824.

Offset the gain with losses

Capital losses offset capital gains. A loss in a taxable brokerage account can reduce the taxable part of a home sale that remains after the exclusion.

A loss inside an IRA does not create a current capital loss. The wash-sale rule can disallow a securities loss if you buy the same investment again too soon. The loss carryover guide is the home for the $3,000 limit.

Spread the gain with an installment sale

An installment sale reports gain as you receive principal. Form 6252 is the form. Interest you receive is not capital gain.

This site does not have an installment-sale page yet. The sentence above is plain text. A link will be added when that page is live. Do not treat this paragraph as a filled Form 6252.

What does not work

There is no extra home exclusion that starts at age 55. That rule was repealed. A page about the seniors myth is not live, so this sentence does not link to it.

Moving to another state does not erase federal tax. A 1031 exchange does not apply to a main home you treat as a personal residence. Buying a replacement house is not required for Section 121.

One sale, before and after the exclusion

The example is a single filer. Taxable income before the gain is $80,000. The home was bought for $200,000 on 15 January 2024 and sold for $480,000 on 15 June 2026. The gain is $280,000 and the holding period is long-term.

Without the exclusion, federal tax plus NIIT is $48,080.00. With the 2-of-5 tests met, the exclusion is $250,000.00 and federal tax plus NIIT is $4,500.00. The home sale calculator is the current page. The unpublished rebuild is not linked.

Same sale, with and without the exclusion.
CaseFederal tax plus NIIT
No exclusion$48,080.00
2 of 5 years met$4,500.00

Worked example

$3,082.50

Long-term federal tax on the gain. NIIT is $0.00.

Enter these numbers

Sources

  1. Topic 701, Sale of your home
  2. Publication 523, Selling your home
  3. Topic 409, Capital gains and losses
  4. Publication 544, Sales and other dispositions of assets
  5. About Form 6252, installment sales
  6. Instructions for Form 8824

FAQ

Frequently asked questions

Do I have to buy another house?

No. The Section 121 tests look at ownership and use of the home you sold. They do not require a replacement purchase. A 1031 exchange is a different rule, and it is for investment property, not for a main home you occupy. People mix the two because both can show up in a home sale conversation. Read the test that matches the property you actually sold. This page does not file either form.

What if I lived there less than 2 years?

The full exclusion needs 2 years of ownership and 2 years of use. A shorter stay does not get the full cap on this calculator. A reduced exclusion can apply for a work move, a health move, or an unforeseen event, and only as Publication 523 states it. This calculator does not compute that reduced cap. Describe the short stay in text with a tax professional if the facts are close.

Does age 55 add an exclusion?

No. The one-time over-55 exclusion was repealed in 1997. Topic 701 and Publication 523, as checked for this page, do not describe an exclusion that starts at age 55. Age does not replace the 2-of-5 tests. A later page may explain that myth. It is not live, so this answer does not link to it. Use the ownership and use tests instead.

Can I use a 1031 exchange on my main home?

Not while it is your main home. Section 1031 applies to real property held for investment or for use in a trade or business. A house you live in is the Section 121 case. If you convert a home to a rental and then exchange it, the clocks and the holding purpose both matter. This page does not run those clocks. The 1031 guide states the 45-day and 180-day deadlines.

Do selling costs include a new kitchen?

No. A new kitchen that adds to the home is an improvement. It belongs in basis. A commission you pay to sell is a selling cost. A repair that only restores a broken part, and does not improve the home, is neither. Putting a repair in the improvement field overstates basis and understates gain. Keep the invoice and the description together.

Will the state follow the federal exclusion?

States differ. Some start from federal taxable income and some do not. This page does not paste a 50-state table. The state overview is the place to start, and the calculator can add a state estimate after the federal math. Confirm the state instruction for the year of sale. A federal exclusion of $250,000 is not automatically a state exclusion of the same amount.

Does an installment sale erase the gain?

No. An installment sale spreads the gain across the years you receive principal. It does not erase it. Interest is ordinary income. Form 6252 is the federal form. This site does not have that guide yet, so this answer does not link to a future page. Use the IRS form instructions if you are collecting payments over more than one tax year.

Where do I enter this sale?

Use the real estate calculator that is live today. Set the property type, the years owned, the years used, the buy price, the sell price, and your taxable income. The button on this page says "Enter these numbers" and opens the calculator. It does not fill the fields for you. Compare the result with the before-and-after table above. Then read Publication 523 before you rely on the exclusion.