Stocks, ETFs & funds · 2026 tax year
Capital Gains Tax on Stocks
See what you'll owe when you sell shares, ETFs, or index funds — short-term vs long-term, the 0/15/20% federal rate, the 3.8% NIIT, and your state tax.
Short answer
Sell a stock within a year and the gain is short-term, taxed like your salary. Hold it over a year and it's long-term, taxed at 0%, 15%, or 20%. Sales inside a 401(k) or IRA aren't taxed — this applies to a taxable brokerage account. Enter your numbers below.
Your after-tax gain
$14,340.00
$5,660.00 total tax · 28.3% effective · long-term
- Capital gain
- $20,000
- Federal capital gains tax
- −$3,000.00
- Net Investment Income Tax (3.8%)
- −$0.00
- State tax
- −$2,660.00
- Total tax
- −$5,660.00
2026 long-term capital gains tax brackets
Held your shares more than a year? The long-term rate depends on your total taxable income:
| Long-term rate | Single | Married filing jointly | Head of household |
|---|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 | Up to $66,200 |
| 15% | $49,450 – $545,500 | $98,900 – $613,700 | $66,200 – $579,600 |
| 20% | Over $545,500 | Over $613,700 | Over $579,600 |
Frequently asked questions
How much tax do I pay when I sell stock?+
It depends on how long you held the shares. Sell within a year of buying and the gain is short-term, taxed at your ordinary income rate (10%–37%). Hold for more than a year and it's long-term, taxed at 0%, 15%, or 20% based on your taxable income — often far less. High earners add the 3.8% NIIT, and most states tax the gain as ordinary income too. Your gain is the sale proceeds minus your cost basis (what you paid plus commissions).
How is cost basis calculated for stocks?+
Cost basis is what you paid for the shares, including any brokerage commissions, plus reinvested dividends (which were already taxed, so they add to basis). If you bought in lots at different prices, your broker tracks each lot; selling specific lots (specific-identification) instead of first-in-first-out can lower your gain. Basis also adjusts for stock splits. Your broker reports basis on Form 1099-B.
Do I pay capital gains tax inside my 401(k) or IRA?+
No. Sales inside a tax-advantaged account — a 401(k), traditional IRA, or Roth IRA — don't trigger capital gains tax. In a traditional account you're taxed as ordinary income only when you withdraw; in a Roth, qualified withdrawals are tax-free. Capital gains tax only applies to stocks held in a regular taxable brokerage account, which is what this calculator estimates.
Can I use stock losses to lower my tax?+
Yes — this is tax-loss harvesting. Losses first offset your capital gains dollar-for-dollar, then up to $3,000 of ordinary income per year, with any remainder carried forward. Watch the wash-sale rule: if you rebuy the same or a substantially identical security within 30 days, the loss is disallowed. Selling losers to offset winners in the same year is a common way to cut the bill.
What about dividends — are they capital gains?+
Dividends aren't capital gains, but qualified dividends are taxed at the same favorable 0/15/20% long-term rate. Ordinary (non-qualified) dividends are taxed at your regular income rate. This calculator handles the gain from selling shares; dividends are taxed separately when they're paid, whether or not you sell.
Selling a house instead? See the capital gains tax on real estate page, or the main capital gains tax calculator.
This is an estimate, not tax advice. It doesn't model wash sales, specific-lot selection, or the AMT. Confirm with a tax professional or your 1099-B before relying on it.