When You Owe Capital Gains Tax on Stocks
You pay capital gains tax when you sell a stock for more than you paid for it, and the tax is due the year you sell—not when you buy or hold
Capital gains tax applies to the profit you make when you sell a stock. If you bought 100 shares at $50 each and sold them at $75 each, your gain is $2,500. That $2,500 is what gets taxed, not the full $7,500 you received. The tax bill arrives when you file your tax return for the year you sold, which is typically the following April.
You do not owe tax while you hold the stock, no matter how much its value rises. You also do not owe tax if you sell at a loss. The timing of when you sell—how long you held the stock before selling—determines which tax rate applies to your gain.
Key Takeaways
- Capital gains tax is owed only on the profit from a sale, calculated as the sale price minus what you originally paid for the stock.
- Short-term gains (stocks held one year or less) are taxed as ordinary income at your regular tax rate, which can be as high as 37 percent.
- Long-term gains (stocks held more than one year) receive preferential rates of 0, 15, or 20 percent depending on your income level.
- You report the sale on your tax return in the year you sold, and the tax is due when you file that return.
- Losses can offset gains dollar-for-dollar, and unused losses can reduce your other income by up to $3,000 per year.
Short-term gains: stocks you held for one year or less
If you sell a stock you owned for one year or less, your profit is taxed as short-term capital gains. This means the gain is added to your other income for the year and taxed at your ordinary income tax rate. For 2024, those rates range from 10 percent to 37 percent depending on your total income and filing status.
Short-term gains receive no special treatment. A $5,000 gain on a stock you held for six months is taxed the same way as $5,000 in wages or salary. If you are in the 24 percent tax bracket, that $5,000 gain costs you $1,200 in federal tax. State tax, where applicable, is added on top.
The holding period is measured from the day after you buy to the day you sell. If you bought on January 15 and sold on January 15 of the following year, that is exactly one year, and the gain qualifies for long-term treatment. If you sold on January 14, it is short-term.
Long-term gains: stocks you held for more than one year
If you sell a stock you owned for more than one year, your profit is taxed as long-term capital gains. These gains receive preferential tax rates: 0 percent, 15 percent, or 20 percent, depending on your income level. For most investors, the rate is 15 percent.
The 0 percent rate applies if your total income is below a certain threshold—$47,025 for single filers and $94,050 for married couples filing jointly in 2024, though these thresholds change yearly. The 20 percent rate applies to higher incomes. Between those two thresholds, the rate is 15 percent.
Because long-term rates are lower than ordinary income rates, holding a stock for more than one year can significantly reduce your tax bill. A $5,000 long-term gain taxed at 15 percent costs $750 in federal tax, compared to $1,200 if it were short-term at the 24 percent bracket.
How to calculate your gain or loss
Your capital gain is the sale price minus your original purchase price, minus any fees you paid to buy or sell. If you bought 50 shares at $40 per share and paid a $10 commission, your cost basis is $2,010 (50 × $40 + $10). If you sold those 50 shares at $60 per share and paid a $10 commission to sell, your proceeds are $2,990 (50 × $60 − $10). Your gain is $980.
If you sold for less than you paid, you have a capital loss. You do not owe tax on a loss. Instead, you can use it to reduce your capital gains. If you had a $5,000 gain on one stock and a $2,000 loss on another in the same year, you report a net gain of $3,000 and pay tax only on that amount.
If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against your other income—wages, interest, dividends, and so on. Any loss beyond $3,000 carries forward to future years and can be used to offset future gains or income.
Reporting the sale on your tax return
When you sell a stock, your broker sends you a Form 1099-B in January of the following year, listing every sale you made. You use this form to report your sales on Schedule D (Capital Gains and Losses), which attaches to your Form 1040 tax return.
Schedule D separates short-term gains and losses from long-term ones. You calculate your net short-term gain or loss and your net long-term gain or loss, then combine them. If you have a net long-term gain, you report it on the appropriate line of your return, and it is taxed at the long-term rate. If you have a net short-term gain, it is added to your ordinary income.
Your broker's 1099-B may not match your actual cost basis if you bought shares over time, reinvested dividends, or transferred shares between accounts. You are responsible for providing the correct basis to the IRS. Keeping records of every purchase—the date, number of shares, and price—makes this easier and protects you if the IRS questions your return.
State and local taxes on capital gains
Federal capital gains tax is only part of the picture. Most states tax capital gains as ordinary income, meaning long-term gains receive no special rate at the state level. A few states—including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming—do not tax capital gains at all. Others, like California, tax long-term gains at the same rate as short-term gains.
New York City and a handful of other municipalities also impose local taxes on capital gains. The total tax on a long-term gain can easily exceed 30 percent when you combine federal, state, and local taxes, depending on where you live and your income level.
Tax-loss harvesting and timing strategies
Some investors deliberately sell losing positions late in the year to offset gains and reduce their tax bill. This is called tax-loss harvesting. You sell the losing stock, lock in the loss, and use it to reduce your capital gains tax. You can then buy a similar (but not identical) investment to maintain your portfolio allocation.
The IRS has a rule called the wash-sale rule that prevents you from buying back the same stock (or a substantially identical one) within 30 days before or after the sale. If you do, the loss is disallowed and added to the cost basis of the new purchase instead. This rule exists to prevent people from claiming losses they have not truly realized.
Timing the sale of a winning stock to cross into the next calendar year can also matter. If you are close to a long-term holding period, waiting a few weeks to sell can mean the difference between short-term and long-term rates. Similarly, if you expect your income to be lower in the following year, selling in that year might result in a lower tax rate on the gain.
Frequently Asked Questions
Do I owe capital gains tax if I do not sell the stock?
No. You owe capital gains tax only when you sell. You can hold a stock for decades and owe nothing as long as you do not sell it, even if its value increases tenfold. Tax is due in the year you actually sell.
What if I inherited stock from someone?
Inherited stock receives a "step-up in basis," meaning your cost basis is the stock's value on the date of death, not what the original owner paid. If you inherit stock worth $10,000 and it was worth $3,000 when the owner bought it, your basis is $10,000. If you sell immediately, you owe no capital gains tax.
Can I deduct capital losses from my salary or wages?
Only up to $3,000 per year. If your capital losses exceed your capital gains by more than $3,000, you can deduct $3,000 against your other income. The remaining loss carries forward to future years and can be used the same way.
How do I know if I held the stock long enough for the long-term rate?
Count from the day after you bought to the day you sold. If more than one year has passed, it qualifies as long-term. Your broker's records show the exact purchase and sale dates, and your 1099-B will indicate which sales are long-term and which are short-term.
Do dividend payments count as capital gains?
No. Dividends are taxed separately as ordinary income or may have access to dividends (at preferential rates), not as capital gains. Capital gains apply only to the profit from selling the stock itself.