What a capital gain is when you sell a property

A capital gain is the profit you make when you sell real estate for more than you paid for it. If you bought a house for $300,000 and sold it for $400,000, your capital gain is $100,000. That $100,000 is income the federal government taxes, and depending on how long you owned the property and your total income, your state may tax it too.

The tax applies to the profit, not the sale price. You do not pay capital gains tax on the full $400,000 — only on the $100,000 difference. However, the calculation of what counts as your "cost" and what counts as your "gain" has specific rules, and those rules differ depending on whether the property was your primary home, a rental, or investment land.

Key Takeaways

  • Capital gains tax is owed on the profit when you sell real estate, calculated as the sale price minus what you paid plus certain improvements.
  • If you owned the property for more than one year, the gain is taxed as a long-term capital gain, which has lower tax rates than short-term gains.
  • If the property was your primary home, you may exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly, provided you meet ownership and use tests.
  • Rental properties and investment land do not may have access to for the home sale exclusion, so all gains are taxable.
  • You report capital gains on your federal tax return using Form 8949 and Schedule D; your state may require separate reporting.

Long-term versus short-term capital gains rates

How long you owned the property determines which tax rate applies. If you held the real estate for more than one year before selling, the gain is long-term capital gain. Long-term rates are lower than ordinary income tax rates and range from 0%, 15%, or 20% depending on your total income for the year. The exact rate depends on your tax bracket.

If you sold the property within one year of buying it, the gain is short-term capital gain and is taxed as ordinary income — at your regular income tax rate, which can be as high as 37% federally. This is why real estate investors often hold properties longer than a year: the tax savings are substantial. A $100,000 gain taxed at 37% costs $37,000; the same gain taxed at 20% costs $20,000.

The one-year clock starts the day you take ownership. If you bought on March 15, 2023, and sold on March 16, 2024, you meet the long-term test. If you sold on March 14, 2024, you do not.

The primary residence exclusion and who qualifies

If the property was your main home, you may exclude a portion of the gain from taxation entirely. Single filers can exclude up to $250,000 of gain; married couples filing jointly can exclude up to $500,000. This is one of the largest tax breaks available, and it applies only to your primary residence — not to rental properties, vacation homes, or investment land.

To use this exclusion, you must meet two tests. First, you must have owned the property for at least two of the five years before the sale. Second, you must have lived in it as your main home for at least two of those same 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 you sell.

If you are married and file jointly, both spouses must meet the ownership and use tests to claim the full $500,000 exclusion. If only one spouse meets the tests, that spouse can exclude $250,000. If you are divorced and sell the home within two years of the divorce, you may still use the exclusion if you owned and lived in the home during the required period.

How to calculate your cost basis and adjusted basis

Your cost basis is what you paid for the property, including the purchase price, closing costs, and certain fees. If you bought a house for $300,000 and paid $6,000 in closing costs, your cost basis is $306,000. This is the number you subtract from the sale price to find your gain.

Your adjusted basis is your cost basis plus the cost of improvements you made to the property. Improvements are permanent upgrades that add value — a new roof, a kitchen remodel, an addition, or a new HVAC system. Repairs and maintenance do not count: painting, fixing a leak, or replacing a broken window are not improvements. The line between repair and improvement can be unclear, and the IRS has specific rules; when in doubt, keep receipts and ask a tax professional.

If you bought for $300,000, paid $6,000 in closing costs, and later spent $50,000 on a kitchen and bathroom remodel, your adjusted basis is $356,000. If you sell for $450,000, your capital gain is $94,000, not $150,000. Keeping detailed records of improvements is critical because the IRS may ask for proof.

Capital gains tax on rental properties and investment real estate

Rental properties and investment land are treated differently from primary residences. You cannot use the $250,000 or $500,000 exclusion — all of your gain is taxable. If you bought a rental house for $200,000, made $30,000 in improvements, and sold it for $350,000, your gain is $120,000, and you owe tax on the full amount.

