If You Sell a House and Buy Another, Do You Pay Taxes?

If you sell a house and buy another, do you pay taxes? The purchase of the next home has no effect on the tax treatment of the sale. What matters is how much profit you made on the house you sold, whether it was your primary residence, and how long you owned and lived in it. Federal law lets most homeowners exclude up to $250,000 of gain from a home sale, or up to $500,000 for married couples filing jointly. You owe capital gains tax only on profit above that exclusion, or when you don’t qualify for it.

Figuring Your Actual Profit

Your taxable gain is not the difference between what you paid and what you sold for. The IRS starts with your “adjusted basis,” which is your original purchase price plus certain buying costs like title insurance and legal fees, plus every capital improvement you made while you owned the home. A new roof counts. A kitchen renovation counts. Repainting and swapping out a broken faucet do not. Keep the receipts, because every dollar you add to basis is a dollar removed from your taxable gain.

From the sale side, subtract transaction costs: real estate commissions, transfer taxes, and closing attorney fees. What’s left is your net sale price. Subtract adjusted basis from that number and you have your capital gain. A net sale price of $700,000 against an adjusted basis of $300,000 gives you a $400,000 gain.

The Primary Residence Exclusion

Section 121 of the Internal Revenue Code lets you exclude up to $250,000 of gain if you file single, or up to $500,000 if married filing jointly. For the joint amount, at least one spouse must meet the ownership requirement, both spouses must meet the use requirement, and neither spouse can have claimed the exclusion on another home sale within the prior two years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

To qualify, you need to pass two tests during the five-year period ending on the date of sale:

  • Ownership test: you owned the home for at least two of those five years.
  • Use test: you lived in the home as your primary residence for at least two of those five years.

The two years do not need to be consecutive. You could live somewhere else for a stretch and still qualify, as long as your combined time owning and living there hits 24 months inside that five-year window. You can generally claim the exclusion only once every two years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Apply this to a $400,000 gain. A single filer who qualifies for the full exclusion would owe tax on $150,000. A qualifying married couple filing jointly would owe nothing on the sale, because the entire gain falls within the $500,000 limit.

Partial Exclusion for Selling Early

Selling before you hit two years doesn’t automatically mean you get nothing. The IRS allows a prorated exclusion when the sale happens because of a job relocation, a health condition, or certain unforeseen circumstances such as divorce, a natural disaster, or multiple births from the same pregnancy.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

The reduced amount equals the fraction of the two-year period you actually completed, applied to the full exclusion. A single filer who owned and lived in a home for 12 months before a qualifying job change could exclude up to $125,000. Sellers often overlook this because they assume the two-year rule is all or nothing.

When Part of the Gain Can’t Be Excluded

Two situations pull gain out from under the exclusion even when you otherwise qualify.

The first is “non-qualified use.” Time when the home wasn’t your primary residence, such as a stretch when you rented it out before moving in, is treated as non-qualified. The portion of the gain attributable to that period cannot be excluded.2Internal Revenue Service. Publication 523, Selling Your Home There is an exception worth knowing: non-qualified use that occurs after the last date you used the home as your principal residence does not count against you. Living there first and renting it out on the way out is treated better than renting first and converting to a residence later.

The second is depreciation recapture. If you ever claimed depreciation, common with rental use or a home office deduction, the amount of gain equal to the depreciation you took (or could have taken) after May 6, 1997 is taxed at a maximum rate of 25% as unrecaptured Section 1250 gain, regardless of how long you lived in the home afterward.3Internal Revenue Service. Sales, Trades, Exchanges 34Internal Revenue Service. Topic No. 409, Capital Gains and Losses

What Tax Rate Applies to the Taxable Portion

Gain above the exclusion is taxed as a long-term capital gain if you owned the home for more than one year. The rate depends on your total taxable income:

  • 0% if taxable income is up to $49,450 (single) or $98,900 (married filing jointly).
  • 15% from $49,451 to $545,500 (single) or $98,901 to $613,700 (married filing jointly).
  • 20% above $545,500 (single) or $613,700 (married filing jointly).

Most sellers with a taxable gain land in the 15% bracket. Owning the home for one year or less pushes any non-excluded gain into your ordinary income tax rate, which is typically higher.

