No, you don't automatically owe capital gains tax when you sell your house and buy another—but the reason isn't the purchase. The IRS generally lets you exclude up to $250,000 of gain if you're single and up to $500,000 if you're married filing jointly, provided you owned and lived in the home as your primary residence for at least two of the five years before the sale. Buying another house doesn't create a tax deferral; the exclusion, a partial exclusion, or the "unforeseen circumstances" rules do the work instead.

The Section 121 Exclusion Is Not a Rollover—Buying Another House Changes Nothing

The old "rollover" rule that let people defer gain by buying a replacement home disappeared with the Taxpayer Relief Act of 1997. What replaced it, Section 121 of the Internal Revenue Code, is far more forgiving but functions differently: it doesn't defer tax, it cancels up to $250,000 or $500,000 of gain outright, and your next purchase plays no part in that calculation. You could sell, rent forever, and still keep the exclusion.

Understanding that distinction matters because so many sellers assume a purchase requirement exists. It doesn't. The IRS only asks whether the home was your primary residence, how long you owned and lived in it, and whether you used the exclusion on another home sale within the prior two years. The reinvestment question is a ghost left over from pre-1997 rules.

Three elements decide eligibility. The ownership test requires you to have owned the home for at least two years during the five-year window ending on the sale date. The use test requires the home to be your primary residence for at least two of those same five years. The frequency test says you can't have excluded gain from another home sale in the two-year period before this one.

Miss any one of those and the full exclusion evaporates. Hit all three and the gain up to the statutory cap simply never shows up on your return. Your accountant reports the sale on Form 8949 and Schedule D, but the excluded amount is a footnote, not a tax liability.

How the $250,000 and $500,000 Caps Actually Work in 2026

The cap is $250,000 per person, or $500,000 for a married couple filing jointly, under Internal Revenue Service Publication 523. That figure hasn't changed since 1997, no inflation adjustment applies, and it stays $500,000 for joint filers in 2026. Only the gain above the cap gets taxed, and that excess is taxed at long-term capital gains rates if you held the home more than one year.

Filing Status Maximum Exclusion Typical Gain Tax Rate on Excess Reporting Form
Single $250,000 0%, 15%, or 20% depending on taxable income Form 8949 + Schedule D
Married filing jointly (both qualify) $500,000 Same long-term rates Form 8949 + Schedule D
Married filing separately (each meets tests) $250,000 each Same long-term rates Form 8949 + Schedule D
Married filing jointly (one spouse qualifies) $250,000 Same long-term rates Form 8949 + Schedule D

The bifurcated $250,000 figure for a joint return where only one spouse meets the tests catches people off guard. If you bought the house together but only one of you lived there for two of the five years, the couple gets $250,000, not $500,000. Divorce, a spouse working in another city, or a rental period can all trigger this.

Here's a worked example. Suppose a couple files jointly, both meet the tests, and sells for $950,000. They originally paid $350,000 and spent $60,000 on a kitchen remodel and roof replacement, making the adjusted basis $410,000. Gain is $540,000. The $500,000 exclusion covers all but $40,000, and that $40,000 is taxed at their long-term capital gains rate—likely 15% if their taxable income sits between roughly $96,700 and $600,050 for joint filers in 2026, giving $6,000 of federal tax. Confirm the exact bracket on the IRS site for your filing year.

The Two-of-Five Test Has Three Counting Traps Most Sellers Miss

The two-year clock isn't measured in calendar years. The IRS counts 24 full months of ownership and 730 days of use within the five-year window ending on the closing date. Short months count proportionally, and the closing date—not the contract date—is the reference point. That one-day difference can flip your eligibility if you're selling near the threshold.

Temporary absences don't always break the use test. IRS Publication 523 lists exceptions for time spent in a care facility, military service, or on qualified official extended duty. If you moved into assisted living after 20 years in the house, the time in the facility can count as time lived in the home, provided the absence began during the five-year window and the home remained your residence.

