Capital gains tax on a home sale

Quick answer

You can exclude up to $250,000 of gain, or $500,000 on a joint return, if you owned and lived in the home for 24 of the 60 months before you sell. Tax applies above that.

Gain a single filer can exclude, if the tests are met
$250,000
Gain a couple filing jointly can exclude, if the tests are met
$500,000
Ownership needed, and residence needed, within the 5 years before you sell
24 months each

Source IRS Topic 701, Sale of your homeChecked

Federal capital gains tax on your primary residence applies to profit, and the exclusion in IRS Topic 701 (reviewed November 9, 2026) can cover all of it. A single filer with $180,000 of gain who passes the tests owes nothing to the IRS on it. The same filer with $371,000 of gain has $121,000 left to tax. Where tax fits among the other steps is covered in our guide to how to sell a house; this page is about the gain. The federal rules here apply in every state.

The home sale exclusion

If you owned the property and lived in it as your main home for at least 24 months of the 5 years before you sell, you can exclude up to $250,000 of gain, or $500,000 on a joint return. IRS Topic 701, last reviewed November 9, 2026, sets out the tests.

Test What counts Joint return
Ownership You owned it for at least 24 months of the last 5 years Either spouse can meet it
Use You lived there for at least 24 months of the last 5 years Both spouses have to meet it
Look-back You haven’t excluded gain on another property sold in the 2 years before this sale Both spouses, for the full $500,000

The 24 months of ownership and the 24 months of living there can be different periods. The residence doesn’t have to be one unbroken stretch either: Publication 523 asks for a total of 24 months, or 730 days. A vacation counts as time at home.

If one spouse passes and the other doesn’t, the couple can still have an exclusion, worked out spouse by spouse. Publication 523’s worksheet is the place to do that sum.

Selling before two years

You may get part of the exclusion when the main reason you sell is a work move, a health issue or an unforeseeable event. The standard work test is a new job at least 50 miles farther from the property than the old one was. If you had no previous workplace, the new one has to be at least 50 miles from the house.

The sum starts with the shortest of three periods: how long you lived there, how long you owned it, and the time since you last used the exclusion. Divide that by 24 months and multiply by $250,000. Twelve months gives $125,000. A change of heart about the kitchen isn’t on the IRS list. A couple filing jointly works it out for each spouse and adds the results.

Surviving spouses and service members

A widowed seller can use the $500,000 limit if the property is sold no later than 2 years after the spouse’s death, the seller hasn’t remarried, and the couple met the conditions just before the death. Certain people on qualified extended duty in the uniformed services, the Foreign Service or the intelligence community can suspend the 5-year period for up to 10 years.

What counts as gain: basis and improvements

Gain is the amount realized minus your adjusted basis. What the buyer pays is only the first number in the sum:

  1. The price minus selling expenses is the amount realized.
  2. What you paid, plus certain closing costs and improvements, less some reductions, is the adjusted basis.
  3. The amount realized minus the adjusted basis is the gain or loss.

Selling expenses include sales commissions, advertising, legal fees, loan charges you paid that would normally be the buyer’s, and other costs to sell. Our breakdown of the cost of selling a house lists them line by line. The part you pay for an agent on the other side of the deal is explained under buyer agent commission.

Purchase costs you can and can’t add

Usually added to basis Not added to basis
Abstract and recording fees Fire and casualty insurance premiums
Legal fees, including the title search and deed Charges connected with getting a mortgage, such as points and the credit report
Surveys Mortgage insurance premiums
Transfer or stamp taxes An appraisal the lender required
Owner’s title insurance Fees for refinancing

Improvements and repairs

An improvement adds to the property’s value, prolongs its life or adapts it to a new use. IRS examples include an added bedroom or deck, a new roof, central air conditioning, kitchen modernization, wiring and landscaping. Painting, fixing leaks and filling cracks are upkeep, so they stay out.

Two wrinkles are easy to miss. Repair-type work counts when it is part of an extensive remodeling job. And an improvement that is gone no longer counts, such as carpet you installed and later replaced. The carpet may be missed by nobody, but its invoice has to come off your list.

Depreciation you claimed, or could have claimed, for business or rental use reduces basis. So do some other items in Publication 523’s worksheet. If you rented out the property or had an office in it, this is a good point to bring in a tax professional.

Does paying off the mortgage change the tax?

No. The IRS says paying off your mortgage does not affect the amount of tax due, because the loan was already part of how you paid for the home. A seller who walks away with little cash can still have a gain.

When you owe tax

You owe tax when the gain is larger than your exclusion, when you don’t qualify for one, or on gain equal to depreciation allowed or allowable after May 6, 1997. How much depends on how long you owned the property and on your taxable income.