An added 3.8% Net Investment Income Tax applies when modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). Gain excluded under Section 121 isn’t subject to the surtax, but any taxable gain above the exclusion is.5Internal Revenue Service. Topic No. 559, Net Investment Income Tax

Military Members and Surviving Spouses

Members of the uniformed services and the Foreign Service can elect to suspend the five-year lookback for up to 10 years while on qualified official extended duty. A decade-long assignment elsewhere doesn’t cost you the exclusion, as long as you met the two-year ownership and use tests before you left.6eCFR. 26 CFR 1.121-5 – Suspension of 5-Year Period for Certain Members of the Uniformed Services and Foreign Service

A surviving spouse who sells within two years of the other spouse’s death can claim the full $500,000 exclusion, provided they haven’t remarried by the sale date, neither spouse used the exclusion on another home in the prior two years, and the ownership and use requirements are satisfied (counting the deceased spouse’s time). After the two-year window, you can still count your late spouse’s time toward the tests, but the maximum exclusion drops to $250,000.2Internal Revenue Service. Publication 523, Selling Your Home

What If the Property Wasn’t Your Primary Residence

Section 121 covers primary residences only. A rental, vacation home, or investment property doesn’t qualify for the exclusion at all. For investment real estate, a different tool exists: a Section 1031 like-kind exchange lets you defer the capital gains tax by reinvesting the proceeds into another investment property of equal or greater value, following strict identification and timing rules.7Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use in a Trade or Business or for Investment

A 1031 exchange is deferral, not forgiveness. Your original basis carries over into the replacement, and when you eventually sell without doing another exchange, the accumulated gain comes due. A personal residence does not qualify, and a vacation home used mainly for personal enjoyment does not qualify either.

What Buying the Next Home Does for You

Buying doesn’t cancel tax on selling, but it opens up ongoing deductions. The purchase price becomes your new basis, and you’ll adjust it upward over time with capital improvements, the same way you did on the old home.

Mortgage Interest

If you itemize on Schedule A, you can deduct interest on mortgage debt used to buy, build, or substantially improve a qualified residence. For loans taken out after December 15, 2017, deductible debt is capped at $750,000, or $375,000 if married filing separately. Older mortgages originated on or before that date remain under the previous $1,000,000 cap.8Internal Revenue Service. 2025 Instructions for Schedule A (Form 1040)

State and Local Taxes

Property taxes on the new home are deductible as part of the state and local tax (SALT) deduction, which also covers state income or sales taxes. For the 2026 tax year, the SALT cap is $40,400 ($20,200 if married filing separately). The cap phases down at higher incomes but cannot fall below $10,000 ($5,000 for married filing separately).8Internal Revenue Service. 2025 Instructions for Schedule A (Form 1040)

Points and Closing Costs

Most closing costs on your purchase (appraisal, inspection, title search) aren’t deductible in the year you buy. They get added to basis. Mortgage points that represent prepaid interest rather than service charges are a separate matter: if you meet the conditions, including paying them out of your own funds at closing on a primary residence purchase, they may be deductible in the year paid.

Reporting the Sale

The closing agent, title company, or attorney handling the sale is required to file Form 1099-S with the IRS, reporting gross proceeds.9Internal Revenue Service. Instructions for Form 1099-S (04/2025) Whether you also report on your own return depends on the sale.

You can skip reporting only if all three of these are true: the gain is fully excludable under Section 121, you did not receive a Form 1099-S, and you don’t want to voluntarily report the gain as taxable. If any of those isn’t true, you have to report.2Internal Revenue Service. Publication 523, Selling Your Home

In practice most sellers do receive a 1099-S, so most sellers report. You detail the transaction on Form 8949 with the acquisition date, sale date, gross proceeds, and adjusted basis. If the gain qualifies for exclusion, you enter the excluded amount as an adjustment. Totals flow to Schedule D of your Form 1040.10Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets

Ignoring this step after a 1099-S was issued is a common trigger for IRS correspondence. The agency sees gross proceeds reported by the closing agent and reads it as unreported income. Filing Form 8949 and Schedule D closes the loop and shows the gain was properly excluded or taxed.