Home / Learn

Personal Finance

Capital Gains Tax on Stocks: A Beginner's Guide

How US capital gains tax works on stocks: short- vs. long-term gains, dividend taxes, offsetting gains with losses and the wash sale rule.

StockEngine Editorial Team

November 3, 2026

6

min read

When you sell a stock for more than you paid, the profit is a capital gain, and in a regular US brokerage account it's usually taxable. How much tax you pay depends mainly on how long you held the stock and your income. Here are the basics.

Realized vs. unrealized gains

You only owe tax when you sell. A stock that has risen but that you still hold has an unrealized gain, which isn't taxed. Your gain is the sale price minus your cost basis, which is generally what you paid including commissions.

Short-term vs. long-term

  • Short-term gains: stocks held one year or less. Taxed as ordinary income, at the same rate as your wages.
  • Long-term gains: stocks held more than one year. Taxed at lower federal rates of 0%, 15% or 20%, depending on your taxable income.

Holding a winning stock past the one-year mark can significantly reduce the tax on it. Higher earners may also owe an additional 3.8% net investment income tax, and many states tax capital gains too. The income thresholds for each rate change yearly; check IRS.gov for the current figures.

How dividends are taxed

Qualified dividends, from most US companies and many foreign ones held for a minimum period, are taxed at the lower long-term capital gains rates. Non-qualified (ordinary) dividends are taxed as regular income. Your broker reports which is which on your year-end tax forms. See dividend investing for beginners.

Using losses: tax-loss harvesting

Selling a stock for less than you paid creates a capital loss. Losses offset gains, and if your losses exceed your gains, you can deduct up to $3,000 a year against other income ($1,500 if married filing separately), carrying any remaining loss forward to future years. Selling losing positions to capture these losses is called tax-loss harvesting.

The wash sale rule

If you sell a stock at a loss and buy the same or a "substantially identical" security within 30 days before or after the sale, the loss is disallowed for now and added to the cost basis of the new shares. To harvest a loss, wait at least 31 days to buy back, or buy something different.

Avoiding tax drag

  • Use tax-advantaged accounts: gains inside IRAs and 401(k)s aren't taxed each year. See Roth vs. traditional IRA.
  • Hold for the long term to qualify for lower rates and trade less often.
  • Prefer tax-efficient funds in taxable accounts. See ETFs vs. mutual funds.

Estimate the tax on a trade with the stock profit calculator.

This article is educational and not tax or investment advice. Tax rules change and depend on your situation; check IRS.gov or a tax professional.

Frequently asked questions

How long do I have to hold a stock to pay less tax?

In the US, gains on shares held for more than one year are treated as long-term and taxed at lower federal rates than short-term gains.

Do I pay tax on stocks I haven't sold?

No. Capital gains tax applies only when you sell. Dividends, however, are generally taxable in the year you receive them in a regular brokerage account.

Can investment losses reduce my taxes?

Yes. Capital losses offset capital gains, and up to $3,000 a year of excess losses ($1,500 if married filing separately) can offset other income, with the rest carried forward. Watch the wash sale rule.

StockEngine articles are for education only and are not investment advice. Some links may be affiliate links.

Related Guides

All guides →