Do You Pay Capital Gains Tax When You Sell Your House?

When you sell your house, you probably won’t owe federal capital gains tax at all. Section 121 of the Internal Revenue Code lets a single filer exclude up to $250,000 of profit from the sale of a primary home, and a married couple filing jointly can exclude up to $500,000, as long as you’ve owned and lived in the place for at least two of the five years before closing.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence Profit above that ceiling is taxed at long-term capital gains rates, which run 0%, 15%, or 20% depending on your income.

Who Qualifies for the $250,000 / $500,000 Exclusion

Two tests decide whether you can use the exclusion. You must have owned the home for at least two of the five years before the sale, and you must have used it as your main home for at least two of those same five years. The ownership and use periods don’t have to overlap, and neither needs to be a single continuous stretch. Fourteen months living there, a year away, then ten months back adds up to the required 24 months of use.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence

For a married couple to claim the full $500,000, at least one spouse has to meet the ownership test and both spouses have to meet the use test. There’s also a frequency limit: you can’t use the exclusion if you or your spouse already claimed it on a different home sale within the previous two years.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence

The dollar limits haven’t been adjusted for inflation in decades, which matters as home values rise. A profit that would have been fully sheltered ten years ago may now spill into taxable territory.

Figuring Out Your Actual Gain

Your profit isn’t the sale price minus what you paid. It’s the amount realized minus your adjusted basis.

The amount realized is the sale price minus selling costs, including real estate agent commissions, advertising fees, legal fees, and any loan charges you paid on the buyer’s behalf.2Internal Revenue Service. Publication 523, Selling Your Home

Your adjusted basis is what you have invested in the property for tax purposes: the original purchase price, plus acquisition costs like title insurance and settlement fees, plus every capital improvement you’ve made. Capital improvements are permanent changes that add value or extend the home’s useful life. A new roof, a kitchen remodel, a finished basement all count. Routine maintenance and cosmetic repairs, like patching drywall, fixing a leaky faucet, or repainting a room, do not.

The higher your basis, the smaller your taxable gain, which is why receipts for improvements matter years after the work is done. Hang onto closing documents, contractor invoices, and building permits for as long as you own the home, and for several years after you file the return that reports the sale.3Internal Revenue Service. Publication 583, Starting a Business and Keeping Records

What You Pay on Gain Above the Exclusion

Any profit that exceeds your exclusion gets taxed as a capital gain. Because most homeowners have owned for more than a year, the long-term rates apply. For 2026, those rates are 0%, 15%, or 20% based on taxable income:4Internal Revenue Service. Revenue Procedure 2025-32

  • 0% for single filers with taxable income up to $49,450, or joint filers up to $98,900.
  • 15% for single filers between $49,450 and $545,500, or joint filers between $98,900 and $613,700.
  • 20% for single filers above $545,500, or joint filers above $613,700.

The taxable portion of the gain stacks on top of your other income for the year, so a large gain can push part of itself into a higher bracket. If you somehow owned the home for a year or less, the gain is short-term and taxed at your ordinary income rate, which can reach 37% for 2026.

The 3.8% Net Investment Income Tax

Higher earners owe an additional 3.8% surtax on the taxable portion of a home sale gain. The Net Investment Income Tax applies when modified adjusted gross income exceeds $200,000 for single filers or $250,000 for joint filers.5Internal Revenue Service. Topic No. 559, Net Investment Income Tax Gain you exclude under Section 121 doesn’t count as net investment income, so the surtax only reaches the taxable slice.6Internal Revenue Service. Questions and Answers on the Net Investment Income Tax For a high-income single filer, the combined federal rate on a taxable gain can hit 23.8%.

When Part of the Gain Stays Taxable Anyway

Two situations pull profit out of the exclusion even when you otherwise qualify.

Non-qualified use. If you used the property for something other than your main home after December 31, 2008, a portion of your gain won’t qualify for exclusion. The typical case is renting out a place, then moving in later and selling. Divide the non-qualified-use days (after 2008, and before the last date you used the entire property as your main home) by your total days of ownership. That fraction of your gain stays taxable.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence2Internal Revenue Service. Publication 523, Selling Your Home Own a house for five years, rent it for the first two, live in it for the last three, and 40% of your gain is taxable regardless of how large your exclusion would be.