Rental periods after you moved out count against the use test unless they fit inside the five-year lookback and you still lived there two of those years. A common mistake is treating rental income as disqualifying. It isn't automatically. If you rented the house for 18 months after moving out but had lived there three years before that, you still pass the two-of-five test as long as you sell within the five-year window.

A second home or vacation property fails the test entirely, even if you've owned it for a decade. The IRS looks for your principal residence, and only one property can claim that status per year. Documented evidence—driver's license, voter registration, utility bills, tax returns—supports the claim if audited. Keep it for three years after the sale at minimum.

Partial Exclusions When You Sell Before Two Years or Face a Life Event

Selling inside two years doesn't automatically kill the exclusion. IRS regulations allow a partial exclusion calculated as a fraction of the maximum: (months of qualifying use ÷ 24) × $250,000 or $500,000. Sell after 12 months of qualifying use as a single filer and you get $125,000 of exclusion instead of zero.

The partial exclusion only applies when the sale is due to a qualifying reason—a change in employment, a change in health, or an "unforeseen circumstance." The IRS names specific unforeseen events in Publication 523: death of a spouse, divorce or legal separation, multiple births from the same pregnancy, becoming eligible for unemployment compensation, a change in employment that makes the home unreachable, or a natural disaster that damages the residence.

Job-change qualification has a distance rule and a dollar rule. You qualify if the new workplace is at least 50 miles farther from the old home than the previous workplace was. Self-employed people use a separate test keyed to the percentage of business use of the home. The distance is measured by the shortest commonly traveled route, not as the crow flies, and the IRS auditor's map may not match yours.

Health-related qualifications are broader than most people realize. A physician's recommendation to move for treatment of a specific illness counts, as does a move to care for a family member with a diagnosed condition. The recommendation should be in writing and tied to the person needing care. Keep the documentation—auditors ask for it.

What Happens If You Don't Pass the Tests, and How a 1031 Exchange Fits

Fail the two-of-five test without a qualifying partial exclusion and your gain becomes fully taxable as a long-term capital gain, assuming you held the home more than one year. That's not unusual—house flippers and short-term owners face it routinely. The tax rate depends on your taxable income, typically 15% or 20% for high earners, plus the 3.8% net investment income tax if your modified adjusted gross income exceeds $200,000 single or $250,000 joint under IRS rules for the NIIT.

A 1031 like-kind exchange does not apply to a primary residence. That section of the code covers business and investment property only. You could theoretically convert a former primary residence into a rental, wait long enough to establish investment intent, and then run a 1031 exchange into another rental—but the primary residence years muddy the basis and trigger depreciation recapture on the rental portion. Tax lawyers routinely warn that the conversion must be genuine, not a paper shuffle.

The partial exclusion calculation looks like this. A single filer sells 10 months after purchase because of a job relocation that qualifies. Ten months ÷ 24 months = 0.4167 × $250,000 = $104,167 of exclusion. If the gain was $60,000, it's fully excluded. If the gain was $150,000, $45,833 is taxable at long-term rates. Confirm your specific reason qualifies against Publication 523 before relying on this math.

State tax runs parallel. California, New York, and most other states conform to the federal exclusion but with their own forms. A handful of states impose a nonresident withholding at closing—California's is 3.33% of gross sale price under Franchise Tax Board rules, refundable if your actual liability is lower. That withholding can feel like a tax even when you owe nothing federally.

What the Purchase of Another House Actually Does to Your Tax Picture

Buying a replacement home doesn't affect the exclusion, but it does affect what happens later. The new home's cost basis is simply what you paid for it, because the excluded gain disappears permanently. If you sold a $900,000 home with a $500,000 gain fully excluded and bought another $900,000 home, your new basis is $900,000 and your future gain is measured from that purchase price. In that sense, the exclusion shrinks the tax-free runway on your next sale.

