Capital Gains Tax on a Home Sale: How the $250,000 Exclusion Works When You Move Up to a New Home

In this article
Most people who sell their main home pay no federal capital gains tax on it. The IRS lets you exclude up to $250,000 of gain from income, or up to $500,000 if you file a joint return with your spouse, when you owned the home and lived in it for at least 2 of the 5 years before the sale. That is the legal way to avoid capital gains tax on a home sale, and it matters most when you sell one home to move into a new one.
This guide explains the rules from IRS Topic 701 and Publication 523, shows the math with clear examples, and covers the timing questions that come up when you buy a new-construction home before or after you sell. Every rule was checked Nov. 26, 2026.

How much capital gains tax do you pay when you sell your house?
It depends on your gain and whether you qualify for the exclusion. Your gain is not the sale price. The IRS has you figure it in three steps:
Amount realized. Publication 523 defines it as the sale price minus selling expenses, such as sales commissions, advertising fees and legal fees.
Basis. This is generally what you paid for the home, plus certain settlement costs and the cost of improvements. Pub. 523 lists settlement costs you can include, such as abstract fees, legal fees, recording fees, survey fees, transfer or stamp taxes, and owner's title insurance. Points and mortgage insurance premiums are not included.
Gain. Subtract your adjusted basis from the amount realized.
If your gain is at or under your exclusion limit and you qualify, you generally owe no federal tax on it. If it is more, the part above the limit may be taxed.
What is the $250,000 home sale exclusion?
IRS Topic 701 says you may qualify to exclude up to $250,000 of gain, or up to $500,000 on a joint return, if you meet two tests during the 5-year period ending on the date of sale:
Ownership test. You owned the home for at least 24 months (2 years) out of the last 5 years.
Use test. You lived in the home as your residence for at least 24 months of the last 5 years. Publication 523 says all that is required is a total of 24 months (730 days), so the time does not have to be in one stretch.
There is also a timing rule. You can take the exclusion only once during a 2-year period. If you excluded gain on another home sold in the 2 years before this sale, you generally cannot exclude gain again yet.
For married couples filing jointly, Pub. 523 says only one spouse has to meet the ownership test, but each spouse must meet the residence test on their own.
How does the math work? Two examples
These are EXAMPLES with made-up numbers. They are not tax advice, and your own numbers will be different.
EXAMPLE | Couple A (married, joint return) | Seller B (single) |
|---|---|---|
Sale price | $600,000 | $600,000 |
Selling expenses | $36,000 | $36,000 |
Amount realized | $564,000 | $564,000 |
Adjusted basis (price paid, eligible costs, improvements) | $300,000 | $250,000 |
Gain | $264,000 | $314,000 |
Exclusion if both tests are met | up to $500,000 | up to $250,000 |
Gain that may be taxable | $0 | $64,000 |
Seller B's extra $64,000 is the part the exclusion does not cover. That is why records of improvements matter. Every dollar of qualifying improvements you can prove raises your basis and lowers your gain.
What tax rate applies if part of the gain is taxable?
A home you owned for more than a year is usually a long-term capital asset. IRS Topic 409 says long-term capital gains are taxed at 0%, 15% or 20%, depending on your taxable income and filing status.
Some sellers may also owe the 3.8% net investment income tax. IRS Topic 559 says it applies above $250,000 of modified adjusted gross income for married filing jointly, and $200,000 for single or head of household. The part of a home sale gain that is excluded is not counted. State income tax rules vary, so check your state too.

Do you have to report the sale of your home?
Sometimes, even when you owe nothing. Topic 701 says that if you receive Form 1099-S, Proceeds From Real Estate Transactions, you must report the sale even if the gain is excludable. You must also report it if you cannot exclude all of your gain. The IRS uses Schedule D (Form 1040) and Form 8949 for this.
If you sell at a loss, Pub. 523 says you can't deduct the loss on your main home, but you don't need to pay tax on the money you received.
Can you still get the exclusion if you move into your new home first?
Often, yes. The tests look back 5 years from the date you sell, and the 24 months of use do not have to be the last 24 months.
Here is the plain math. If you lived in your old home for 2 full years, you could move into your new home and still meet the use test on the old one as long as the sale closes while those 2 years still fall inside the 5-year window. Pub. 523 also says that time in the 5-year period after the last date you used the home as your main home does not count as ""nonqualified use.""
That gives move-up buyers some room. But the clock is real. If you rent the old home out or leave it empty for years, you can fall outside the window. Talk to a tax professional before you count on the exclusion.
Does the new home start its own 2-year clock?
Yes. The tests apply to each home you sell. Your new home has to meet the 2-of-5-year ownership and use tests on its own before its sale can qualify for the full exclusion. Pub. 523 has rules for a partial exclusion when you sell early because of a job move at least 50 miles farther from the home than your old work location, health reasons, or certain unforeseeable events, such as the home being destroyed or condemned.
What this means for new-construction buyers
Selling one home and buying a new one is where these rules meet real life:
Your old home's sale date matters. Your new home may take months to finish. Plan the sale of your old home so it closes while you still meet the 2-of-5-year tests on it.
Keep your new home's records from day one. Save the final closing statement, receipts for eligible settlement costs, and records of any improvements you add after closing. They become your basis when you sell someday.
Line up the money side. If you need cash from your old home to buy the new one, read our guides to a home sale contingency, a bridge loan and a mortgage recast.
Know the other tax rules. Our post on the mortgage interest deduction covers the deductions that apply after you buy.
The IRS Topic 701 and Topic 409 pages were both last reviewed or updated Nov. 9, 2026, and both still describe these rules. For questions about your new home, call 561-704-0091.

Common Questions
How much is the capital gains exclusion on a home sale?
The IRS lets you exclude up to \$250,000 of gain from the sale of your main home, or up to \$500,000 if you file a joint return with your spouse. You must meet the ownership and use tests during the 5 years before the sale.
How long do you have to live in a house to avoid capital gains tax?
You generally must have owned the home and lived in it as your residence for at least 24 months out of the 5 years before the sale. The 24 months of use do not have to be in a row.
Can I avoid capital gains tax by buying another house?
Buying another home is not what removes the tax. The exclusion depends on whether you owned and lived in the home you are selling for at least 2 of the last 5 years, and whether you used the exclusion on another home in the past 2 years.
Do I have to report my home sale if I owe no tax?
If you receive Form 1099-S, the IRS says you must report the sale even if the gain is excludable. You also must report it if you cannot exclude all of your gain, using Schedule D and Form 8949.
What is the tax rate on a home sale gain above the exclusion?
For a home held more than a year, the IRS says long-term capital gains are taxed at 0%, 15% or 20%, depending on your taxable income and filing status. Some sellers may also owe the 3.8% net investment income tax.
Can I deduct a loss on the sale of my home?
No. IRS Publication 523 says you can't deduct a loss on the sale of your main home, but you don't need to pay tax on the money you received.
Ready to take the next step?
Call 561-704-0091 to talk with a National House Search specialist, or Schedule a visit.
Related reading: Home sale contingency on a new-construction home · How a bridge loan works · Mortgage recast
This is general information, not financial, tax or legal advice. Figures checked November 26, 2026.