Capital gains tax is the tax you pay when you sell an investment or asset for more than you paid for it
The profit itself — the difference between what you paid and what you sold it for — is called a capital gain. The IRS taxes this gain as income, but not at your regular income tax rate. Instead, the rate depends on how long you held the asset before selling it. If you held it for more than one year, you pay the long-term capital gains rate, which is lower. If you held it for one year or less, you pay the short-term capital gains rate, which is the same as your ordinary income tax rate.
You owe capital gains tax only when you actually sell the asset. straightforward owning an investment that has grown in value does not trigger a tax bill. The tax is due in the year you sell, and you report it on your tax return.
Key Takeaways
- Long-term capital gains (assets held over one year) are taxed at 0%, 15%, or 20% depending on your income, which is lower than ordinary income tax rates.
- Short-term capital gains (assets held one year or less) are taxed as ordinary income at your regular tax bracket rate.
- You report capital gains on Schedule D of your Form 1040, and the IRS matches it against your brokerage records.
- Losses from selling investments can offset gains dollar-for-dollar, and up to $3,000 in net losses can offset other income each year.
- The cost basis — what you originally paid — is the starting point for calculating gain, and it includes commissions and fees you paid to buy the asset.
Long-term versus short-term capital gains rates
The holding period is the dividing line. If you buy a stock on June 15 and sell it on June 15 of the next year, that is long-term. If you sell it on June 14, it is short-term. The difference in tax cost can be substantial.
Long-term capital gains rates are 0%, 15%, or 20%. Which rate applies depends on your taxable income and filing status. The 0% rate applies to lower-income filers; the 15% rate covers most middle-income earners; the 20% rate applies to higher earners. These brackets change each year. Short-term gains have no special rate — they are taxed as ordinary income, so if you are in the 24% tax bracket, your short-term gain is taxed at 24%.
This difference is why timing matters. Holding an investment just a few more weeks or months to cross the one-year threshold can cut your tax bill significantly.
How to calculate your capital gain or loss
Start with your cost basis — the amount you paid to buy the asset. This includes the purchase price plus any fees or commissions you paid to acquire it. When you sell, subtract the cost basis from the sale price. The result is your gain or loss.
Example: You buy 100 shares of a stock at $50 per share, paying a $10 commission. Your cost basis is $5,010. You sell all 100 shares at $75 per share, receiving $7,500 but paying a $10 commission on the sale. Your net proceeds are $7,490. Your capital gain is $7,490 minus $5,010, which equals $2,480.
If you sell for less than you paid, you have a capital loss. Losses are valuable because they can offset gains. If you have $5,000 in gains and $3,000 in losses in the same year, you report a net gain of $2,000.
Using losses to reduce your tax bill
Capital losses can be used to cancel out capital gains dollar-for-dollar. If your losses exceed your gains, you can use up to $3,000 of the excess loss to offset other income — wages, interest, dividends — in that tax year. Any remaining loss carries forward to future years, where you can use it again.
This is where tax-loss harvesting comes in. If you own an investment that has declined in value, you can sell it to lock in the loss, then use that loss to offset gains elsewhere in your portfolio or other income. You can even buy a similar (but not identical) investment right away to maintain your market exposure. The IRS has a rule called the wash-sale rule that prevents you from buying the same or substantially identical security within 30 days before or after the sale, but a similar fund or stock in a different company is fine.
Tax-loss harvesting makes the most sense when you have realized gains to offset or when you are in a higher tax bracket. If you have no gains and no other income to offset, the loss carries forward, so there is no rush to harvest it this year.
Reporting capital gains on your tax return
You report capital gains and losses on Schedule D, which is part of your Form 1040. You list each sale separately — the date you bought it, the date you sold it, the cost basis, the sale price, and the gain or loss. At the bottom of Schedule D, you calculate your net long-term gain or loss and your net short-term gain or loss.
If you have a net long-term gain, it goes to the appropriate line on Form 1040 and is taxed at the long-term rate. If you have a net short-term gain, it is added to your ordinary income. If you have a net loss, you can deduct up to $3,000 against other income, and any excess carries to the next year.
Your brokerage sends you a Form 1099-B showing all your sales for the year. The IRS receives a copy, so your numbers must match. If you report a gain of $5,000 but your brokerage reports $6,000, the IRS will notice and send you a notice. Make sure your cost basis is correct in your brokerage account before you sell, because that is what appears on the 1099-B.
Special situations: inherited assets and mutual funds
If you inherit an investment, you receive a stepped-up basis. This means your cost basis becomes the value of the asset on the date the person died, not what they originally paid for it. If they bought a stock for $10 and it was worth $100 when they died, your basis is $100. If you sell it the next week for $105, you owe tax on only $5 of gain. This is a significant tax benefit and is one reason inherited assets are valuable.
Mutual funds and exchange-traded funds (ETFs) work the same way as individual stocks for capital gains purposes. When you sell shares, you calculate the gain based on the cost basis of those specific shares. If you bought shares at different times and prices, you can choose which shares to sell — a method called specific identification — to minimize your gain. Your brokerage can help you designate which lot you are selling.
When professional information makes sense
If you have a large portfolio with multiple sales in a year, or if you are considering a major sale that will trigger a significant gain, it is worth talking to a tax professional before you sell. They can model the tax impact, suggest timing strategies, or identify losses to harvest. If you are in a year with unusually low income, you might benefit from realizing gains at the 0% long-term rate. If you are expecting a bonus or large income event next year, you might defer a sale to this year.
A tax professional can also help you track cost basis correctly, especially if you have reinvested dividends or made multiple purchases over time. Mistakes in basis are common and expensive to fix after the fact.
Frequently Asked Questions
Do I owe capital gains tax if I sell at a loss?
No. If you sell for less than you paid, you have a capital loss, not a gain. You do not owe tax on a loss. Instead, you can use the loss to offset gains or other income, which reduces your tax bill.
What if I buy and sell a stock within a few days?
That is a short-term gain or loss, taxed as ordinary income. The holding period is measured from the day after you buy to the day you sell. If you buy on Monday and sell on Tuesday, that is short-term, even if the gain is large.
Can I avoid capital gains tax by not selling?
Yes. Capital gains tax is due only when you sell. If you hold an investment indefinitely, you never owe tax on the unrealized gain. However, if you die, your heirs receive a stepped-up basis, so they can sell without owing tax on the gain that occurred during your lifetime.
Does the wash-sale rule explore to losses I harvest in December?
Yes. If you sell a stock at a loss in December and buy the same stock (or a substantially identical one) in January, the wash-sale rule applies. You cannot deduct the loss. The rule looks back 30 days before the sale and forward 30 days after, so plan accordingly if you want to harvest losses and stay invested.
How do I know my cost basis if I lost my old statements?
Contact your brokerage. They are required to track cost basis for securities bought after 2011. For older purchases, you may need to reconstruct it using old statements, confirmation letters, or tax returns. If you cannot find the original cost, you can use the fair market value on the date you acquired it as a reasonable estimate, but keep documentation of how you arrived at that number.