What capital gains tax is and how it applies to real estate sales

Capital gains tax is a tax on the profit you make when you sell real estate for more than you paid for it. The difference between what you paid (your basis) and what you sold it for (the sale price) is your gain, and that gain is taxable income at the federal level. Most states also tax capital gains, though the rate and rules vary by state.

Real estate capital gains work differently depending on how long you owned the property. If you owned it for more than one year before selling, you pay the long-term capital gains rate, which is lower than ordinary income tax. If you owned it for one year or less, you pay the short-term capital gains rate, which is the same as your regular income tax bracket.

The federal long-term capital gains rates are 0%, 15%, or 20%, depending on your total income for the year. Short-term gains are taxed as ordinary income, which can range from 10% to 37%. This is why holding a property longer than a year usually saves you money in taxes.

Key Takeaways

  • Capital gains tax applies to the profit you make on a real estate sale, calculated as the sale price minus what you originally paid plus improvements you made.
  • Long-term capital gains (property owned over one year) are taxed at 0%, 15%, or 20% federally, while short-term gains are taxed as ordinary income at rates up to 37%.
  • You can reduce your taxable gain by deducting selling costs, property taxes, and the cost of improvements or repairs you made during ownership.
  • The primary residence exclusion lets you exclude up to $250,000 of gain (or $500,000 if married filing jointly) if you meet ownership and use tests.
  • State capital gains taxes vary widely; some states have no capital gains tax, while others tax it as ordinary income or at a flat rate.

How to calculate your capital gain on a real estate sale

Your capital gain is not simply the sale price minus the purchase price. You start with your adjusted basis, which is what you originally paid for the property plus the cost of any improvements you made. Improvements are permanent upgrades like a new roof, addition, or kitchen renovation — not repairs or maintenance.

From the sale price, you subtract your adjusted basis and your selling costs. Selling costs include real estate agent commissions, title insurance, closing costs you paid, and legal fees. The result is your taxable gain.

Example: You bought a house for $300,000. You spent $50,000 on a new roof and kitchen. You sold it for $500,000 and paid $30,000 in agent commissions and closing costs. Your adjusted basis is $350,000 ($300,000 + $50,000). Your taxable gain is $120,000 ($500,000 − $350,000 − $30,000).

The primary residence exclusion and who qualifies

If you are selling your primary residence, you may be able to exclude a portion of your capital gain from taxation. This is called the primary residence exclusion or Section 121 exclusion. You can exclude up to $250,000 of gain if you are single, or up to $500,000 if you are married filing jointly.

To use this exclusion, you must have owned the home for at least two of the five years before the sale, and you must have lived in it as your primary residence for at least two of those five years. The two years do not have to be consecutive, and they do not have to be the most recent two years, but they must fall within the five-year window before sale.

You can use this exclusion only once every two years. If you sold another home and used the exclusion within the past two years, you cannot use it again on this sale. If your gain exceeds the exclusion amount, you owe tax on the remainder.

Federal tax rates and how your income affects what you pay

Long-term capital gains are taxed at preferential rates that depend on your total taxable income for the year, not just the gain itself. The three federal rates are 0%, 15%, and 20%.

For 2024, the 0% rate applies to single filers with taxable income up to $47,025, and married filers filing jointly up to $94,050. The 15% rate applies to income above those thresholds up to $518,900 (single) or $583,750 (married filing jointly). Income above those amounts is taxed at 20%. These income thresholds change each year.

This means your capital gain may be taxed at different rates depending on where it falls within your income bracket. If you are near a threshold, timing the sale or spreading income across two years can sometimes lower your tax. A tax professional can model this for your specific situation.

State capital gains taxes on real estate

State taxes on capital gains vary significantly. Nine states have no capital gains tax at all: Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, Wyoming, and New Hampshire (though New Hampshire taxes investment income differently). Most other states tax capital gains as ordinary income at their regular state income tax rates, which range from roughly 2% to 13% depending on the state and your income level.

A few states have a separate capital gains tax. California taxes long-term gains as ordinary income. Washington state has a 7% capital gains tax on long-term gains over $250,000. Maryland taxes long-term gains at a lower rate than short-term gains. You owe tax to the state where the property is located, not where you live.

If you are selling property in a state different from where you live, research that state's rules before closing. Some states offer credits for taxes paid to other states, which can reduce double taxation.

Deductions and expenses you can subtract from your gain

You can reduce your taxable gain by deducting certain costs related to the property and the sale. These include real estate agent commissions, title insurance, recording fees, attorney fees, and other closing costs you paid at sale. You can also deduct the cost of improvements you made during ownership — but only improvements that added value to the property or extended its life.

Repairs and maintenance do not count as improvements and cannot be deducted. Painting, fixing a leak, or replacing a broken window are repairs. A new roof, addition, or upgraded HVAC system are improvements. The line is sometimes unclear, so keep receipts and documentation for anything substantial.

You cannot deduct property taxes, mortgage interest, or utilities you paid during ownership — those are deducted from your income in other ways, not from your capital gain. You also cannot deduct depreciation you claimed if you rented out part of the home, though depreciation recapture may apply.

Inherited property and the step-up in basis

If you inherited real estate, the rules change significantly. When someone dies and leaves you property, your basis is stepped up to the fair market value of the property on the date of death, not what the previous owner paid for it. This means if the property appreciated substantially during the previous owner's lifetime, you owe no capital gains tax on that appreciation.

Example: Your parent bought a house for $200,000 and it was worth $500,000 when they died. Your stepped-up basis is $500,000. If you sell it immediately for $500,000, you owe no capital gains tax. If you sell it later for $550,000, you owe tax only on the $50,000 gain that occurred after you inherited it.

This step-up applies to most inherited property, including real estate, stocks, and other assets. It is one of the largest tax benefits in the code, but it applies only at death, not during life. Gifting property while alive does not trigger a step-up.

Frequently Asked Questions

Do I owe capital gains tax if I sell my home at a loss?

No. If you sell for less than your adjusted basis, you have a loss, not a gain. You cannot deduct capital losses from real estate sales against your ordinary income. However, you can use capital losses to offset capital gains from other investments in the same year or carry them forward to future years.

What if I owned the property for exactly one year?

The rule is more than one year, not one year or more. If you owned it for exactly one year, it is considered short-term, and you pay ordinary income tax rates. Waiting one extra day moves it to long-term rates, which are usually much lower.

Can I avoid capital gains tax by doing a 1031 exchange?

A 1031 exchange lets you defer capital gains tax by selling one investment property and buying another similar property within strict timelines. You do not avoid the tax permanently — you postpone it until you eventually sell without doing another exchange. The rules are complex and require a may have access to intermediary.

Do I owe capital gains tax on a property I rent out?

Yes, and the calculation is more complex. You can deduct depreciation you claimed during ownership, but you must pay tax on that depreciation at a 25% rate when you sell, separate from the capital gains tax on the remaining gain. Consult a tax professional for rental property sales.

What if I sell property in a different state than where I live?

You owe capital gains tax to the state where the property is located. If you also owe tax to your home state, you may receive a credit for taxes paid to the other state, depending on your state's rules. Check both states' requirements before closing.