What capital gains tax means and how it applies to real estate sales
Capital gains tax is the tax you owe on the profit you make when you sell a property for more than you paid for it. The profit itself — not the sale price — is what gets taxed. If you bought a house for $200,000 and sold it for $300,000, your capital gain is $100,000, and that $100,000 is the amount subject to tax.
Real estate capital gains work differently depending on how long you owned the property. If you owned it for more than one year, it counts as a long-term capital gain, which is taxed at a lower federal rate (0%, 15%, or 20%, depending on your income). If you owned it for one year or less, it counts as a short-term capital gain, which is taxed as ordinary income at your regular tax bracket — potentially much higher.
The calculation itself is straightforward: sale price minus your cost basis equals your gain. The complexity comes in figuring out what counts as your cost basis and what deductions you can subtract before calculating the tax.
Key Takeaways
- Your capital gain is the sale price minus your cost basis (what you paid plus certain improvements), not the full sale price.
- Long-term gains (property owned over one year) are taxed at federal rates of 0%, 15%, or 20%; short-term gains are taxed as ordinary income.
- You can deduct selling costs like realtor commissions and closing costs from your sale price before calculating the gain.
- If the property was your primary residence, you may be able to exclude up to $250,000 (single) or $500,000 (married filing jointly) of the gain from federal tax.
- State and local taxes on capital gains vary widely; some states have no capital gains tax, while others tax it as income.
Determining your cost basis
Your cost basis is what you originally paid for the property, plus the cost of any improvements you made to it. This is the foundation of the entire calculation. If you bought the house for $200,000, your starting basis is $200,000.
Improvements are different from repairs. An improvement adds value to the property or extends its useful life — a new roof, a room addition, a new HVAC system, or a kitchen remodel. A repair keeps the property in its current condition — fixing a leaky faucet, patching drywall, or replacing a broken window. Only improvements add to your basis.
Keep receipts and invoices for all improvements you made during ownership. If you inherited the property, your basis is typically the fair market value on the date of the person's death, not what they originally paid. If you received the property as a gift, your basis is usually what the giver paid for it.
Calculating the gain: sale price minus deductions
Start with your gross sale price — the amount the buyer paid. Then subtract your selling costs. These include realtor commissions (typically 5–6% of the sale price), title insurance, closing costs you paid, and any other fees directly tied to the sale. These deductions reduce the amount on which you owe tax.
The formula is: (Sale Price − Selling Costs) − Cost Basis = Capital Gain.
Example: You sold a house for $300,000. You paid a realtor 5.5% commission ($16,500) and had $2,000 in closing costs. Your cost basis is $200,000 (purchase price) plus $15,000 in improvements you made. Your calculation is: ($300,000 − $18,500) − $215,000 = $66,500 capital gain.
Long-term versus short-term gains and tax rates
How long you owned the property determines which tax rate applies. Long-term capital gains apply if you owned the property for more than one year before selling. The federal tax rate on long-term gains is 0%, 15%, or 20%, depending on your total taxable income for the year.
Short-term capital gains apply if you owned the property for one year or less. These are taxed as ordinary income at your regular federal tax bracket, which ranges from 10% to 37%. Short-term gains are almost always taxed at a higher rate than long-term gains.
The holding period is measured from the date you acquired the property to the date you sold it. If you bought on March 15, 2022, and sold on March 16, 2023, you meet the one-year threshold and may have access to for long-term rates.
The primary residence exclusion
If the property was your primary residence — the house you lived in — you may be able to exclude part or all of your capital gain from federal tax. Single filers can exclude up to $250,000 of the gain. Married couples filing jointly can exclude up to $500,000.
To may have access to, you must have owned the home and lived in it as your primary residence for at least two of the five years before the sale. The two years do not have to be consecutive. If you meet these requirements, you do not report the excluded portion of the gain on your federal tax return at all.
This exclusion does not apply to investment properties, vacation homes, or rental properties. If you rented out part of your home or used part of it for business, the exclusion may be reduced or eliminated for that portion.
State and local capital gains taxes
Federal tax is only part of the picture. Many states and some cities tax capital gains as well, and the rules vary widely. Some states — including Florida, Texas, Washington, and Wyoming — have no state income tax and therefore no state capital gains tax. Other states tax capital gains as ordinary income at their regular income tax rates.
A few states have separate capital gains taxes. Washington State, for example, taxes long-term capital gains on certain assets at a flat 7%. New York taxes capital gains as income, with rates up to 10.9% depending on your bracket. California taxes long-term and short-term gains the same way — as ordinary income, with rates up to 13.3%.
Check your state's tax authority website or speak with a tax professional to understand what you owe in your state. The state where the property is located determines which state tax applies, not where you live.
Depreciation recapture for rental and investment properties
If the property was a rental or investment property, you may have claimed depreciation deductions on your tax returns over the years you owned it. When you sell, you must "recapture" that depreciation — meaning you owe tax on it at a rate of 25% federally, even if your long-term capital gain rate would be lower.
Depreciation recapture applies only to the depreciation you actually claimed or could have claimed. It does not apply to your primary residence if you never rented it out or used it for business. If you owned a rental property for 20 years and claimed $50,000 in depreciation deductions, you owe 25% federal tax on that $50,000 when you sell, separate from the tax on the rest of your capital gain.
This is one reason rental property sales can be more complex than primary residence sales. A tax professional can help you calculate what portion of your gain is subject to recapture.
Frequently Asked Questions
Do I have to pay capital gains tax if I sell my primary home?
Not necessarily. If you lived in the home as your primary residence for at least two of the five years before the sale, you can exclude up to $250,000 (single) or $500,000 (married filing jointly) of the gain from federal tax. You only owe tax on any gain above that amount. State taxes may still apply depending on where you live.
What if I sold the property at a loss?
If your sale price minus your cost basis and selling costs is negative, you have a capital loss. You cannot deduct a capital loss from the sale of a primary residence on your federal return. For investment or rental properties, you can use capital losses to offset capital gains from other sales, and excess losses can offset up to $3,000 of ordinary income per year.
How do I know if an expense counts as an improvement versus a repair?
Improvements add value or extend the life of the property; repairs maintain it. A new roof is an improvement; fixing a leak is a repair. A kitchen remodel is an improvement; replacing a broken cabinet is a repair. When in doubt, keep the receipt and ask a tax professional or your accountant.
Can I reduce my capital gains tax by timing when I sell?
Timing can affect whether your gain is taxed as long-term or short-term, which changes the rate significantly. If you are close to the one-year mark, waiting a few months to may have access to for long-term rates can save thousands. However, you cannot control your income level for the year, which also affects your tax rate, so consult a tax professional before deciding when to sell.
What records do I need to keep for a capital gains calculation?
Keep your original purchase documents, receipts for all improvements, records of the sale (closing statement, realtor agreement), and documentation of any depreciation claimed if it was a rental property. The IRS can audit real estate sales for up to three years after you file, so hold onto these records for at least that long.