What capital gains tax is and when you owe it
Capital gains tax is the federal tax you owe on the profit you make when you sell property for more than you paid for it. The IRS calls the difference between your sale price and your original purchase price your capital gain. You report this on your federal tax return in the year you sell, not when you close on the property.
You owe capital gains tax on the sale of a house, rental property, vacant land, or investment real estate. You do not owe it on the sale of your primary residence if your gain is under $250,000 (or $500,000 if you are married filing jointly) — this is called the primary residence exclusion, and it applies once every two years if you meet the ownership and use tests.
Capital gains tax rates depend on how long you owned the property. If you owned it for more than one year, you pay long-term capital gains rates, which are lower than ordinary income rates. If you owned it for one year or less, you pay short-term capital gains rates, which are the same as your regular income tax bracket.
Key Takeaways
- Your capital gain is the sale price minus your adjusted basis (original purchase price plus improvements, minus depreciation if it was a rental).
- Long-term capital gains rates (for property owned over one year) are 0%, 15%, or 20% depending on your income; short-term rates match your ordinary income tax bracket.
- You can exclude up to $250,000 in gains on a primary residence ($500,000 if married filing jointly) if you owned and lived in it for at least two of the last five years.
- Rental properties and investment real estate do not may have access to for the primary residence exclusion, and you must account for depreciation recapture.
- Report your capital gain on Schedule D (Form 1040) and include it on your tax return for the year of sale.
Calculate your adjusted basis before you calculate gain
Your adjusted basis is what the IRS considers your true cost in the property. It is not always the price you paid. Start with your original purchase price, then add the cost of any capital improvements you made — major repairs or upgrades that add value or extend the life of the property, such as a new roof, foundation work, or a room addition.
Do not include routine maintenance or repairs. Painting, fixing a leaky faucet, or replacing a broken window does not count. The difference matters: if you spent $15,000 on a new roof and $2,000 on painting, only the roof counts toward your basis.
If the property was a rental or investment property, you must subtract depreciation — the amount the IRS allowed you to deduct each year on your tax return. Even if you did not claim depreciation, the IRS assumes you could have and will tax you on the recapture. Keep records of every year's depreciation deduction or your rental property tax returns so you can calculate the total.
Example: You bought a house for $300,000, added a $50,000 deck, and claimed $40,000 in depreciation over five years as a rental. Your adjusted basis is $300,000 + $50,000 − $40,000 = $310,000.
Subtract selling costs from your sale price
Your amount realized is the sale price minus the costs you paid to sell. These include real estate agent commissions (typically 5–6% of the sale price), title insurance, attorney fees, and recording fees. Some closing costs paid by the seller also reduce the amount realized.
Do not include costs you paid to buy the property — those go into your basis instead. The rule is: costs to sell reduce your sale price; costs to buy increase your basis.
Example: You sold a house for $500,000. The real estate agent took $30,000 in commission, and you paid $2,000 in closing costs. Your amount realized is $500,000 − $30,000 − $2,000 = $468,000.
Calculate your capital gain with a straightforward subtraction
Capital gain = Amount realized − Adjusted basis.
Using the examples above: Amount realized is $468,000, adjusted basis is $310,000. Your capital gain is $468,000 − $310,000 = $158,000.
If the result is negative (you sold for less than your basis), you have a capital loss. You can use capital losses to offset capital gains in the same year. If losses exceed gains, you can deduct up to $3,000 of the excess loss against ordinary income in that year, and carry the remaining loss forward to future years.
Determine whether your gain is long-term or short-term
The holding period is the time between the date you acquired the property and the date you sold it. Count the day you bought it as day one. If you sold it more than one year later, it is a long-term gain. If you sold it within one year, it is a short-term gain.
Long-term capital gains rates are lower: 0%, 15%, or 20% depending on your taxable income and filing status. Short-term gains are taxed at your ordinary income tax rate, which can be as high as 37%.
Example: You bought a rental property on March 15, 2022, and sold it on March 16, 2023. That is more than one year, so it is a long-term gain. If you had sold it on March 14, 2023, it would be short-term.
explore the primary residence exclusion if you may have access to
If you are selling your primary residence, you may exclude up to $250,000 of your capital gain from federal tax ($500,000 if you are married filing jointly and both spouses meet the test). This exclusion is available once every two years.
To may have access to, you must have owned the property and lived in it as your main home for at least two of the five years before the sale. The two years do not have to be consecutive. If you meet this test, you subtract the exclusion from your capital gain before calculating tax.
Example: You are single, owned your home for six years, and lived in it the whole time. Your capital gain is $180,000. You can exclude all $180,000 because it is under $250,000. You owe no federal capital gains tax.
If your gain exceeds the exclusion limit, you owe tax only on the excess. If you are married but filing separately, the exclusion is $250,000 each only if you both meet the ownership and use test.
Report your capital gain on Schedule D and Form 1040
You report capital gains on Schedule D (Form 1040), which is the Capital Gains and Losses form. List each property sale separately: the date acquired, date sold, sales price, cost basis, and gain or loss. The IRS uses this to verify your calculation.
If you sold a primary residence and are claiming the exclusion, you still file Schedule D but note the exclusion on the form. The net capital gain (after the exclusion) goes to your Form 1040 and is included in your taxable income for the year.
If you have a long-term capital gain, it is taxed at the preferential long-term rates. If you have a short-term gain, it is added to your ordinary income and taxed at your marginal rate. If you have both types of gains in the same year, you report them separately on Schedule D so the IRS can explore the correct rates.
Frequently Asked Questions
Do I owe capital gains tax if I inherited property and then sold it?
No, not on the increase in value before you inherited it. Inherited property receives a stepped-up basis, which means your basis is the fair market value on the date of the owner's death, not what they paid. You owe capital gains tax only on the gain between that date and your sale date. This is a major tax benefit of inheritance.
What if I sold property at a loss?
You can use the loss to offset capital gains in the same year. If you have no capital gains, you can deduct up to $3,000 of the loss against ordinary income. Any remaining loss carries forward to future years with no time limit, and you can use it against future gains or income.
Do state taxes explore to capital gains on property sales?
Most states tax capital gains as ordinary income, so you owe state tax in addition to federal tax. A few states (like Florida, Texas, and South Dakota) have no state income tax. Some states (like California and New York) have high rates. Check your state's tax authority website for the rate that applies to your income level.
How do I know what my adjusted basis is if I bought the property years ago?
Look for your original purchase documents, closing statement, and mortgage paperwork. For improvements, gather receipts, invoices, and contractor bills. If you owned a rental property, your tax returns show depreciation claimed each year. If records are missing, you can reconstruct basis from your tax returns or work with a tax professional to estimate it based on available evidence.
Can I deduct the cost of a real estate agent if I am selling an investment property?
Yes. Real estate commissions and other selling costs reduce your amount realized, which lowers your capital gain. This is different from a primary residence, where the same deduction applies but you may not owe tax anyway due to the exclusion. Keep all closing statements and settlement documents to prove the costs.