For many homeowners, selling a house is the largest financial transaction of their lives. And yet capital gains tax — a topic that can meaningfully affect how much money you walk away with — often gets little more than a passing mention in the closing conversation. By the time sellers start asking questions, they're sometimes too close to the finish line to plan around it effectively.
This guide breaks down how capital gains tax works when you sell a home, who qualifies for the primary residence exclusion, what can increase or decrease your taxable gain, and what situations put sellers at greater risk of owing a larger tax bill than they expected.
What Is a Capital Gain on a Home Sale?
A capital gain is simply the profit you make when you sell an asset for more than you paid for it. When it comes to real estate, the IRS calculates your gain by subtracting your adjusted cost basis from your net sale price.
Your cost basis starts with what you originally paid for the home. From there, it can be adjusted upward by the cost of capital improvements you made over the years — things like adding a room, replacing a roof, or installing a new HVAC system. Routine maintenance and repairs generally don't count toward your basis, but significant upgrades do.
Your net sale price is the amount you sold the home for, minus certain selling costs — including real estate agent commissions, title fees, and other closing costs you paid as the seller. So if you bought a home for $200,000, spent $40,000 on improvements, and sold it for $420,000 with $20,000 in selling costs, your gain would be $160,000.
The Primary Residence Exclusion: The Most Important Rule for Homeowners
Here's the good news most homeowners have heard of but don't fully understand: the IRS allows you to exclude a significant portion of your capital gain from taxation if the home was your primary residence. This is often called the Section 121 exclusion.
How much can you exclude?
- Single filers can exclude up to $250,000 of capital gain from federal income tax.
- Married couples filing jointly can exclude up to $500,000.
That's a substantial benefit. For many sellers — particularly those in mid-range markets who haven't owned their home for decades — the exclusion wipes out their entire taxable gain, meaning they owe nothing in federal capital gains tax on the sale.
Who qualifies for the exclusion?
To claim the exclusion, you generally need to meet two tests:
- Ownership test: You must have owned the home for at least two of the five years before the sale.
- Use test: You must have lived in the home as your primary residence for at least two of the five years before the sale.
These two years don't need to be consecutive, and they don't need to be the two most recent years — just two out of the five-year lookback window. You also cannot have used this exclusion on another home sale within the past two years.
There are partial exclusion rules that apply if you had to sell before meeting the two-year threshold due to a job change, health issue, or other unforeseen circumstance. In those cases, you may be able to claim a prorated portion of the exclusion. This is worth discussing with a tax professional if your timeline is short.
What Tax Rate Applies If You Owe Capital Gains Tax?
If your gain exceeds the exclusion amount — or if you don't qualify for the exclusion at all — the amount above the threshold is taxable. The rate you pay depends on how long you owned the home and your overall income.
Short-term vs. long-term capital gains
- If you owned the home for one year or less, any gain is taxed as ordinary income — meaning it's added to your regular income and taxed at your marginal rate, which could be as high as 37% for high earners.
- If you owned the home for more than one year, the gain qualifies for long-term capital gains rates, which are generally 0%, 15%, or 20% depending on your taxable income for the year.
Most homeowners who have lived in their home for several years will be dealing with long-term rates, which are significantly more favorable. But sellers who bought recently — particularly those selling a house they just bought — may face short-term rates and lose access to the primary residence exclusion entirely if they haven't met the two-year threshold.
Situations Where Capital Gains Tax Becomes More Complex
Inherited homes
When you inherit a property, the tax rules work differently and are often more favorable than people expect. Inherited homes typically receive a stepped-up basis, meaning your cost basis is reset to the fair market value of the home at the time of the original owner's death — not what they paid for it decades ago. This can dramatically reduce or even eliminate any capital gain if you sell relatively soon after inheriting.
If you've recently come into an inherited property and are weighing your options, our guide on selling an inherited property covers the full picture from both a process and tax standpoint.
Rental properties and former primary residences
If you rented out your home before selling it, the tax calculation gets more complicated. You can still use the primary residence exclusion if you meet the ownership and use tests, but any depreciation deductions you took while the home was a rental must be "recaptured" and are taxed at a rate of up to 25%. This catches many sellers off guard.
Similarly, if you converted your home to a rental and later moved back in, only the portion of the gain attributable to your qualifying primary residence period may be excludable. The IRS uses a proration formula to determine how much of your gain is covered. For anyone selling a former rental property, talking to a CPA before listing is genuinely worth the cost of an hour of their time.
Divorce situations
Divorce introduces its own layer of complexity. If a home is transferred between spouses as part of a divorce settlement, the receiving spouse typically takes on the original cost basis. That matters because the exclusion for a single filer drops to $250,000 — half of what a married couple could have claimed. Timing the sale carefully relative to the divorce finalization can sometimes affect eligibility and the size of the exclusion available to each party.
Home office deductions
If you've taken home office deductions on past tax returns, the portion of your home allocated to business use may not qualify for the primary residence exclusion. The IRS has specific rules here, and the interaction between home office deductions and capital gains treatment is one of the more frequently misunderstood areas in home sale taxation.
What Counts Toward Your Cost Basis — and What Doesn't
Increasing your adjusted cost basis is one of the most practical ways to reduce a taxable gain. Many sellers leave money on the table because they haven't tracked capital improvements over the years. Here's a general breakdown:
Items that typically increase your basis:
- Room additions or new construction on the property
- Major kitchen or bathroom renovations
- New roof, HVAC system, or windows (when replacing, not repairing)
- Landscaping and permanent outdoor improvements
- Finishing a basement or attic into livable space
- Legal fees directly related to acquiring the home
Items that do not increase your basis:
- Routine maintenance like painting, fixing leaks, or replacing worn fixtures
- Appliances that aren't built-in (unless they were part of the original purchase)
- Costs deducted in prior years (such as home office expenses or rental depreciation)
Keeping receipts and records for every significant improvement you make is one of the simplest things a homeowner can do to protect themselves at tax time. If you're selling a home you've owned for many years and can't reconstruct those records, a tax professional may be able to help you estimate reasonable improvement costs based on the age and condition of major systems.
State Capital Gains Taxes
Federal capital gains tax is only part of the picture. Many states impose their own capital gains tax on top of the federal rate, and the rules vary widely. Some states tax capital gains as ordinary income. A handful of states — including Florida, Texas, and Nevada — have no state income tax at all, which can make a meaningful difference for sellers in those markets.
If you're selling in a higher-tax state like California or New York, state capital gains tax can add substantially to what you owe. California, for instance, taxes capital gains at the same rate as ordinary income, with no preferential long-term rate. That's a significant consideration for sellers in high-appreciation markets.
Planning Ahead: When to Talk to a Tax Professional
For the majority of sellers — those who have lived in their home for more than two years and whose gain falls within the exclusion limits — capital gains tax won't be a major issue. But for sellers in any of the following situations, speaking with a CPA or tax advisor before closing is strongly recommended:
- You've owned the home for less than two years
- Your expected gain exceeds $250,000 (single) or $500,000 (married)
- The home was used as a rental at any point
- You claimed home office deductions
- You're selling an inherited property
- You're in the middle of a divorce
- You live in a state with significant capital gains taxes
The cost of a few hours with a qualified tax professional is almost always dwarfed by the savings that come from understanding your exposure before you close — not after. Sellers who wait until they're filing their taxes to think about capital gains often find they had options earlier in the process that are no longer available to them.
Does the Method of Sale Affect Capital Gains?
Whether you sell through a traditional listing, work with an agent, or accept a cash offer from a buyer like Keyheart, the capital gains calculation itself doesn't fundamentally change — your gain is still determined by the difference between your adjusted basis and your net proceeds. What can change is your net proceeds, since different sale methods carry different costs. Selling for cash often means lower or no agent commissions and simplified closing costs, which can affect your net sale price and therefore the gain you ultimately report.
For a broader look at how the numbers compare, our guide on the tax implications of selling a house for cash goes into more detail on how closing cost structures interact with your overall tax picture.
The Bottom Line
Capital gains tax on a home sale is one of those topics that sounds intimidating until you understand the basics. For most long-term homeowners selling a primary residence, the federal exclusion covers the entire gain and there's nothing additional to pay. But for sellers in more complex situations — recent purchases, rental conversions, inherited homes, or high-appreciation markets — understanding the rules ahead of time can save a meaningful amount of money and prevent unpleasant surprises at tax time.
The key takeaway is to know your numbers before you get to closing day. Understand what you paid, what you spent on improvements, what you'll net from the sale, and whether your gain falls within the exclusion. If any of those numbers are uncertain, that's what tax professionals are for.
Thinking About Selling Your Home?
Keyheart makes the process straightforward — no open houses, no repairs, no agent commissions. Get a no-obligation cash offer and close on your schedule.
Get Your Cash Offer