Do I have to pay capital gains if I sell my house and buy another?

Published by Drafted with AI; every statement checked against its source on November 3, 2026

You do not avoid capital gains tax just because you sell your house and buy another. For a main home, the current federal rule is the home sale exclusion. If you qualify, the IRS says you may exclude up to $250,000 of gain, or up to $500,000 if married filing jointly. The old rule that tied tax deferral to buying a replacement home was repealed for most sales after May 6, 1997.

Key facts

  • The main home exclusion may shelter up to $250,000 of gain, or up to $500,000 on a joint return with a spouse.
  • In general, the IRS ownership and use tests look at 24 months during the 5 year period ending on the sale date.
  • The old replacement home rollover rule was repealed for most principal residence sales after May 6, 1997.
  • If you receive Form 1099-S, the IRS says you must report the home sale even if the gain is excludable.
  • A 1031 exchange is for real property held for business or investment, not a main home.

Selling in Indiana, Ohio, Wisconsin, Tennessee or Georgia? Get a written cash offer in 24 hours, no obligation.

Get my cash offer

Buying another house is not the current federal test

The common reinvestment idea comes from an old rule. Before the 1997 change, former section 1034 looked at buying a new residence within a replacement period. That replacement period was generally 2 years before or after the sale.

The Department of the Treasury and the IRS say TRA 1997 amended section 121 and repealed section 1034 for most sales and exchanges of principal residences after May 6, 1997. That is why the old idea of having a set replacement period does not match the current main home exclusion.

The current rule looks at the home you sold, how you used it, how long you owned it, and whether your gain fits within the exclusion. Buying another home is not part of the ownership and use tests described in IRS Topic no. 701.

Common beliefCurrent federal rule
You must reinvest the money in another house.Buying another home is not part of the current section 121 ownership and use tests.
You have a set replacement period under the current main home rule.The old section 1034 replacement period was generally 2 years before or after sale, and that rule was repealed for most principal residence sales after May 6, 1997.
A 1031 exchange fixes a main home sale.Publication 523 says a main home is not available for exchange because section 1031 is for real property held for business or investment.

How the home sale exclusion works

IRS Publication 523 says that if you meet certain conditions, you may exclude the first $250,000 of gain from the sale of your home from your income. It also says the exclusion is increased to $500,000 for a married couple filing jointly.

The exclusion applies only to the sale of a principal residence, meaning your main home. Publication 523 says an individual has only one main home at a time.

If your gain is more than the exclusion amount, some gain may be taxable. If your sale does not qualify for a full or partial exclusion, your entire gain is taxable. If you do not have a gain, Publication 523 says you owe no tax on the sale.

The ownership and use tests

IRS Topic no. 701 says that, in general, you must meet both the ownership test and the use test to qualify for the home sale exclusion. If you file jointly with your spouse, either spouse must meet the ownership test, and both spouses must meet the use test individually.

You meet the ownership test if you or your spouse owned the home for at least 24 months out of the last 5 years leading up to the sale date. You meet the use test if you and your spouse used the home as a residence for at least 24 months of the previous 5 years.

The ownership and use periods do not have to be the same 2 year periods. Topic no. 701 says both tests must still be met during the 5 year period ending on the sale date.

The IRS also says you are generally not eligible for the exclusion if you excluded gain from the sale of another home during the 2 years before the sale. If timing is your main concern, this related page on how long to own a house before selling may help you think through the sale.

When the gain can still be taxable

The home sale exclusion does not mean every home sale is free from federal tax. It only protects the amount of gain that fits within the exclusion and the IRS eligibility rules.

A taxable gain can still happen if the gain is larger than the exclusion, if the sale does not qualify for any exclusion, or if only a partial exclusion applies. Publication 523 also gives a separate rule for depreciation tied to business use or rental use after May 6, 1997.

SituationWhat the IRS source says
Your gain is more than the exclusion amount.Some of your gain may be taxable.
Your home sale does not qualify for any full or partial exclusion.Your entire gain is taxable.
You do not have a gain.You owe no tax on the sale.
You were entitled to depreciation deductions because of business use or rental use after May 6, 1997.You cannot exclude the part of the gain equal to depreciation allowed or allowable for those periods.

