Selling a house can feel like a win until the tax bill arrives. A home bought years ago for a modest price can sell for far more today, and the profit is not automatically tax free. This guide explains how the tax works, when you owe nothing, and how to lower the bill legally before you sell.

Quick answer: Capital gains tax is the tax on the profit from selling property. For a primary home, you can exclude up to $250,000 of gain if single, or $500,000 if married filing jointly, after owning and living in the home for two of the last five years. Gain above the exclusion is taxed at rates of 0%, 15%, or 20%.

This article is general information, not personal tax advice. Before a large sale, talk with a qualified tax professional who can review your numbers.

What Is Capital Gains Tax on Real Estate

A capital gain is the profit from selling an asset for more than you paid. On real estate, the gain is what you receive minus your adjusted basis, roughly what you paid plus certain improvements, minus selling costs. The tax applies to the gain, not the full sale price. Selling a house for $600,000 does not mean you are taxed on $600,000.

How long you owned the property decides how the gain is taxed. Held for one year or less, the gain is short-term and is taxed at your ordinary income tax rates, the same rates that apply to wages. Held for more than one year, the gain is long-term and is taxed at the lower capital gains rates of 0%, 15%, or 20%, depending on your total taxable income and filing status. For 2026, the 0% rate applies up to $49,450 single and $98,900 joint, the 15% rate up to $545,500 single and $613,700 joint, and the 20% rate above those levels.

A home can be a primary residence, a rental, or an investment property, and the tax rules change with each use. The most valuable rule for most people is the primary residence exclusion, covered next.

How to Figure Your Gain

The calculation has three parts. First, your adjusted basis: what you paid, plus improvements that added value, such as a new roof or a kitchen remodel. Routine repairs do not count. Subtract any depreciation you claimed. Second, the amount realized: the sale price minus selling costs, such as agent commissions. Third, subtract basis from the amount realized. The result is your gain. A loss on your primary home is not deductible, while investment losses generally can offset other capital gains.

The Primary Residence Exclusion

The biggest tax break for home sellers is the primary residence exclusion, the Section 121 exclusion in the tax code. If you qualify, you can exclude up to $250,000 of gain as a single filer, or $500,000 if married filing jointly. The excluded gain is not taxed at all.

To qualify, you must pass two tests in the five years before the sale: the ownership test, owning the home for at least two years in that window, and the use test, living in it as your main home for at least two years. The two years need not be continuous. For a joint return, only one spouse must meet the ownership test, but both must meet the use test for the full $500,000.

You can generally use the exclusion only once every two years. Partial exclusions exist for people who must sell early because of a job change, health reasons, or other unforeseen circumstances. A tax professional can tell you whether one applies to you.

Worked Example: A Married Couple Who Owes Nothing

Consider an illustrative example. A married couple bought their home for $300,000 and lived in it for six years. They spent $40,000 on improvements, a new roof and a kitchen remodel, raising their basis to $340,000. They sell for $650,000 and pay $25,000 in selling costs, so the amount realized is $625,000. Their gain is $625,000 minus $340,000, which equals $285,000.

They owned and lived in the home for more than two years and file jointly, so they can exclude up to $500,000. Their $285,000 gain is below that limit, so their taxable gain is zero. For a single filer, the same gain would exceed the $250,000 limit by $35,000, leaving $35,000 taxable.

Worked Example: A Single Seller Above the Exclusion

Now a second illustrative example. A single filer bought a home for $200,000, spent $30,000 on improvements, and lived there for eight years. The basis is $230,000. The home sells for $600,000, with $20,000 in selling costs, so the amount realized is $580,000. The gain is $580,000 minus $230,000, which equals $350,000.

As a single filer, this seller can exclude $250,000, leaving $100,000 taxable. Because the home was held for more than one year, the gain is long-term. If the seller’s total taxable income puts that gain in the 15% bracket, the federal tax is 15% of $100,000, which is $15,000. The actual rate depends on total income for the year, and state tax may also apply.

Rental and Investment Property

The primary residence exclusion does not apply to property you never lived in. If you sell a rental or investment property, the full gain is generally taxable, at long-term rates if you held it for more than a year.

First, depreciation recapture. If you claimed depreciation while renting, that depreciation is added back when you sell, and that part of the gain is taxed at a higher rate than the rest. This catches many landlords by surprise, because the depreciation saved tax year by year but creates a bill at sale.

