Capital gains tax is the tax you owe on the profit when you sell an investment for more than you paid for it
When you buy a stock, bond, real estate, or other asset and later sell it for a higher price, the difference between what you paid and what you received is your capital gain. The IRS taxes that profit. The amount you owe depends on how long you held the asset, your income level, and whether you're filing as single or married.
You don't owe capital gains tax on an investment that loses value, and you don't owe it just by owning something — only when you sell it. This matters because you can control when you sell, which means you can sometimes control which tax year the gain falls into.
Key Takeaways
- Long-term capital gains (assets held over one year) are taxed at lower rates than short-term gains, which are taxed as ordinary income.
- Your capital gains tax rate depends on your total income for the year and your filing status, not just the size of the gain itself.
- You calculate capital gains by subtracting what you paid (including fees and commissions) from what you received when you sold.
- Losses on investments can offset gains, and unused losses can carry forward to future years to reduce taxes owed.
Long-term versus short-term capital gains rates
The IRS taxes capital gains differently depending on how long you held the asset. If you owned it for one year or less before selling, it's a short-term capital gain, and it's taxed at your ordinary income tax rate — the same rate as your salary or wages. If you owned it for more than one year, it's a long-term capital gain, and it gets a lower tax rate.
Long-term capital gains rates are 0%, 15%, or 20%, depending on your income and filing status. These rates are lower than the ordinary income brackets, which go up to 37%. For example, a single filer with $50,000 in ordinary income might pay 22% tax on that income, but only 15% on long-term capital gains in the same year.
The exact rate you pay on long-term gains depends on where your total income falls. The IRS publishes income thresholds each year, and they differ for single filers, married filing jointly, married filing separately, and head of household. You need to know your total taxable income for the year to find your rate.
How your income level determines your capital gains tax rate
Capital gains tax brackets overlap with ordinary income brackets, but they're separate. Your ordinary income is calculated first, and then your capital gains are stacked on top of it. If your ordinary income plus long-term capital gains pushes you into a higher bracket, part or all of your gains may be taxed at that higher rate.
For 2024, a single filer with $47,025 or less in taxable income pays 0% on long-term gains. From $47,026 to $518,900, the rate is 15%. Above $518,900, it's 20%. But these numbers change each year — the IRS adjusts them for inflation. Married filing jointly has higher thresholds; married filing separately has lower ones.
This stacking effect means you can't straightforward look at your capital gains amount and know your rate. You have to add your ordinary income (wages, interest, dividends, and other income) to your long-term gains, then find which bracket the total falls into.
Calculating your capital gain or loss
Your capital gain is the sale price minus your cost basis. Cost basis is what you paid for the asset, plus any fees or commissions you paid to buy it. If you inherited an asset, your cost basis is usually its value on the date of death, not what the original owner paid — this is called a step-up in basis.
If you bought 100 shares of stock at $50 per share and paid a $10 commission, your cost basis is $5,010. If you later sold all 100 shares for $80 per share and paid a $10 commission to sell, your proceeds are $7,990. Your capital gain is $7,990 minus $5,010, which equals $2,980.
If you sell for less than you paid, you have a capital loss. You can use capital losses to offset capital gains in the same year. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against your ordinary income. Any remaining loss carries forward to future years.
When you owe capital gains tax
You owe capital gains tax in the year you sell the asset, not the year you buy it. This is true even if you don't receive the money until the following year. If you sell stock in December 2024 but the settlement doesn't clear until January 2025, the gain is still taxed in 2024.
You report capital gains on Schedule D (Form 1040), which you file with your federal tax return. Your broker sends you a Form 1099-B showing the sales you made during the year. You use that form to fill out Schedule D, calculating each gain or loss and totaling them.
Some states also tax capital gains. As of 2024, most states tax capital gains as ordinary income, but a few (including California, New York, and Washington) have separate capital gains taxes or higher rates on investment income. State rules vary, so check your state's tax authority website for the rules where you live.
How to reduce capital gains tax
You can't avoid capital gains tax on a profit, but you can manage when and how much you owe. One strategy is tax-loss harvesting: selling an investment at a loss to offset gains from other sales in the same year. This doesn't eliminate the tax, but it reduces it.
Holding assets for more than one year before selling is the largest single factor in reducing your rate. The difference between short-term (ordinary income rate, up to 37%) and long-term (up to 20%) can be substantial. If you're considering selling an investment that's close to the one-year mark, waiting a few weeks or months can lower your tax bill significantly.
Donating appreciated assets to charity instead of selling them is another option. You avoid the capital gains tax entirely and get a charitable deduction for the full fair market value of the asset. This works only if you itemize deductions on your tax return.
Using tax-advantaged accounts like 401(k)s and IRAs shields investment gains from capital gains tax while the money is in the account. Gains inside these accounts grow tax-free or tax-deferred, and you only pay tax when you withdraw (or never, in the case of Roth accounts).
Capital gains on real estate and inherited assets
Real estate capital gains follow the same rules as stock or bond gains, but with one major exception: the primary residence exclusion. If you sell a home you've lived in for at least two of the last five years, you can exclude up to $250,000 of gain from tax if you're single, or $500,000 if you're married filing jointly. This exclusion applies only once every two years.
Inherited assets receive a step-up in basis, meaning your cost basis is the asset's value on the date the person died, not what they originally paid. If someone bought a house for $100,000 and it was worth $400,000 when they died, your cost basis is $400,000. If you sell it when ready for $400,000, you owe no capital gains tax. This step-up applies to most inherited assets, including stocks, bonds, and real estate.
Frequently Asked Questions
Do I owe capital gains tax if I sell an investment at a loss?
No. You only owe tax on gains, not losses. If you sell for less than you paid, you have a capital loss. You can use that loss to offset capital gains from other sales in the same year, and if losses exceed gains, you can deduct up to $3,000 against ordinary income. Unused losses carry forward to future years.
What's the difference between short-term and long-term capital gains?
Short-term gains are on assets you held one year or less and are taxed at your ordinary income rate (up to 37%). Long-term gains are on assets held over one year and are taxed at lower rates (0%, 15%, or 20%). The rate depends on your total income and filing status, not just the gain amount.
Do I have to pay capital gains tax in the year I buy an investment?
No. You only owe capital gains tax in the year you sell. Owning an investment doesn't trigger tax, even if it increases in value. You report the gain on Schedule D when you file your tax return for the year of the sale.
Can I avoid capital gains tax by donating stock instead of selling it?
Yes, if you donate appreciated stock directly to a may have access to charity. You avoid the capital gains tax and receive a charitable deduction for the full fair market value. You must itemize deductions to benefit from this strategy, and the charity must be IRS-recognized.
How does the step-up in basis work for inherited assets?
When you inherit an asset, your cost basis becomes its value on the date of death, not what the original owner paid. If a stock was worth $50 when inherited and you sell it for $50, you owe no capital gains tax. This applies to most inherited assets, including real estate, stocks, and bonds.