Cost basis adds up. Purchase price plus closing costs, title insurance, recording fees, and certain legal fees. Then add capital improvements over the years: a new roof, an addition, a replaced HVAC system. Routine maintenance doesn't count. Keep receipts. The IRS statute of limitations for auditing a return is three years, but if you underreport income by more than 25%, the window extends to six years—so records of what you spent on the house should be kept for at least seven years after the sale.

The step-up in basis at death changes the calculus for inherited homes. Under current federal law, an heir's basis resets to the fair market value at the date of death, wiping out a lifetime of gain that would have been taxable to the original owner. That's why some older homeowners hold rather than sell. It's a personal decision with estate-planning implications, not tax advice I can render.

One timing wrinkle matters when both a sale and a purchase happen in the same year. The sale is reported on the return for the year of closing. If you buy the replacement home in the following January, it has no bearing on which year the sale reports. Your CPA will need the closing statement (Form 1099-S) from the sale, whether or not you bought another property.

Married Couples, Divorce, and Death: Where the $500,000 Cap Divorces Reality

Joint filers get $500,000 only if both spouses meet the ownership and use tests for the same home. If you married a year ago and your spouse moved into your long-held house, they don't yet have two years of use, so you're capped at $250,000. That cap raises to $500,000 after their two-year anniversary of living there, assuming you're still within the five-year window.

Divorce complicates the picture. A spouse who moves out can still count the home as their residence if ownership and use tests pass, or under IRC Section 121(d)(3), a spouse who receives the home in a divorce can tack on the other spouse's ownership and use time for the two-of-five test. That means a person can qualify for the full exclusion even if they only lived in the home briefly after the divorce was finalized.

Death of a spouse triggers another provision. A surviving spouse who sells within two years of the death, and who hasn't remarried, can use the full $500,000 exclusion under IRC Section 121(b)(4), provided the couple met the tests before the death and neither spouse used the exclusion on another sale in the prior two years. That's a meaningful exception—$250,000 of tax shield available for two years, and it doesn't require the survivor to keep living in the house for the full period.

Widowed sellers sometimes let the two-year window close while grieving, then face the smaller $250,000 cap. If you're in that position, the timing is worth marking on a calendar. The same goes for a divorce where one spouse keeps the house and later sells—document the transfer date so the ownership clock is defensible.

Recordkeeping That Survives an IRS Audit

The exclusion claim isn't automatic on your return. Form 8949, Part II, with box F checked (for "exclusion of gain on sale of home"), reports the sale and the excluded amount. Supporting documentation stays with your records. The IRS may ask for proof of use and ownership if your return is flagged or if the sale falls into a random audit pool.

Keep six categories of documents. First, the original purchase closing statement (HUD-1 or Closing Disclosure). Second, all capital improvement receipts with dates and amounts. Third, records showing residency—driver's license history, utility bills, voter registration, tax returns filed from the address. Fourth, records proving use during the two-year window before sale. Fifth, the sale's closing statement and 1099-S. Sixth, any documentation for a partial exclusion—physician letters, employment offer letters, distance verification.

The three-year window after filing starts the clock on when you can safely discard these records. Keep them seven years if there's any chance the gain was underreported by 25% or more, since the audit window stretches to six years in that case. A simple filing folder or a cloud-based document vault works; what matters is retention, not format.

State documentation requirements often mirror federal ones but may demand more. California's Franchise Tax Board, for example, asks for documentation on the use test when claiming the exclusion on a nonresident return. New York's Department of Taxation and Finance requires the sale reported on Form IT-201 with a copy of the closing statement if audited. Check your state's revenue department site for specifics.

Pre-1997 Sellers and Inherited Homes Face a Different Rulebook

If you're still holding a home with a pre-1997 rollover basis—meaning a prior sale's gain was deferred under the old rules—the calculation changes. You must subtract the deferred gain from the current sale's actual gain and apply the exclusion to what's left. The deferred gain then reduces your basis in whatever home you're now selling. Publication 523's "Special Rules" section walks through this, and most software programs handle it once you check the right box.