Depreciation recapture. If you ever claimed depreciation on the home, whether from renting it out or writing off a home office, that amount is taxed at sale at a maximum federal rate of 25%.7Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5 The Section 121 exclusion cannot shelter recaptured depreciation.

Selling Before Two Years: The Partial Exclusion

If you sell before hitting both two-year marks, you may still get a reduced exclusion. The IRS allows a prorated amount when the early sale is caused by a workplace relocation, a health issue, or an unforeseeable event such as a natural disaster or job loss.2Internal Revenue Service. Publication 523, Selling Your Home

The formula divides the number of days you met the shorter of the two tests by 730, then multiplies by your maximum exclusion. A single filer who lived in the home for 365 days before a qualifying job transfer gets 365 ÷ 730 × $250,000, or $125,000 of exclusion.

Death, Divorce, and Military Service

Several life events change the math.

Surviving spouses. If your spouse dies and you sell within two years of the death, you can still claim the full $500,000 exclusion, as long as you haven’t remarried, you meet the ownership and use tests (counting your late spouse’s time), and neither of you used the exclusion on another home in the prior two years.2Internal Revenue Service. Publication 523, Selling Your Home After the two-year window, the limit drops to $250,000.

Divorce. A spouse who receives the home in a divorce gets credit for the time the transferring spouse owned it. And if a divorce decree lets your ex-spouse live in the home, you’re treated as using it as your principal residence during that time, even after you’ve moved out.1Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence

Military and Foreign Service. Members of the uniformed services or Foreign Service on qualified extended duty can elect to suspend the five-year look-back period for up to 10 years. A service member deployed for eight years could sell up to 13 years after buying and still meet the two-out-of-five-years use test.8eCFR. 26 CFR 1.121-5 – Suspension of 5-Year Period for Certain Members of the Uniformed Services and Foreign Service

Inherited Homes Work Differently

If you inherit a house, the basis resets to the fair market value on the date the previous owner died, not what they paid.9Internal Revenue Service. Gifts and Inheritances A house bought for $80,000 in 1985, worth $400,000 at the owner’s death, gives you a starting basis of $400,000. Sell for $420,000, and your taxable gain is $20,000.

Inherited property also qualifies for long-term capital gains treatment automatically, no matter how quickly you sell. If you move in and use the home as your primary residence for two of the five years before selling, the Section 121 exclusion stacks on top of the stepped-up basis.

Selling at a Loss Gives You Nothing

If you sell your personal home for less than you paid, you cannot deduct the loss. The IRS treats losses on personal-use property differently from investment losses; only losses from a trade or business, a transaction entered into for profit, or certain casualty and theft events are deductible.10Office of the Law Revision Counsel. 26 U.S. Code 165 – Losses A $50,000 loss on your primary residence produces zero deduction.11Internal Revenue Service. Capital Gains, Losses, and Sale of Home If part of the home was used for business or rental, the loss allocated to that portion may be deductible; the personal-use portion never is.

State Taxes Are Separate

Everything above is federal. Most states also tax capital gains, usually as ordinary income, and rates vary widely. Nine states impose no income tax on real estate capital gains, while others charge rates that can exceed 13%. Check your state’s rules before assuming the federal exclusion is the full picture.

Reporting the Sale

Whether you owe tax and whether you need to report the sale are separate questions. The closing agent generally files Form 1099-S with the IRS and sends you a copy.12Internal Revenue Service. Instructions for Form 1099-S (04/2025) If your gain is fully excludable and no Form 1099-S is issued, you generally don’t need to report the sale on your return.13Internal Revenue Service. Important Tax Reminders for People Selling a Home

If you do receive a Form 1099-S, report the sale even when no tax is due. It goes on Form 8949, and the totals flow to Schedule D. When the gain is fully excluded, you enter adjustment code “H” and write the exclusion amount as a negative number, which zeroes out the gain.14Internal Revenue Service. Instructions for Form 8949 (2025) When only part of the gain qualifies, the negative adjustment covers the excludable portion and the remainder is taxed at the applicable rate.