The tax implications of selling a house and buying another are simpler than most sellers expect, because the two transactions are treated separately. When you sell, you may exclude up to $250,000 of gain from federal income tax, or up to $500,000 if you’re married filing jointly, as long as you owned and lived in the home for at least two of the last five years.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence Buying a replacement home does not reduce, defer, or roll over any tax you owe on gain above those limits. That idea is a holdover from a law repealed in 1997. What your new home does bring is a fresh set of deductions going forward for mortgage interest, points, and property taxes.
Figuring the Gain on the Sale
Your taxable gain isn’t the sale price minus what you paid. It’s the amount you net at closing minus your adjusted basis in the property.
Your adjusted basis starts with the original purchase price plus certain settlement costs you paid when you bought: title insurance, recording fees, legal fees. To that you add capital improvements made over the years. A new roof, a kitchen remodel, a finished basement, a new HVAC system. Routine repairs like repainting or fixing a faucet do not count, and the IRS expects receipts for what does. Anything that reduced your investment comes off basis, including depreciation claimed for a home office or rental use, and any deducted casualty losses.
On the sale side, subtract your selling expenses from the sale price: real estate commissions, transfer taxes, attorney fees. What’s left is your amount realized. Amount realized minus adjusted basis equals your gain.
A quick example. You bought for $400,000, put $50,000 into capital improvements, and never claimed depreciation. Your adjusted basis is $450,000. You sell for $800,000 and pay $48,000 in commissions and closing costs, leaving $752,000 realized. Your preliminary gain is $302,000. Whether any of that is taxable depends on the exclusion.
The Section 121 Exclusion
Section 121 is the main tax break for home sellers. It exempts up to $250,000 of gain for single filers and heads of household, and up to $500,000 for married couples filing jointly. For most home sales, it wipes out the tax bill entirely.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence
To claim the full exclusion, you need to pass two tests during the five-year window ending on the sale date. You must have owned the home for at least two years total, and you must have lived in it as your primary residence for at least two years total. The two years don’t have to be consecutive under either test.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence
For the $500,000 married amount, only one spouse needs to meet the ownership test, but both must meet the use test, and neither spouse can have used the exclusion on another sale within the past two years.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence This trips up some couples after a remarriage where one spouse recently sold a prior home. The exclusion itself is available only once every two years.
Partial Exclusion if You Sell Early
If you have to sell before hitting the two-year marks, a partial exclusion is still on the table when the reason for selling is a qualifying job move, a health issue, or an unforeseen circumstance.2Internal Revenue Service. Publication 523, Selling Your Home
For a job-related move, your new workplace generally must be at least 50 miles farther from the home you sold than your previous workplace was. If you had no previous job, the new workplace must be at least 50 miles from the home.2Internal Revenue Service. Publication 523, Selling Your Home
Unforeseen circumstances the IRS recognizes include:
- Death of the homeowner, spouse, co-owner, or a household member
- Divorce or legal separation, including a court order to make support payments
- Twins or higher-order multiples from a single pregnancy
- Destruction of the home by disaster, or condemnation
- Job loss that makes you eligible for unemployment or unable to pay basic living expenses
The partial exclusion equals the full $250,000 or $500,000 cap multiplied by the fraction of the two-year requirement you actually met. Fifteen months of use out of the required 24 gives a single filer 15/24 of $250,000, or about $156,250.2Internal Revenue Service. Publication 523, Selling Your Home
What Still Gets Taxed Even if You Qualify
Passing the ownership and use tests doesn’t automatically shield every dollar. Two rules can carve out taxable slices of the gain.
The first is non-qualified use. Any period after January 1, 2009 during which the home was not your primary residence creates a taxable portion of the gain. If you rented the property out for a stretch and later moved in, that rental period counts. The taxable share equals the non-qualified use time divided by your total ownership period.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence Ten years of ownership with two post-2008 rental years means 20% of the gain is taxable regardless of Section 121.
The second is depreciation recapture. Any depreciation you deducted after May 6, 1997 for business or rental use of the home cannot be excluded.3Internal Revenue Service. Sales, Trades, Exchanges 3 That portion of the gain is taxed at a maximum rate of 25%. If you deducted $30,000 in depreciation while renting out a room or the whole home, $30,000 of gain comes out from under the exclusion and is taxed at up to 25% before anything else is calculated.
Whatever gain is left after those rules gets taxed as a long-term capital gain if you owned the home more than a year. For 2026, long-term rates are 0%, 15%, or 20% depending on your total taxable income for the year, with the 0% bracket ending at $49,450 for single filers and $98,900 for joint filers, and the 20% rate kicking in above $545,500 single or $613,700 joint. A large gain stacks on top of your other income, which can push part of it into a higher bracket. Owning the home a year or less makes the gain short-term and taxes it at your ordinary rates, which reach 37%.
Ripple Effects: NIIT and Medicare
A large taxable gain can trigger costs beyond the capital gains tax itself.
The Net Investment Income Tax adds 3.8% on top of the capital gains rate once your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).4Internal Revenue Service. Topic No. 559, Net Investment Income Tax Gain you exclude under Section 121 doesn’t count toward the threshold; taxable gain above the exclusion does. On $150,000 of taxable gain for a couple already at $200,000 of income, the NIIT alone adds $5,700.
If you’re on Medicare or near it, a big gain can also raise your Part B and Part D premiums through the Income-Related Monthly Adjustment Amount. Medicare looks at your return from two years earlier, so a 2026 sale would affect 2028 premiums. For 2026, a joint filer with income above $218,000 begins paying surcharges, and at the highest income levels premiums can more than triple.5CMS. 2026 Medicare Parts A and B Premiums and Deductibles A one-year spike in income can cost thousands in extra premiums for a full year.
A Loss on the Sale Is Not Deductible
If you sell your primary residence for less than your adjusted basis, you cannot deduct the loss. The IRS treats a personal residence as personal-use property, and losses on personal-use property never offset other income or gains.6Internal Revenue Service. Topic No. 409, Capital Gains and Losses Investment or rental property is different: a loss on a rental is deductible and can offset other capital gains, with up to $3,000 of net loss usable against ordinary income and any remainder carried forward.7Internal Revenue Service. 2025 Instructions for Schedule D (Form 1040)
A 1031 Exchange Doesn’t Apply Here
Sellers sometimes ask whether rolling the proceeds into the next home under Section 1031 defers the tax. It does not. Section 1031 is limited to property held for business or investment use. A home you live in doesn’t qualify, and neither does a vacation home.8Internal Revenue Service. Like-Kind Exchanges Under IRC Section 1031 The tax on your residence sale is settled on that sale alone.
What Buying the Next Home Does For You
The new purchase creates ongoing deductions rather than reducing tax on the sale.
Mortgage Interest
If you itemize, you can deduct interest on up to $750,000 of mortgage debt used to buy, build, or substantially improve your home ($375,000 if married filing separately).9Internal Revenue Service. Publication 936 (2025), Home Mortgage Interest Deduction The limit covers combined debt on your primary and one second home. A mortgage that predates December 16, 2017 may qualify for a higher $1,000,000 limit on that older debt.
Interest on a home equity loan or HELOC is deductible only when you used the borrowed money to substantially improve the home securing the loan. Using it to pay off credit cards or buy a car doesn’t generate deductible interest.9Internal Revenue Service. Publication 936 (2025), Home Mortgage Interest Deduction
Points at Closing
Points paid to obtain the mortgage on a new primary residence are generally deductible in full in the year paid. If the seller pays points on your behalf, you can still deduct them, but you must reduce your basis in the new home by the same amount.9Internal Revenue Service. Publication 936 (2025), Home Mortgage Interest Deduction Points on a refinance must be spread over the life of the new loan.
Property Taxes and the SALT Cap
Property taxes on your new home are deductible as part of the State and Local Tax deduction. For 2026, the SALT cap is $40,400 ($20,200 if married filing separately), and that cap covers your state income or sales taxes plus property taxes combined. If your modified adjusted gross income exceeds $505,000 ($252,500 married filing separately), the cap begins phasing down but cannot drop below $10,000. These figures rise 1% a year through 2029, after which the cap reverts to $10,000.
Reporting the Sale and Paying What You Owe
Your title company or settlement agent will issue Form 1099-S showing the gross proceeds. If your entire gain is excludable under Section 121 and you meet the ownership and use tests, you generally don’t need to report the sale at all. To avoid receiving a 1099-S in the first place, you can give the settlement agent a written certification under penalties of perjury that the home was your principal residence and the full gain is excludable.
Report the sale whenever any portion of the gain is taxable. That covers gain above the $250,000 or $500,000 limit, non-qualified use, and depreciation recapture. Use Form 8949 to detail sale price, adjusted basis, and gain, with the totals flowing to Schedule D. Depreciation recapture is reported on Schedule D at the 25% maximum rate.3Internal Revenue Service. Sales, Trades, Exchanges 3
Watch the withholding side too. If your regular paycheck withholding won’t cover the extra tax from the sale, you can face an underpayment penalty. The IRS expects at least 90% of your current year’s tax liability, or 100% of your prior year’s (110% if your prior-year AGI exceeded $150,000), paid through withholding or quarterly estimates.10Internal Revenue Service. Underpayment of Estimated Tax by Individuals Penalty After a taxable sale, run the numbers and send an estimated payment with Form 1040-ES before the next quarterly deadline.