Capital gains tax on selling stocks

When you sell shares for more than you paid, the profit is a capital gain. How much tax you pay depends mostly on one date: whether you held the shares for more than a year.

Calculate tax on my sale

Short-term vs long-term

Shares held for a year or less produce a short-term gain, taxed as ordinary income at up to 37%. Shares held for more than a year produce a long-term gain, taxed at 0%, 15% or 20%. For a single filer earning $60,000, a $20,000 gain costs $3,750 in federal tax if sold short-term and $2,168 if sold long-term.

Cost basis

Your gain is the sale proceeds minus your cost basis: what you paid, including fees, plus any reinvested dividends. Your broker reports both on Form 1099-B. If you bought the same stock at different times, choosing which lots to sell (specific identification) can lower the gain.

Using losses

  • Losses offset gains of the same type first, then the other type.
  • Net losses beyond your gains reduce ordinary income by up to $3,000 a year ($1,500 if married filing separately).
  • Anything left carries forward to future years with no time limit.
  • Wash sale rule: if you buy the same or a substantially identical stock within 30 days before or after selling at a loss, the loss is disallowed for now and added to the basis of the new shares.

Ways people legally reduce the bill

  • Waiting past the one-year mark before selling.
  • Selling in a low-income year, when some gains may fall in the 0% bracket (up to $49,450 of taxable income for single filers in 2026).
  • Harvesting losses to offset gains.
  • Giving appreciated shares to charity instead of cash.
  • Holding investments in IRAs and 401(k)s, where trades are not taxed each year.
Track cost basis automaticallySold shares at different prices over the years? Get your exact cost basis before you fileTools like Koinly (great for crypto and stocks) and TradeLog calculate your exact cost basis and generate tax reports ready for Schedule D.Calculate cost basis →

Worked figures: $10,000 · $50,000 · $100,000. Other guides: selling a house · crypto.