However, if you owned the rental for more than one year, the gain is still taxed at long-term capital gains rates (0%, 15%, or 20%), not ordinary income rates. Additionally, if you claimed depreciation deductions on the property while you rented it out, the IRS requires you to "recapture" that depreciation. Depreciation recapture is taxed at 25%, which is higher than the long-term capital gains rate. This means part of your gain may be taxed at 25% and part at 15% or 20%.

For example, if you claimed $40,000 in depreciation deductions over the years and your total gain is $120,000, $40,000 of that gain is subject to 25% recapture tax, and $80,000 is subject to long-term capital gains rates. A tax professional can help you calculate this correctly.

State capital gains taxes on real estate sales

Most states do not have a separate capital gains tax, but some do. Washington, Illinois, and a few others impose a capital gains tax on investment income, which may include real estate gains. The rates and rules vary by state. Some states tax capital gains as ordinary income; others have a flat rate. A few states exempt primary residence sales from state tax even if they tax other capital gains.

You will owe both federal and state tax on your gain if your state has a capital gains tax. If you are selling a property and moving to a different state, the state where the property is located is the one that taxes the sale, not your new state of residence. If you are unsure whether your state taxes capital gains, contact your state's department of revenue or consult a tax professional before you sell.

Reporting capital gains on your tax return

You report capital gains from real estate sales on your federal tax return using Form 8949 (Sales of Capital Assets) and Schedule D (Capital Gains and Losses). Form 8949 lists each property you sold, the date you bought it, the date you sold it, your cost basis, the sale price, and your gain or loss. Schedule D summarizes your long-term and short-term gains and losses and calculates your net capital gain.

If you sold your primary home and are using the exclusion, you still report the sale on Form 8949 and Schedule D, but you reduce your gain by the exclusion amount before calculating tax. If you had a loss — you sold for less than your adjusted basis — you report that too, though losses on primary residences cannot be deducted. Losses on rental properties and investment land can offset other capital gains.

Keep all closing documents, receipts for improvements, and records of depreciation deductions for at least three years after you file your return. The IRS can audit real estate sales, and having documentation protects you.

Frequently Asked Questions

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

No. If you sell your primary home for less than you paid, you have a loss, not a gain, and no capital gains tax is owed. Losses on primary residences cannot be deducted on your tax return. If you sell a rental property or investment land at a loss, you can use that loss to offset other capital gains.

What if I inherited real estate and then sold it?

Inherited property receives a "step-up in basis." Your cost basis becomes the fair market value of the property on the date the previous owner died, not what they originally paid. If your parent bought a house for $100,000 and it was worth $400,000 when they died, your basis is $400,000. If you sell it shortly after for $400,000, you have no gain and owe no capital gains tax. This is a major tax benefit of inheritance.

Can I avoid capital gains tax by gifting the property to someone else?

No. Gifting does not trigger capital gains tax for you, but the person who receives the gift takes your cost basis, not a stepped-up basis. If you gift a property you bought for $100,000 that is now worth $400,000, the recipient's basis is $100,000. If they sell it for $400,000, they owe tax on the $300,000 gain. Gifting defers the tax but does not eliminate it.

What if I used part of my home as a rental or home office?

If you rented out part of your home or claimed a home office deduction, you may not may have access to for the full primary residence exclusion. The IRS requires that you lived in the home as your main home for the required period. If you converted part of it to rental use, that portion may be subject to capital gains tax and depreciation recapture. Consult a tax professional before selling if you have claimed business deductions on the property.

Do I have to pay capital gains tax in the year I sell, or can I defer it?

You owe the tax in the year you sell. However, if you are buying another property, you may be able to defer the gain using a 1031 exchange, which allows you to reinvest the proceeds in another investment property without triggering capital gains tax at that time. A 1031 exchange has strict rules and timelines and applies only to investment property, not primary residences. You must work with a may have access to intermediary to complete the exchange.