Compute federal tax owed on capital gains, including both short-term and long-term rates and the Net Investment Income Tax for high earners.
Total capital gains tax
—
LTCG tax
—
STCG tax (ordinary rate)
—
NIIT (3.8% if applicable)
—
Effective rate on gains
—
Worked example
Take a single filer with $90,000 of ordinary income who sells a long-held investment for a $30,000 long-term capital gain and has no short-term gains. Long-term gains stack on top of ordinary income to decide which capital-gains band they fall in. For 2026 single filers, the 0% band runs up to $48,350 and the 15% band up to $533,400. Because the $90,000 of ordinary income already fills the 0% band, the entire $30,000 gain lands in the 15% band, so the long-term tax is $30,000 times 15%, which is $4,500. There are no short-term gains, so nothing is taxed at ordinary rates here. The Net Investment Income Tax only applies once modified income tops $200,000 for a single filer, and total income here is $120,000, so no NIIT is owed. Total tax on the gain is $4,500, an effective rate of 15%, leaving $25,500 after tax.
| Item | Amount |
|---|---|
| Ordinary income (stacking base) | $90,000 |
| Long-term capital gain | $30,000 |
| LTCG rate that applies | 15% |
| Long-term capital gains tax | $4,500 |
| NIIT (income below $200k) | $0 |
| After-tax proceeds on gain | $25,500 |
How it is calculated
The United States taxes long-term and short-term capital gains very differently. Assets held more than a year qualify for preferential long-term rates of 0%, 15%, or 20%, with the band determined by stacking the gain on top of your ordinary income. Assets held a year or less are short-term and are taxed at your ordinary marginal income-tax rate, which the tool finds by measuring the extra income tax those gains add to your return. On top of either, high earners may owe the 3.8% Net Investment Income Tax once modified adjusted gross income exceeds $200,000 single or $250,000 joint, applied to the lesser of net investment income or the amount over the threshold. The effective rate shown is total tax divided by total gains, which blends the long-term, short-term, and NIIT pieces. State capital-gains tax is not included.