Second, the 1031 exchange. A like-kind exchange under Section 1031 lets an investor defer the tax by reinvesting the proceeds into another investment property of the same kind, within strict deadlines. The tax is deferred, not erased, and the replacement property must be identified quickly, with the money passing through a qualified intermediary. A missed deadline voids the exchange, so professional help is close to essential. If you converted a rental into your primary home, or the other way around, periods when the home was not your primary residence can reduce the exclusion, and rental-year depreciation cannot be excluded.

How to Lower Capital Gains Tax on Real Estate

Live in the home for two years. If you are close to the two-year ownership and use tests, waiting a few more months can turn a taxable gain into a fully excluded one.

Keep records of every improvement. Improvements raise your basis and shrink your gain, but only if you can prove them. Save receipts and contracts for remodels, additions, and major systems like a roof or heating system. Repairs that merely keep the home working do not count.

Time the sale around your income. Because the long-term rate depends on your total taxable income for the year, selling in a lower-income year can put more of the gain in the 0% or 15% bracket.

Common Mistakes

Confusing the sale price with the gain. The tax is on the profit, not the price. Basis, improvements, and selling costs all reduce the gain before the exclusion applies.

Selling just before the two-year mark. A seller who sells at 23 months does not qualify, while one who waits until 24 months does. A few weeks can be worth a full exclusion.

Assuming the exclusion covers a rental. It covers only your main home. A second home, a vacation property, or a house rented out the whole time does not qualify, even after decades of ownership.

Forgetting depreciation. Landlords who claimed depreciation must account for recapture at sale. The bill can be large even when the gain is modest.

Ignoring state tax. Many states tax capital gains as ordinary income, and a few states have no income tax at all. A sale that is tax free federally can still produce a state bill.

Pros and Cons to Weigh

The primary residence exclusion is one of the most generous breaks in the tax code. A married couple can shelter half a million dollars of gain, which means most homeowners never pay capital gains tax on their home at all.

The limits have not kept pace with home prices in expensive markets, since the $250,000 and $500,000 figures are fixed amounts in the tax code. In a high-cost city, a long-held home can gain far more than the exclusion. The exclusion also rewards staying put, which can discourage a sensible move, and the rules for mixed-use homes, rentals, and early sales are full of traps.

Frequently Asked Questions

Do I pay capital gains tax if I sell my primary home?

Often, no. If you owned and lived in the home for two of the last five years, you can exclude up to $250,000 of gain as a single filer or $500,000 married filing jointly. You pay tax only on gain above those limits.

How long do I have to live in a house to avoid capital gains tax?

At least two years, or 24 months, as your main home during the five years before the sale. The two years do not need to be continuous. Selling earlier usually means the full exclusion is unavailable, although a partial exclusion may apply in limited circumstances.

What if my gain is more than the exclusion?

Only the gain above the exclusion is taxed. If you held the home for more than a year, the excess is taxed at the long-term rates of 0%, 15%, or 20%, depending on your income. State tax may also apply.

Does the exclusion apply to a rental property?

No. The exclusion applies only to your main home. Rental and investment gains are generally taxable, although a 1031 exchange can defer the tax if you reinvest in another investment property under strict rules.

Do I have to report the sale if no tax is due?

Sometimes. If the full gain is excluded, you generally do not need to report the sale, but keep records of the purchase price, improvements, and sale. If you receive a Form 1099-S, or if part of the gain is taxable, reporting is required.

Selling property is one of the largest financial events most people ever face, and the tax rules reward those who plan ahead. Keep your improvement receipts, know your two-year dates, and run the numbers before you list. If you are buying your next home, the average down payment for a first-time buyer is a useful starting point, and our complete guide to home loans in the USA explains the borrowing side. If the gain is large or the property has a mixed history, a qualified tax professional can check your figures and confirm which exclusions apply to you.

Sources and methodology

The figures, rules, and rates in this guide come from the authoritative sources linked throughout the article, including irs.gov. Where a figure is an estimate or a worked example, the article says so.

WAbout the authorWaseem Akram - Waseem is the founder and editor of Factaxy. He writes practical, research-backed guides on personal finance, insurance, health costs, and everyday money questions, so readers can make confident decisions without the jargon. More from this author · About Factaxy · LinkedIn