How capital gains tax works when you sell real estate
Capital gains tax is the tax you owe on the profit you make when you sell real estate. If you buy a house for $300,000 and sell it for $400,000, your capital gain is $100,000. You pay tax on that $100,000 profit, not on the full sale price. The tax rate depends on how long you owned the property and your total income for the year.
Real estate is taxed differently depending on whether you owned it for more or less than one year. If you sell within one year, it counts as a short-term capital gain and is taxed at your ordinary income tax rate — the same rate as your salary or wages. If you own it longer than one year, it counts as a long-term capital gain and gets a lower tax rate. Most people who sell a home they lived in may have access to for an even bigger break: they can exclude up to $250,000 of profit from tax if they are single, or $500,000 if they are married filing jointly, as long as they meet specific ownership and use rules.
Key Takeaways
- You only pay tax on your profit (sale price minus what you paid plus improvements), not on the full sale price.
- Long-term capital gains rates are 0%, 15%, or 20% depending on your income; short-term gains are taxed as ordinary income.
- If you lived in the home for at least two of the last five years before selling, you may exclude $250,000 (single) or $500,000 (married) of profit from tax.
- Investment properties and rental homes do not may have access to for the primary residence exclusion and are always taxed on the full gain.
- State and local taxes on capital gains vary widely and can add 5% to 13% or more to your federal tax bill.
Long-term versus short-term capital gains rates
The federal tax rate on your real estate profit depends on how long you held the property. Long-term capital gains — profit from property you owned for more than one year — are taxed at 0%, 15%, or 20%, depending on your taxable income. These rates are much lower than ordinary income tax rates, which go up to 37%. Most people fall into the 15% bracket.
Short-term capital gains — profit from property you owned for one year or less — are taxed as ordinary income. This means they are added to your wages, self-employment income, and other earnings, and taxed at whatever rate applies to your total income for the year. If you are in the 24% tax bracket, short-term gains are taxed at 24%. If you are in the 32% bracket, they are taxed at 32%.
The exact income thresholds that determine which long-term rate you pay change each year. For 2024, the 0% rate applies to single filers with taxable income up to roughly $47,000 and married filers up to roughly $94,000. The 15% rate applies to higher incomes, and the 20% rate applies to the highest earners. These thresholds shift annually, so check the IRS website or a tax professional for the current year.
The primary residence exclusion: $250,000 or $500,000 off your profit
If you sell a home you lived in, you may not owe any tax on part or all of your profit. The Section 121 exclusion lets you exclude $250,000 of gain if you are single, or $500,000 if you are married filing jointly. This is one of the largest tax breaks available to homeowners.
To use this exclusion, you must meet three tests. First, you must have owned the home for at least two of the five years before you sold it. Second, you must have lived in it as your primary residence for at least two of those same five years. Third, you cannot have used this exclusion on another home in the two years before this sale. The two years of ownership and the two years of use do not have to be the same two years — you can own it for five years but live in it for only two of those years and still may have access to.
If you are married and both spouses meet the test, you can exclude $500,000. If only one spouse meets the test, you can exclude $250,000. If you are single or divorced, the limit is $250,000. Any profit above the exclusion amount is taxed as a long-term capital gain.
What counts as your profit: basis, improvements, and selling costs
Your capital gain is not simply the sale price minus the price you paid. It is the sale price minus your adjusted basis. Your basis starts with what you paid for the property, but it increases when you make capital improvements — permanent upgrades that add value or extend the life of the home. A new roof, a kitchen remodel, or an addition to the house counts. Routine repairs and maintenance do not.
You can also subtract certain selling costs from your sale price before calculating the gain. Real estate agent commissions, title insurance, and transfer taxes paid by the seller typically reduce your proceeds. Keep receipts and closing statements that show these costs. Your basis also includes some costs you paid at purchase, such as recording fees and title insurance premiums.
If you inherited the property, your basis is usually the fair market value on the date of death, not what the previous owner paid. This is called a stepped-up basis and can eliminate or greatly reduce the capital gain if you sell soon after inheriting.
Capital gains tax on investment and rental properties
Investment properties and rental homes are taxed differently from a primary residence. You cannot use the $250,000 or $500,000 exclusion. The entire profit is subject to capital gains tax. If you owned it for more than one year, it is taxed at the long-term rate (0%, 15%, or 20%). If you owned it for one year or less, it is taxed as ordinary income.
Rental properties face an additional tax called depreciation recapture. When you own a rental, you deduct depreciation each year on your tax return, which lowers your taxable income. When you sell, the IRS recaptures that depreciation and taxes it at 25%, regardless of how long you owned the property. This applies only to the depreciation you actually deducted, not to the building's actual loss of value.
If you converted a primary residence to a rental, or a rental to a primary residence, the rules are more complex. You may be able to use part of the exclusion if you lived in it as your primary home for at least two of the five years before sale, but the exclusion is reduced by the years you rented it out. Consult a tax professional if this applies to you.
State and local capital gains taxes
Federal capital gains tax is only part of what you owe. Most states tax capital gains as ordinary income, which means your state tax rate is added on top of the federal rate. State rates range from 0% (in states with no income tax) to over 13% (in high-tax states). A few states have separate capital gains taxes: California, Washington, and New York have enacted capital gains taxes that apply only to gains above a certain threshold, typically $250,000 or more.
Some cities and counties also impose local income taxes that apply to capital gains. New York City, for example, adds a local tax on top of state and federal taxes. If you are selling property in a state or city where you do not live, you may still owe tax there. Check your state's tax authority website or speak with a tax professional about your specific location.
How to report capital gains on your tax return
When you sell real estate, you report the transaction on Form 8949 (Sales of Capital Assets) and Schedule D (Capital Gains and Losses). Your real estate agent or closing attorney will provide a Form 1099-S, which reports the sale price to the IRS. You use this form to calculate your gain and report it on your return.
If you used the primary residence exclusion, you do not report it as a separate calculation on the form — you simply report the gain after subtracting the exclusion. If you have a loss (you sold for less than your basis), you can use that loss to offset other capital gains, but you cannot deduct a loss on the sale of a personal residence.
If you are unsure how to calculate your basis or whether you may have access to for the exclusion, a tax professional or CPA can help. The cost of professional help is often far less than the tax you might overpay or the penalties you might face if you report incorrectly.
Frequently Asked Questions
Do I owe capital gains tax if I sell my home at a loss?
No. If you sell your primary residence for less than your basis, you have a loss, and you cannot deduct it on your tax return. Losses on personal residences are not deductible. However, if you have other capital gains from investments or other property sales that year, you can use the loss to offset them.
What if I lived in the house for only one year before selling?
You do not meet the two-year ownership and use test for the primary residence exclusion, so the entire profit is taxable. It is taxed as a long-term gain if you owned it for more than one year, or as a short-term gain (ordinary income rates) if you owned it for one year or less. You may still deduct your basis and selling costs from the sale price.
Can I avoid capital gains tax by doing a 1031 exchange with real estate?
A 1031 exchange allows you to defer capital gains tax by selling one investment property and buying another similar property within strict timelines. You do not pay tax at the time of sale; instead, the gain carries forward to the new property. This works only for investment or business property, not for a primary residence. The rules are complex and have strict deadlines, so consult a tax professional before attempting one.
How do I know what my original purchase price was if I bought the house decades ago?
Look for your original closing statement or deed of sale. If you cannot find it, contact the title company or real estate agent who handled the sale, or check your county assessor's records, which often list historical sale prices. If you truly cannot find the original price, you may need to use an appraisal or other evidence to establish your basis.
Is there a time limit for how long I have to own a home to get the exclusion?
You must own and live in the home for at least two of the five years before you sell. You do not have to own it for any longer than that. If you own it for 10 years but live in it for only one year, you do not meet the test. The two years do not have to be consecutive, and they do not have to be the most recent two years.