Form 1099-S and reporting the sale

Form 1099-S is called Proceeds From Real Estate Transactions. The IRS instructions say to file Form 1099-S to report the sale or exchange of real estate. The same instructions say a main home sale may be reportable even when the seller may exclude the gain under section 121.

If you receive Form 1099-S, IRS Topic no. 701 says you must report the sale of the home even if the gain is excludable. It also says you must report the sale if you cannot exclude all of your capital gain from income.

The Form 1099-S instructions include an exception for a sale or exchange of a residence for $250,000 or less if an acceptable written assurance says the residence is the seller's principal residence and the full gain is excludable. If that certification says the seller is married, the instructions say to substitute $500,000 for $250,000.

For joint sellers, the instructions say a certification is needed from each seller, or Form 1099-S must be filed for any seller who does not make the certification. The instructions also say the certification may be obtained on or before January 31 of the year after the sale year. If the certification is not obtained, the instructions say Form 1099-S must be filed and furnished.

Why a 1031 exchange is different

A 1031 exchange is not the same as the main home sale exclusion. Publication 523 says a main home is not available for exchange because the exchange must be between like kind real property held for productive use in a trade or business or for investment.

Publication 523 also says real property held primarily for sale is not eligible for deferral of gain under section 1031. It says you cannot convert the replacement property to a main home immediately after the exchange.

So the usual main home question is section 121, not section 1031. If you are deciding between selling and becoming a landlord, this page on should I sell or rent my house covers that separate decision.

A simple way to read the rule before you sell

Start with the section 121 questions before thinking about the next home purchase. This page is general information about IRS rules and does not decide any individual tax return.

The next home purchase does not replace the IRS ownership, use, gain, depreciation, and reporting questions. If you are comparing taxes with other sale costs, this related guide explains how much it costs to sell a house.

  • Was the house your main home?
  • Did you meet the ownership and use tests during the 5 year period ending on the sale date?
  • Did you exclude gain from another home during the 2 years before this sale?
  • Is any gain over the exclusion amount?
  • Did you receive Form 1099-S?

Frequently asked questions

Do I have a set number of days to buy another house after I sell?

The current main home exclusion is not based on a replacement home purchase deadline. The old rule used a replacement period that was generally 2 years before or after the sale, but that rule was repealed for most principal residence sales after May 6, 1997.

Is the $250,000 or $500,000 exclusion automatic?

No. IRS Topic no. 701 says you generally must meet both the ownership test and the use test. It also says you are generally not eligible if you excluded gain from another home during the 2 years before the sale.

What happens if my gain is more than the exclusion?

Publication 523 says that if your gain is more than the exclusion amount, some of your gain may be taxable. It also says if your sale does not qualify for any full or partial exclusion, the entire gain is taxable.

Do married couples get a $500,000 home sale exclusion?

IRS Topic no. 701 says you may qualify to exclude up to $500,000 of gain if you file a joint return with your spouse. For joint filers, either spouse must meet the ownership test, and both spouses must meet the use test individually.

Do I have to report the sale if all of my gain is excluded?

If you receive Form 1099-S, Topic no. 701 says you must report the sale even if the gain is excludable. It also says you must report the sale if you cannot exclude all of your capital gain from income.

Can I use a 1031 exchange for my primary residence?

Publication 523 says a main home is not available for exchange because section 1031 is for real property held for productive use in a trade or business or for investment. It also says you cannot convert the replacement property to a main home immediately after the exchange.

What if I rented out part of the house or used it for business?

Publication 523 says that if you were entitled to depreciation deductions because you used your home for business purposes or as rental property, you cannot exclude the part of the gain equal to depreciation allowed or allowable for periods after May 6, 1997. That rule is separate from whether you buy another home.

Sources

Checked against each source on November 3, 2026. This page is general information, not legal or tax advice.

  1. Publication 523, Selling Your Home (Internal Revenue Service)
  2. Topic no. 701, Sale of your home (Internal Revenue Service)
  3. Instructions for Form 1099-S (Internal Revenue Service)
  4. Exclusion of Gain From Sale or Exchange of a Principal Residence (Department of the Treasury, Internal Revenue Service)

Related seller questions

State rules for sellers