stocktax.tools
HomeGuides › Capital gains tax on stocks

Capital gains tax on stocks

When you sell a stock for more than you paid, the profit is a capital gain — and how long you held it decides whether you pay your ordinary income rate or a much lower long-term rate.

Put real numbers on this: Capital Gains Tax Calculator
Open the calculator →

What is a capital gain?

A capital gain is the profit when you sell a stock (or other asset) for more than your cost basis — usually what you paid, including commissions. Sell for less and you have a capital loss. The gain is only taxed when you realize it by selling; unrealized gains on stock you still hold are never taxed, no matter how much it has risen.

Short-term vs long-term

The single biggest lever on your tax bill is your holding period. Hold a stock for one year or less and the gain is short-term, taxed at your ordinary income rate — up to 37% federally. Hold it more than one year and it becomes long-term, taxed at the preferential rates of 0%, 15% or 20%. The clock starts the day after you buy and includes the day you sell. Crossing the one-year line, even by a single day, can cut the tax on a gain roughly in half.

The 2026 long-term brackets

Long-term capital-gains rates depend on your total taxable income. A large band of taxpayers sits in the 0% bracket — meaning long-term gains can be genuinely tax-free at the federal level up to the threshold. Above that you move into 15%, and only high incomes reach 20%. On top of the base rate, high earners may owe the 3.8% Net Investment Income Tax (NIIT), and your state may tax gains as ordinary income with no long-term discount. Because the brackets stack on your other income, the same gain can be taxed at very different rates depending on the year you realize it.

Offsetting gains with losses

Capital losses are valuable. They first offset capital gains of the same type, then the other type, and if losses still remain you can deduct up to $3,000 against ordinary income each year, carrying the rest forward indefinitely. Deliberately realizing losses to offset gains is called tax-loss harvesting. Watch the wash-sale rule: if you buy the same or a substantially identical security within 30 days before or after selling at a loss, the loss is disallowed and added to the basis of the replacement shares.

Legal ways to pay less

A few reliable moves reduce capital-gains tax without any gimmicks. Hold past one year to get the long-term rate. Harvest losses to offset gains in the same year. Use the 0% bracket in low-income years to realize gains tax-free. Choose your lots: selling specific high-basis shares (rather than the default first-in-first-out) shrinks the gain. And hold appreciated stock in tax-advantaged accounts where growth is deferred or tax-free.

A quick example

You buy 100 shares at $50 ($5,000 basis) and sell at $80 ($8,000), a $3,000 gain. Sold at 11 months, it is short-term: at a 32% rate you owe about $960. Wait past a year and, in the 15% long-term bracket, you owe $450 — the same profit, roughly half the tax. That difference is why the holding period matters more than almost anything else.

Frequently asked questions

How much is capital gains tax on stocks?

Short-term gains (held one year or less) are taxed at your ordinary income rate, up to 37%. Long-term gains (held more than a year) are taxed at 0%, 15% or 20% depending on your total taxable income, plus a possible 3.8% NIIT for high earners and any state tax.

How do I avoid capital gains tax on stocks?

You cannot avoid it entirely on a taxable sale, but you can reduce it: hold more than a year for the long-term rate, harvest losses to offset gains, realize gains in a year you are in the 0% bracket, and select high-basis lots when you sell.

Do I pay capital gains tax if I do not sell?

No. Gains are only taxed when realized by selling. Unrealized gains on stock you still hold are not taxed, which is why holding can defer tax indefinitely.

What is 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 loss is disallowed for that year and added to the cost basis of the replacement shares.

Sources & methodology

Based on standard U.S. treatment of capital gains. References: IRS Topic No. 409 (Capital Gains and Losses), Publication 550, Form 8949 and Schedule D instructions. Tax year 2026. Last updated 2026-07.

⚠️ Educational content only — not tax advice. Your actual tax depends on your full situation and current law. Confirm with a qualified professional before acting.