What capital gains tax on stocks is
Selling shares for more than you paid creates a capital gain — and the tax on it depends on how long you held the shares and how much other income you have. Held more than a year, the gain is long-term and taxed at 0%, 15% or 20%. Held a year or less, it is short-term and taxed like wages. Five steps: the gain, the bands, the NIIT, the state tax, and the total.
Step 1: Work out the gain
The gain is the number of shares times the difference between the sell price and the buy price. On 200 shares bought at $50.00 and sold at $80.00, the gain is $6,000.00. At $120.00 the gain is $14,000.00. At $200.00 it is $30,000.00. At $2,500.00 it is $490,000.00. With 1,000 shares the gain is $30,000.00. At $50.00 the gain is $0.00. At $40.00 it is -$2,000.00, a loss, and there is no tax at all.
Step 2: Put the gain through the bands
The 2026 long-term rates are 0%, 15% and 20% (IRS Revenue Procedure 2025-32), and the gain stacks on top of your other taxable income. Single: 0% through $49,450.00, 15% through $545,500.00; married filing jointly: $98,900.00 and $613,700.00. With $80,000.00 of other income the 0% band is already full, so the whole $6,000.00 falls in the 15% band: the tax is $900.00. With $30,000.00 of other income, $19,450.00 of 0% room is left — more than the gain — so the tax is $0.00. Married filing jointly, $80,000.00 of other income leaves $18,900.00 of 0% room, so the tax is $0.00 too. With $545,500.00 of other income the whole gain is pushed into the 20% band and the tax is $1,200.00.
Step 3: Short-term is taxed like wages
Sell within a year and the gain is short-term, taxed at the ordinary rates: single 10% to $12,400.00, 12% to $50,400.00, 22% to $105,700.00, 24% to $201,775.00, 32% to $256,225.00, 35% to $640,600.00, 37% above. On the same $6,000.00 gain, the short-term tax is $1,320.00 — $420.00 more than the $900.00 long-term tax — because the whole gain falls in the 22% band. With $100,000.00 of other income and a $300.00 sell price, the gain is $50,000.00: $5,700.00 falls in the 22% band ($1,254.00) and $44,300.00 in the 24% band ($10,632.00), so the tax is $11,886.00.
Step 4: Add the 3.8% NIIT when it applies
The net investment income tax adds 3.8% on the gain once your MAGI — other taxable income plus the gain — passes $200,000.00 single ($250,000.00 married filing jointly). On the defaults, MAGI is $86,000.00, below the threshold, so the NIIT is $0.00. At a $2,500.00 sell price, MAGI is $570,000.00 and the NIIT is $14,060.00. With $545,500.00 of other income, MAGI is $551,500.00 and the NIIT is $228.00.
Step 5: Add state tax and work out what you keep
State tax is the gain times your state rate: at 5% it adds $300.00, so the total tax is $1,200.00. The total tax is the federal tax plus the NIIT plus the state tax: on the defaults, $900.00 + $0.00 + $0.00 = $900.00. The effective rate is 15.00%. The sale proceeds are $16,000.00 and the after-tax proceeds are $15,100.00.
The worked example
Single filer, 200 shares, $50.00 buy, $80.00 sell, long-term, $80,000.00 other income, 0% state rate. Step 1: the gain is $6,000.00. Step 2: the 0% band is full, so the whole $6,000.00 falls in the 15% band and the tax is $900.00. Step 3: long-term, so the short-term rates do not apply. Step 4: MAGI is $86,000.00, below the $200,000.00 threshold, so the NIIT is $0.00. Step 5: the total tax is $900.00 and the after-tax proceeds are $15,100.00. Rounding convention: totals are computed from unrounded values, so rounded parts may differ by a cent from their rounded sum.
Working backwards
The sell price for $1,500.00 of tax is $100.00; at $99.99 the tax is $1,499.70, at $100.01 it is $1,500.30. The shares for $3,000.00 of tax are 666.67 (exact 666.6667); at 666.67 shares the tax is $3,000.02 (unrounded $3,000.0150), at 666.66 shares it is $2,999.97. The other income for $0.00 tax is $43,450.00; at that income the tax is $0.00, at $1 more it is $0.15. The sell price for $10,000.00 of tax is $383.33 (exact 383.3333); at $383.33 the tax is $9,999.90, at $383.34 it is $10,000.20. The state rate for $1,800.00 total is 15.00%; at that rate the total tax is $1,800.00. The buy price for $0.00 tax at a $80.00 sell price is $80.00; at that buy price the tax is $0.00, at $79.99 it is $0.30.
What changes the answer most
Sell price moves the answer most: $50.00 gives $0.00 tax; $80.00 gives $900.00; $120.00 gives $2,100.00; $200.00 gives $4,500.00; $2,500.00 gives $88,785.00, with $24,500.00 taxed at 20% and $14,060.00 of NIIT. Holding period is second: the same $6,000.00 gain costs $900.00 long-term and $1,320.00 short-term. Other income is third: $30,000.00 gives $0.00, $80,000.00 gives $900.00, $545,500.00 gives $1,428.00.
Losses and the $3,000 limit
A loss is not taxed, and it can cut the tax on other gains — up to $3,000.00 a year against ordinary income, with the rest carried forward. At a $40.00 sell price the loss is $2,000.00, inside the $3,000.00-a-year limit, so the whole loss is deductible in the year of the sale. At a $0.00 sell price the loss is $10,000.00: $3,000.00 is deductible this year and $7,000.00 carries forward.
What not to do
Do not sell just before the one-year mark if you can wait: the same $6,000.00 gain costs $1,320.00 short-term and $900.00 long-term. Do not forget the NIIT: at $2,500.00 a share it adds $14,060.00 on top of the $74,725.00 federal tax. Do not sell in a high-income year if you can wait: a year with $30,000.00 of other income instead of $80,000.00 cuts the tax from $900.00 to $0.00.
How this connects
To run your own numbers, use the capital gains tax on stocks calculator. For the bracket detail, see the 2026 capital gains tax brackets, and for the home-sale version, see the capital gains tax on home sale calculator.
Bright Side Kit. "How to Calculate Capital Gains Tax on Stocks: A Guide" https://brightoolbox.com/guides/how-to-calculate-capital-gains-tax-on-stocks/ Accessed October 25, 2026.