Inherited homes present their own puzzle. If you inherited a home and used it as a primary residence for two of the five years before selling, you can claim the exclusion up to $250,000 or $500,000. The basis is stepped up to fair market value at the date of death, so the gain calculation often starts from a much higher number. If the home was a rental property when inherited, the rental period may disqualify the use test unless it was converted to your primary residence and used for the required time.

A final edge case involves the "one sale every two years" rule. If you sold a home two years and one month ago and excluded gain, the clock is reset and you can exclude again on the current sale. If you sold 18 months ago, you're locked out unless you qualify for a partial exclusion, which requires one of the special reasons. Track the exact date of the prior closing—the IRS does.

FAQ

Can I avoid capital gains by buying a more expensive house?

No. The "buy a bigger house to defer tax" idea hasn't worked since the Taxpayer Relief Act of 1997 eliminated the rollover. Your replacement purchase is irrelevant to the exclusion if you meet the two-of-five test—you can buy any home, rent, or buy nothing at all and still keep the $250,000 or $500,000 exclusion. What matters is qualifying use, ownership, and the two-year frequency rule.

What if I sell my house and buy another within 45 days?

The 45-day deadline people remember belongs to 1031 exchanges, not primary residence sales. A primary residence sale has no reinvestment deadline and no replacement requirement under Section 121. The only "deadline" worth tracking is the two-year window after a spouse's death for the widowed-survivor $500,000 cap, and the two-year frequency rule between sales.

Do I pay state capital gains tax if I move to a no-income-tax state?

It depends on the state where the sale closes, not where you move afterward. New York, California, and most states source the sale to the property location, so a sale in a taxing state is taxable there even if you move to Florida the day after closing. A couple of states, like New Hampshire for certain gains, have their own rules—check the revenue department of the state where the house sits, not where you're heading.

What is the 3.8% net investment income tax on home sales?

The NIIT is a surtax on net investment income for high earners, but the primary-residence exclusion applies before the NIIT calculation. If your gain is fully excluded under Section 121, the NIIT doesn't touch it. If you have gain above the exclusion, that excess counts as net investment income and the 3.8% surtax applies once your MAGI crosses $200,000 single or $250,000 joint. The IRS reports on Form 8960.

How does a partial exclusion change my tax liability if I sell early?

The partial exclusion scales the standard cap by your qualifying months divided by 24. Selling 12 months after you began living in the home as a single filer gives you $125,000 of exclusion ($250,000 × 12 ÷ 24). Any gain above that figure is taxable as long-term capital gain, at 15% or 20% depending on your income. Keep documentation of the qualifying reason—employment distance, health, or an unforeseen event listed in Publication 523.

Can I claim the exclusion twice in one year?

Not under the primary residence rules—the two-year frequency test blocks a second exclusion on another primary residence. You could theoretically sell two homes in one year if one is a rental, but the rental wouldn't qualify for Section 121 unless it was your principal residence for two of the prior five years, which would breach the two-year rule. Married couples filing jointly may each claim $250,000 on their own separate primary residences, but the total is capped at $500,000 only if both homes are jointly owned and used—an edge case tax counsel should review.

Is my gain taxable if I sell at a loss?

A capital loss on a primary residence is generally not deductible against ordinary income. That's a quirk of the tax code—investment property losses can offset gain, but personal-use home losses are personal and non-deductible under IRS rules. The loss does reduce the basis of any future purchase if you carry records forward, but you can't take a deduction for it on your return.

This article is general educational information and not a tax opinion, legal opinion, or investment recommendation. The rules for Section 121, partial exclusions, state withholding, and the net investment income tax vary by income, filing status, sale year, and state of residency, and they change with legislation. Confirm your specific situation with a CPA or enrolled agent and check the current IRS Publication 523 and your state revenue department before acting.