What you owe when you sell stocks for a profit

When you sell a stock for more than you paid for it, the profit is called a capital gain, and the federal government taxes it. The tax rate depends on how long you held the stock before selling it. If you held it for one year or less, it's taxed as ordinary income at your regular tax rate — which can be 10%, 12%, 22%, 24%, 32%, 35%, or 37% depending on your total income for the year. If you held it for more than one year, it's taxed at a lower long-term capital gains rate of 0%, 15%, or 20%, again based on your income level.

You also owe tax on the gain itself, not on the full sale price. If you bought 100 shares at $10 each ($1,000 total) and sold them at $15 each ($1,500 total), your capital gain is $500, and that's what gets taxed — not the $1,500.

Most states also tax capital gains, though the rate and rules vary. Some states have no capital gains tax at all; others tax it like ordinary income; a few have a separate capital gains tax. You'll owe both federal and state tax on the same gain unless you live in a state with no capital gains tax.

Key Takeaways

  • Stocks held for one year or less are taxed at your ordinary income tax rate (10% to 37%), while stocks held longer than one year are taxed at 0%, 15%, or 20% depending on your income.
  • You only pay tax on the profit (the difference between what you paid and what you sold it for), not the full sale price.
  • Your state may also tax capital gains, and the rate depends on which state you live in and sometimes on how long you held the stock.
  • You report capital gains on your federal tax return using Schedule D, and you must report the sale even if you had a loss.

Long-term vs. short-term capital gains rates

The difference between holding a stock for one year or less versus longer than one year is significant. Short-term capital gains (one year or less) are taxed at your ordinary income tax bracket. If you're in the 24% tax bracket, a short-term gain is taxed at 24%. If you're in the 12% bracket, it's taxed at 12%.

Long-term capital gains (more than one year) use a separate, lower rate structure. For 2024, the long-term rates are 0% for lower-income filers, 15% for middle-income filers, and 20% for higher-income filers. The exact income thresholds change each year. For example, in 2024, the 15% rate applies to single filers with income between roughly $47,000 and $518,000, but those numbers shift annually for inflation.

The holding period is measured from the day after you buy to the day you sell. If you buy on January 15 and sell on January 16 of the next year, you've held it for more than one year and may have access to for the long-term rate.

How to calculate your capital gain or loss

Start with your cost basis — the original price you paid for the stock, plus any fees or commissions. If you bought 50 shares at $20 per share and paid a $10 commission, your cost basis is $1,010 (or $20.20 per share).

Your sale proceeds are the price you sold it for, minus any commissions or fees. If you sold those 50 shares at $25 per share and paid a $10 commission, your sale proceeds are $1,240 (or $24.80 per share).

Your capital gain is the sale proceeds minus the cost basis: $1,240 − $1,010 = $230. If the sale proceeds are less than the cost basis, you have a capital loss instead. Capital losses can offset capital gains in the same year, and you can carry unused losses forward to future years.

If you bought the same stock at different times and prices, you need to track which shares you sold. You can use the "first in, first out" method (FIFO), the "specific identification" method, or other approaches. Your brokerage statement should show your cost basis automatically, but it's worth double-checking.

State capital gains taxes vary widely

Nine states have no capital gains tax at all: Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, Wyoming, and New Hampshire (though New Hampshire taxes dividends and interest, not gains). Most other states tax capital gains as ordinary income, meaning they explore their regular income tax rate to your gain.

A few states have a separate capital gains tax. California taxes long-term gains at the same rate as ordinary income. Washington state has a 7% capital gains tax on long-term gains over $250,000 (as of 2024). Oregon taxes long-term gains differently than short-term gains. The rules and rates change, so check your state's tax authority website for current rules.

If you move to a different state after selling a stock, the state where you lived when you sold it is generally the one that taxes the gain, not your new state. This matters if you're relocating.

Reporting capital gains on your tax return

You report capital gains and losses on Schedule D (Form 1040), which is part of your federal tax return. You list each sale separately: the date acquired, date sold, cost basis, sale price, and gain or loss. Your brokerage sends you a Form 1099-B in January showing all your sales from the previous year, and you use that to fill out Schedule D.

If you have both long-term and short-term gains, you calculate the net for each group separately, then combine them. If you have losses, you subtract them from gains. If losses exceed gains, you can deduct up to $3,000 of the net loss against ordinary income in that year, and carry the rest forward.

You must report the sale even if you had a loss. Losses are valuable because they reduce your tax bill, so it's important to document them.

Special situations: inherited stocks and wash sales

If you inherit a stock, the cost basis is "stepped up" to the market value on the date of death, not what the original owner paid. If your parent bought a stock at $10 and it was worth $50 when they died, your cost basis is $50. If you sell it at $55, your gain is only $5, not $45. This is a significant tax advantage.

A wash sale happens when you sell a stock at a loss and buy the same or a substantially identical stock within 30 days before or after the sale. The IRS disallows the loss deduction and adds the loss to the cost basis of the new purchase instead. This rule prevents people from claiming losses just for tax purposes while keeping the same investment.

When to consider holding longer for the lower rate

If you're close to the one-year mark, holding a few more weeks or months can save you significant tax. The difference between short-term (your ordinary rate) and long-term (0%, 15%, or 20%) can be 10 to 37 percentage points depending on your income. On a $10,000 gain, that could mean $1,000 to $3,700 in tax savings.

However, the stock price could fall while you wait, so you're balancing tax savings against investment risk. There's no universal right answer — it depends on your confidence in the stock and your tax situation. If you're uncertain, a tax professional can help you weigh the trade-off.

Frequently Asked Questions

Do I owe capital gains tax if I sell at a loss?

No, you don't owe tax on a loss. Instead, you can use the loss to offset capital gains from other sales, or deduct up to $3,000 of net losses against ordinary income. Unused losses carry forward to future years. You still report the loss on Schedule D.

What if I sold stocks through my 401(k) or IRA?

You don't owe capital gains tax on sales inside a 401(k) or traditional IRA — the gains are tax-deferred. You pay tax when you withdraw the money in retirement. In a Roth IRA, you don't pay tax on the gains at all, as long as you follow the withdrawal rules.

How does the holding period work if I buy and sell on the same day?

That's a short-term gain, taxed at your ordinary income rate. The holding period is measured from the day after purchase to the day of sale. If you buy on Monday and sell on Tuesday, you've held it one day, which is less than one year.

Can I deduct investment losses from my regular income?

Yes, but only up to $3,000 per year. If your total capital losses exceed your capital gains by more than $3,000, you can deduct $3,000 against wages, interest, or other ordinary income. The excess carries forward to future years, where you can deduct another $3,000 per year until it's used up.

Do I owe capital gains tax on stocks I haven't sold yet?

No. You only owe tax when you actually sell the stock and realize the gain. Unrealized gains — profits on stocks you still own — are not taxed. This is why some people hold stocks for decades without paying tax on the appreciation.