Own it for more than a year and the gain is long-term. These are the taxable income ceilings for each rate, from the IRS’s yearly adjustments:

2026 sales 0% up to 15% up to
Single $49,450 $545,500
Married filing jointly $98,900 $613,700
Head of household $66,200 $579,600
Married filing separately $49,450 $306,850
2027 sales 0% up to 15% up to
Single $51,050 $563,200
Married filing jointly $102,100 $633,600
Head of household $68,350 $598,400
Married filing separately $51,050 $316,800

Above the 15% ceiling the rate is 20%. The taxable gain itself counts as part of taxable income, so a large one can push some of itself into a higher band. Gain on a house owned for one year or less is short-term and taxed at ordinary rates. Gain tied to depreciation follows its own rules.

Because the year of sale sets the table you use, a closing that slides from December into January changes the table. That is one of several dates to weigh in the best time to sell a house.

The 3.8% net investment income tax

As IRS Topic 559 stood on December 1, 2026, this extra tax applies to the lesser of net investment income and the amount by which modified adjusted gross income exceeds a threshold: $200,000 for single and head of household, $250,000 for joint filers, $125,000 for married filing separately. Gain excluded under the main-home rules isn’t counted. Taxable gain can be.

Reporting and losses

You have to report it if you can’t exclude all of the gain, or if you receive Form 1099-S, even when the whole gain is excluded. Form 8949 and Schedule D are the forms when reporting is required. Receiving the form is a reporting matter. It does not mean you owe anything, whatever your stomach does when the envelope arrives.

A loss on your own home can’t be deducted. Publication 523 covers what to do when the property was partly for business. An inherited property or an investment property you never lived in falls outside the main-home exclusion.

State tax

States set their own rules. California, as one example, says on its Franchise Tax Board page (read December 1, 2026) that it conforms to the federal exclusion and taxes gain above it. Check your own state’s revenue department for the year you sell.

Worked examples

Here is one house worked for a single filer and for a couple, then an early sale with a partial exclusion. Every input is an example figure, and the tax rates are the 2026 federal ones.

Step Single filer Couple filing jointly
Sale price $700,000 $700,000
Selling expenses -$35,000 -$35,000
Amount realized $665,000 $665,000
Purchase price $250,000 $250,000
Closing costs added to basis $4,000 $4,000
Improvements $40,000 $40,000
Adjusted basis $294,000 $294,000
Gain $371,000 $371,000
Exclusion -$250,000 -$371,000
Taxable gain $121,000 $0

Say the single filer has $60,000 of other taxable income. All $121,000 falls in the 15% band, which runs from $49,450 to $545,500, so the federal tax on the gain is $18,150. We have assumed modified adjusted gross income under $200,000, so the 3.8% tax isn’t triggered.

The $40,000 of improvements saved that filer $6,000, which is 15% of $40,000. Not bad pay for keeping a folder. Without invoices or other records, those improvements would be hard to show.

An early sale. A single owner sells after 12 months for a qualifying work move. The price is $470,000, selling expenses are $28,000 and adjusted basis is $400,000. The gain is $42,000. The reduced exclusion is 12/24 of $250,000, or $125,000, so none of the gain is taxed.

Notice what is missing from all three sums: the mortgage balance. It decides how much cash reaches you, which is a separate calculation covered in selling a house with a mortgage.

How can I reduce capital gains tax on a home sale?

Within the rules: meet the two-year tests before you close, count every improvement and selling expense you can document, and check the partial exclusion if you have to move early. Each depends on your own dates and records, and a CPA or enrolled agent can confirm which apply. Our disclaimer explains that these pages are general information.

Do I pay tax if I sell after less than two years?

Possibly. Without a qualifying reason there is generally no exclusion, and with one you may have part of it. If you owned the home for a year or less, any taxable gain is short-term.

Sources

  1. IRS Topic 701, Sale of your home, Internal Revenue Service. Accessed December 1, 2026.
  2. Publication 523 (2025), Selling Your Home, Internal Revenue Service. Accessed December 1, 2026.
  3. Topic 409, Capital gains and losses, Internal Revenue Service. Accessed December 1, 2026.
  4. Rev. Proc. 2025-32: capital gains thresholds for 2026, Internal Revenue Service. Accessed December 1, 2026.
  5. Rev. Proc. 2026-35: capital gains thresholds for 2027, Internal Revenue Service. Accessed December 1, 2026.
  6. Topic 559, Net investment income tax, Internal Revenue Service. Accessed December 1, 2026.
  7. 26 U.S. Code 121, Legal Information Institute. Accessed December 1, 2026.
  8. FAQ: paying off the mortgage when you sell, Internal Revenue Service. Accessed December 1, 2026.
  9. Income from the sale of your home, California Franchise Tax Board. Accessed December 1, 2026.