If you sell a house and buy another, do you pay taxes? Buying the next home has no bearing on the tax owed for selling the old one. Federal law lets most homeowners exclude up to $250,000 of profit from a home sale, or up to $500,000 for married couples filing jointly, and you owe capital gains tax only on profit that exceeds that exclusion or when you don’t qualify for it. What matters is how long you owned and lived in the home, how much profit you made, and whether it was your primary residence.
Figuring Your Actual Profit
The taxable number is not sale price minus purchase price. The IRS works from your adjusted basis, which starts with what you originally paid and adds certain settlement costs from the purchase, such as title insurance and legal fees.
You then add the cost of every capital improvement you made while you owned the property. A capital improvement is something that adds value or extends the home’s useful life: a new roof, a kitchen renovation, a finished basement. Routine maintenance like repainting or replacing a broken faucet doesn’t count. Keep records, because every dollar added to your basis is a dollar subtracted from your taxable gain.
On the selling side, you subtract transaction costs from the gross sale price. Real estate commissions, transfer taxes, and attorney fees paid at closing all reduce what the IRS treats as your proceeds. Your capital gain is what remains after subtracting adjusted basis from that net sale price.
The Primary Residence Exclusion
The main tax break for home sellers is Section 121 of the Internal Revenue Code. It lets you exclude up to $250,000 of capital gain from taxable income if you file as a single taxpayer, or up to $500,000 if you’re married filing jointly. For a couple claiming the higher amount, at least one spouse must meet the ownership requirement, both must meet the use requirement, and neither can have claimed the exclusion on a different 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 must 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 don’t have to be consecutive. You can live somewhere else for a stretch in the middle and still qualify, as long as your total time owning and living there adds up to at least 24 months inside the five-year lookback. You can generally claim this exclusion only once every two years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
On a $400,000 gain, a single filer who qualifies for the full exclusion owes tax on $150,000. A qualifying married couple filing jointly owes nothing, because the whole gain fits inside the $500,000 limit.
Partial Exclusion When You Sell Early
If you sell before meeting the full two-year ownership or use requirement, you may still qualify for a reduced exclusion. The IRS allows a prorated amount when the sale is caused by a job relocation, a health condition, or certain unforeseen circumstances such as divorce, 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 prorated exclusion equals the fraction of the two-year period you completed, multiplied by the full exclusion. A single filer who owned and lived in the home for 12 months before a qualifying job change could exclude up to $125,000. People often leave money here because they assume they get nothing when they miss the full two years.
When Part of the Gain Stays Taxable
The exclusion does not cover gain tied to periods when the home wasn’t your primary residence. If you bought a property, rented it out for three years, moved in for two years, and then sold, the IRS treats the rental period as non-qualified use. The portion of your gain allocable to that period cannot be excluded, even if you otherwise pass the ownership and use tests.2Internal Revenue Service. Publication 523, Selling Your Home
There is an important exception. Any period of non-qualified use that occurs after the last date you used the home as your principal residence doesn’t count against you. If you lived in the home for three years and then rented it out for one year before selling, that final rental year doesn’t reduce your exclusion. The rule targets people who rented first and converted later.
Depreciation is treated separately. If you ever claimed depreciation on the property, common when renting it out or using part of it as a home office, that depreciation can’t be excluded no matter how long you lived there. Gain equal to the depreciation claimed, or that you were entitled to claim, after May 6, 1997 is taxed at a maximum rate of 25% as unrecaptured Section 1250 gain.3Internal Revenue Service. Sales, Trades, Exchanges 34Internal Revenue Service. Topic No. 409, Capital Gains and Losses
Rates on Gain Above the Exclusion
Any gain over the exclusion is taxed as a long-term capital gain, assuming you owned the home for more than one year. The rate depends on your total taxable income:
- 0% for taxable income 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 home sellers with taxable gains fall in the 15% bracket. If you owned the home for one year or less, non-excluded gain is taxed at your ordinary income rate, which can be considerably higher.
Higher earners face an added layer. The 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 is not subject to this surtax, but taxable gain above the exclusion is.5Internal Revenue Service. Topic No. 559, Net Investment Income Tax
Extensions for Military Members and Surviving Spouses
Members of the uniformed services and the Foreign Service can extend the five-year window. If you or your spouse are on qualified official extended duty, you can elect to suspend the five-year lookback for up to 10 years. That lets you be stationed elsewhere for a decade, come back, sell, and still claim the full exclusion, provided you met the two-year tests before leaving.6eCFR. 26 CFR 1.121-5 – Suspension of 5-Year Period for Certain Members of the Uniformed Services and Foreign Service
Surviving spouses also get help. If your spouse dies and you sell within two years of the death, you can claim the full $500,000 exclusion so long as you haven’t remarried by the sale date, neither spouse used the exclusion on another home in the prior two years, and you meet the ownership and use requirements (counting your late spouse’s time toward those requirements). After that two-year window, you can still count your deceased spouse’s ownership and residency time, but the maximum exclusion drops to $250,000.2Internal Revenue Service. Publication 523, Selling Your Home
If the Home You Sold Was a Rental or Second Home
Section 121 covers only your primary residence. A rental, vacation home, or other investment property doesn’t qualify at all. For investment real estate there is a separate tool: the Section 1031 like-kind exchange. You can 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 defers tax; it doesn’t erase it. The original basis carries over to the replacement property, so when you eventually sell that property without another exchange, the accumulated gain comes due. The property must be held for productive use in a trade or business or for investment. Your personal residence doesn’t qualify, and neither does a vacation home used mainly for personal enjoyment.
What Buying the New Home Does for Your Taxes
Purchasing a replacement home doesn’t reduce tax on the old sale, but it opens up ongoing deductions. The purchase price becomes the new property’s starting basis, which you’ll adjust over time with capital improvements, just as you did before.
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, the deductible debt is capped at $750,000, or $375,000 if married filing separately. Mortgages originated on or before that date can still support interest deductions on up to $1,000,000 of debt.8Internal Revenue Service. 2025 Instructions for Schedule A (Form 1040)
Property 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, or $20,200 for married filing separately. The cap phases down for higher earners but doesn’t fall below $10,000, or $5,000 for married filing separately.8Internal Revenue Service. 2025 Instructions for Schedule A (Form 1040)
Points and Closing Costs
Most closing costs on the purchase, such as appraisal fees, inspection fees, and title search charges, aren’t deductible in the year you buy. They get added to the new home’s basis. Mortgage origination points that represent prepaid interest, rather than service charges, may be deductible in the year paid if you meet certain conditions, including paying the points from your own funds at closing on a primary residence purchase.
Reporting the Sale
The closing agent, title company, or attorney handling the sale is required to file Form 1099-S with the IRS reporting the gross proceeds.9Internal Revenue Service. Instructions for Form 1099-S (04/2025) Whether you also need to report the sale on your own return depends on the circumstances.
You do not need to report the sale if all three of these are true: your gain is fully excludable under Section 121, you did not receive a Form 1099-S, and you don’t wish to voluntarily report the gain. If any of those isn’t met, you must report.2Internal Revenue Service. Publication 523, Selling Your Home
Most sellers do receive a Form 1099-S, so most sellers file. When reporting is required, you detail the transaction on Form 8949, listing the acquisition date, sale date, gross proceeds, and adjusted basis. If the gain qualifies for exclusion, the excluded amount goes in as an adjustment on that form. Totals carry to Schedule D of Form 1040.10Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets
Skipping this step after receiving a 1099-S is a common trigger for IRS correspondence. The agency gets the 1099-S directly from the closing agent and sees gross proceeds that look like unreported income. Filing Form 8949 and Schedule D closes the loop and shows the gain was properly excluded or taxed.