Imagine you bought a home in 2015 for $380,000 and you’re now selling it for $640,000. That’s a $260,000 gain, which for most sellers should feel like a victory. But if you know about capital gains taxes, you may start to worry that you won't be able to hold on to that full amount.
The good news is that tax exclusions mean many home sellers don’t have to pay any capital gains taxes. But of course, you’ll need to qualify for that exclusion, and knowing how to do so can lead to confusion and stress.
Understanding the rules is essential, including how to qualify for the exclusion, what counts toward your cost basis, and how your earnings can influence your capital gains (higher earners may also have to pay a 3.8% surtax). In this guide, we’ll break down the rules so you have a better idea of how to avoid capital gains tax when selling a house.
Keep in mind that this article is for informational purposes only. For advice that is tailored to your situation, talk to a CPA before you list.
How capital gains tax works on a home sale
Capital gains tax only applies to the profit you make when you sell your house and not the full sale price. In other words, capital gain is simply the difference between your cost basis (which is usually what you bought your house for, adjusted for other costs like home improvements) and how much you're selling it for.
For capital gains tax, the length of time you owned your home is crucial. If you held your home for less than a year, that’s a short-term gain, which will be taxed as ordinary income. But long-term gains for homes held longer than a year are taxed at a usually much more forgiving rate of 0%, 15%, or 20%, depending on your income and marital status.[1]
Here’s how the income brackets for long-term gains break down for the 2026 tax year:[2]
| Rate | Single filers | Married filing jointly | Married filing separately |
|---|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 | Up to $49,450 |
| 15% | $49,451-$545,500 | $98,901-$613,700 | $49,451-$306,850 |
| 20% | Over $545,500 | Over $613,700 | Over $306,850 |
Also, if you have a modified adjusted gross income above $200,000 (for single filers) or $250,000 (for married, joint filers) you may also owe an additional 3.8% Net Investment Income Tax (NIIT) on any gains that exceed the excluded amount.[3] We’ll go into that in more detail later.
The good news is that most people selling their primary residence can reduce or eliminate capital gains tax entirely. Here's how.
The primary residence exclusion and how to qualify
If you just got a 1099-S form in the mail and are worrying about having to pay capital gains tax on your recent home sale, there’s no need to panic. In fact, there’s a good chance you’ll have no taxes on the capital gains from your home sale thanks to the primary residence exclusion.
Essentially, the primary residence exclusion allows you to exclude up to $250,000 of gain (for single filers) or $500,000 (for married joint filers) from your federal income taxes.[4] If the capital gains you made from your sale are less than those amounts, you won’t owe any capital gains tax.
However, to qualify you’ll need to meet three tests:[5]
- Ownership test: You must have owned the property for at least two years in the past five years. Those two years don’t have to be consecutive.
- Use test: You need to have lived in the home for two of the past five years (again, those two years don’t need to be consecutive). This requirement is why many (although not all) rental properties don’t end up qualifying for the primary residence exclusion.
- Look-back test: You can only claim the primary residence exclusion once every two years. If you’ve already used it in the last two years, you’re not eligible.
If you’re still confused about what primary residence means according to the IRS, it’s usually the address on your tax return address, driver’s license, and voter registration. If you split your time between two homes, it’s important to realize that the IRS will only consider one address your primary residence.
To understand how the primary residence exclusion actually impacts your tax bill, let's take two examples.
In scenario A, the seller purchased their house in 2016 for $350,000 and sold it in 2026 for $600,000, leading to a gain of $250,000. Because that gain falls within the $250,000 primary residence exclusion limit of $250,000, the seller owes no taxes.
In scenario B, the seller also purchased their house in 2016 for $300,000 and sold it in 2026 for $800,000, resulting in a $500,000 gain. Interestingly, whether or not the seller owes taxes depends on whether they’re a single filer or married and filing jointly.
Because the single filer exclusion only goes up to $250,000, if they’re single they’ll have to pay tax on the remaining $250,000 gain. But if they’re married and filing jointly, the exclusion rises to $500,000, meaning there’s no taxable gain.
Other ways to reduce your capital gains tax
While the primary residence exclusion is usually your most powerful tool for reducing your capital gains tax, it’s not the only one. Here are other practical strategies to minimize what you owe if your gains exceed the primary residence exclusion limits.
Increase your cost basis with home improvements
Your cost basis is essentially the amount you paid for your house plus the value of any qualifying improvements.
A qualifying improvement has to add permanent value to your home, like a room addition or finished basement. Routine repairs and maintenance, like leaky faucets, paint, and roof patching, don’t count.
Ashley Akin, CPA, tax consultant, and Senior Contributor at CEP DC, says, “When you sell a home, you pay tax on your profit. But you can lower that profit by adding the cost of big improvements, like a new roof, kitchen remodel, or new heating system.”
Having a higher cost basis is good for tax purposes because when your cost basis is higher, the more likely you are to stay below the primary residence exclusion.
For example, let’s say you purchased a house for $300,000 and later added a $60,000 kitchen remodel and a $20,000 roof replacement. Added together, your cost basis is now $380,000. You then sell your house for $630,000. Your taxable gain will be $250,000, which falls within the $250,000 exclusion cap for single filers. If you hadn’t increased your cost basis with repairs, your gain would have been $330,000, of which $80,000 would have been taxable (again, assuming you’re a single filer).
The catch is that you’ll need documentation. Make sure you save receipts, contractor invoices, and permit records to prove the value of any improvements you made to your property.
Akin notes, “Many people throw away receipts and forget these costs. I have seen sellers lose $10,000 to $50,000 because they did not track their upgrades.”
Deduct selling costs
You can also deduct some of the expenses associated with selling your home from your realized gain, such as agent commissions, closing costs, transfer taxes, and advertising fees.[5] These deductions differ from itemized deductions on your income taxes because they’re subtracted directly from your capital gain.
For example, if you sell a house for $630,000, pay standard real estate agent commission of 3% (or $18,900) and other selling costs of $6,100 (so $25,000 in total), your realized amount for tax purposes will be $605,000.
Similarly to increasing your cost basis, reducing your realized amount through deductions is another effective way of getting your capital gain amount closer to the primary residence exclusion threshold.
Time your sale to a lower-income year
Long-term capital gains rates are based on your total income for the year. If you expect your income to decrease in the future, such as because of a retirement, job change, or sabbatical, you may want to delay your house sale so that you can take advantage of the lower rate.
You’ll actually pay no capital gains tax if your income is below $49,451 (for single filers) or $98,901 (for married joint filers). If your income is above those thresholds, your capital gains will be taxed at a rate of 15%.
As Kevin Marshall, CPA and Personal Finance Professional at Amortization Calculator, says, “The most common mistake I see is bad timing. Many people sell during a year when their income is already high. That pushes them into a higher tax rate. On a $100,000 profit, that mistake can cost $8,000 to $30,000.”
Timing your sale properly can make a big difference to your tax bill, but the math can get complicated depending on your situation. Make sure you talk to a CPA at least 6-12 months before you list to plan the best strategy.
1031 exchange (for investment or rental properties)
A 1031 exchange only applies to investment and rental properties, not to primary residences. It lets you defer your capital gains taxes by rolling the profits of one property directly into a similar type of real estate investment.[6] In fact, you can defer taxes indefinitely and use successive exchanges to build wealth and your portfolio.
However, rules around 1031 exchanges are complicated and must be strictly followed. You have just 45 days after closing to identify a replacement property and just 180 days to complete the purchase. You also can’t hold onto the money yourself in the meantime either. Instead, a qualified intermediary holds the funds on your behalf.
The takeaway is that while a 1031 exchange is a powerful avenue to building wealth and lowering your tax liability, it’s one that you need to discuss with your tax advisor beforehand.
The 3.8% net investment income tax (NIIT): Who it hits
For high earners, the net investment income tax (NIIT) is an often-overlooked aspect of your tax obligations when selling a house. The NIIT is a 3.8% surtax applied on top of your regular capital gains rate if your adjusted gross income is above $200,000 (for single filers) or $250,000 (for married joint filers).
The NIIT applies to any capital gains that exceed the primary residence threshold (as a reminder, that’s $250,000 for single filers and $500,000 for married joint filers). If NIIT applies to you, your capital gains tax rate will be either 18.8% (15% + 3.8%) or 23.8% (20% + 3.8%) depending on your specific income level.
If you’re near these income thresholds, you’ll need to factor in the NIIT or potentially time your home sale during a year when you anticipate having a lower income.
Special situations: Rules that apply to you
Many special situations, like divorce or inheritance, benefit from tax breaks that aren’t available to most sellers. Unfortunately, if you don’t know about these tax breaks, you could pay much more in taxes than you need to.
Marshall notes, “Sellers who inherit their home, are selling due to a divorce or widowhood, or are relocating for military service, may be eligible for significant savings if they are aware of the tax rules governing these situations. These individuals may not realize they are entitled to greater tax savings, so they end up paying more than necessary.”
Inherited property
Inherited homes benefit from what’s called a stepped-up basis, which means that the cost basis is reset to the fair market value on the date of the original owner’s death.[7] That’s great for your tax bill, since calculating the stepped-up basis from the original purchase date (which may have been decades ago) may otherwise lead to an extremely large capital gain.
For example, let’s say your parents bought a house in 1980 for $80,000, which is worth $400,000 at the date of death. Upon inheriting the house, you immediately sell it and receive $410,000. Your taxable gain will be just $10,000 as opposed to $320,000 it would’ve been without the stepped-up basis.
Divorce
Following a divorce, you can transfer the house from one ex-spouse to another with the receiving spouse inheriting the original cost basis rather than the current market value. Also, even if one spouse has moved out, both spouses may be able to claim the primary residence exclusion on their share of the capital gain so long as they both meet the use test.
However, whether you sell before or after the divorce will affect how the exclusion applies. Because the exclusion doubles for married couples, you may want to delay your divorce.
As Dr. Randy E. Beavers, Associate Professor of Finance at the University of North Alabama, says, “I would also recommend couples not to finalize the divorce (if possible) until the year after the home sale is final to ensure an additional penalty is not incurred, since married couples can be exempt for double the amount versus single owners.”
Divorce changes many of the normal rules around buying and selling real estate, so you should consult with a tax advisor as early in the process as possible.
Recent widowhood
If your spouse passed away and you haven’t remarried, you may still be able to qualify for the full $500,000 exclusion. You’ll need to use the exclusion within two years of your spouse’s death and meet other qualifying tests, such as not taking the exclusion within the past two years.[5]
After that two-year window passes, you’ll be considered a single filer and your exclusion will drop to $250,000. You should talk with your CPA to evaluate whether selling before that two-year deadline makes sense for you.
Military and federal service
The standard 2-in-5-year rule for the primary residence reduction is extended to 10 years for active-duty military members, Foreign Service officers, and some intelligence personnel.[5] You’ll need to be stationed at least 50 miles from your main home in order to qualify.
This exception ensures military members don’t lose out on the primary residence exclusion due to deployment. In many cases, the 10-year rule also extends to spouses.
Partial exclusion when you don't fully qualify
If you don’t meet the 2-in-5-year rule for the primary residence exclusion, you may be able to apply for a partial exclusion. A partial exclusion is available to you if you had to sell your home before two years because of a job change, health issue, or other unforeseen circumstance (such as your house being condemned, or giving birth to two or more children at the same time).[5]
The exclusion is prorated based on how long you lived in the house as compared to the two-year requirement. So, if you live in the house for 12 months, you could qualify for up to 50% of the normal exclusion.
Partial exclusions aren’t widely known and often underutilized. You should talk to a CPA if you don’t meet the two-year rule but need to sell soon.
When to talk to a CPA (not just an agent)
You should talk to a CPA as soon as possible, ideally at least 6-12 months before you list. If you only consult a CPA after you close, you’ll have far fewer options.
As Akin says, “If someone comes to me six months before selling, I review all their records and check for missing improvements. Planning early almost always saves money. The biggest lesson is simple: keep your receipts and plan before you sell.”
A CPA is especially useful if any of the following applies to you:
- Your capital gains will likely exceed the primary exclusion threshold ($250,000 for single filers/$500,000 for joint married filers)
- You’re selling a rental or investment property
- You’re in a special situation as described above (inheritance, widowhood, divorce, or military)
- Your income is near or exceeds the NIIT threshold ($200,000 for single filers/$250,000 for married)
- You recently converted your primary residence to a rental property (or vice versa)
You should have both a CPA and a real estate agent on your team when selling a house, as they both play very different roles. A CPA can help maximize the amount of your sale proceeds you actually get to keep, while a good agent can help you get the best price possible.
Once you’ve found a CPA, focus on teaming up with a qualified real estate agent. Clever can connect you with top local realtors at reduced commission rates, keeping more money in your pocket.
FAQ
Do I have to report the sale of my home if I don't owe any capital gains tax?
Not always, but there are exceptions. If you receive a Form 1099-S from the title company, you must report the sale on your return even if your gain is fully excluded. If you exclude 100% of the gain and didn't receive a 1099-S, you typically don't need to report it. When in doubt, report it — a CPA can confirm.
What if I've only lived in the house for one year — do I still owe capital gains tax?
Likely yes, unless you qualify for a partial exclusion due to a job change, health issue, or unforeseen event. If you've owned it for less than a year, you'll also face short-term capital gains rates (same as ordinary income, up to 37%) rather than the lower long-term rates. Planning the timing of your sale carefully can save you significantly.
Do I owe capital gains tax if I'm selling to buy another house?
Not automatically. There's no "rollover" provision that lets you defer taxes by buying a replacement primary residence (that rule was eliminated in 1997). Your tax liability is based purely on the gain from the sale and whether you meet the exclusion tests. The only deferral option is a 1031 exchange, and that applies to investment properties only, not your primary home.
What counts as a home improvement for cost basis purposes?
Capital improvements that add value or extend the home's life: additions, new roof, HVAC, kitchen or bathroom remodels, new windows, finished basement. Regular maintenance and repairs do not count; patching a roof, painting, or fixing appliances won't increase your basis. Keep receipts and permits; the IRS may ask for documentation. When in doubt, ask your CPA what qualifies.
Can I avoid capital gains tax by gifting the house instead of selling it?
Gifting doesn't eliminate the tax; it transfers the tax burden. The recipient takes your cost basis, so when they eventually sell, they may owe capital gains on the full appreciation since your original purchase. If the home is likely to be inherited instead, the stepped-up basis at death can be significantly more tax-efficient. Consult an estate attorney before deciding.

