Capital Gains Tax Calculator

How much of a stock sale goes to federal tax? Enter your purchase price, sale price, holding period, filing status, and taxable income for an estimate of the tax owed, the effective rate, and what is left over. Covers short-term and long-term gains for every filing status.

Updated

Educational purposes only.

This is an estimate for federal taxes only. State taxes, the 3.8% Net Investment Income Tax, and other factors are not included. Consult a tax professional for your specific situation.

Educational purposes only. These calculators illustrate concepts and do not constitute investment advice. Read our disclaimer

StockCram is not a broker-dealer, investment adviser, or financial institution. All content is for educational and informational purposes only and should not be construed as personalized investment advice. Consult a qualified financial professional before making investment decisions. Past performance does not guarantee future results.
Embed this calculator on your site

Free to use on any site, including in a classroom. Please keep the attribution link.

<iframe
  src="https://www.stockcram.com/embed/calculators/capital-gains-tax-calculator"
  title="Capital Gains Tax Calculator"
  width="100%"
  height="720"
  style="border:1px solid #e5e7eb;border-radius:12px;max-width:100%"
  loading="lazy"
></iframe>
<p style="font-size:12px">
  <a href="https://www.stockcram.com/tools/calculators/capital-gains-tax-calculator" target="_blank" rel="noopener">Capital Gains Tax Calculator</a>
  by <a href="https://www.stockcram.com" target="_blank" rel="noopener">StockCram</a>
</p>

What is Capital Gains Tax?

Capital gains tax applies to profit from selling an asset, and US federal law splits it in two. Assets held one year or less are taxed at ordinary income rates; assets held longer fall under a separate long-term schedule with its own, generally lower, rates.

The formula

Taxable gain = sale proceeds − cost basis; Tax = taxable gain × applicable rate
  • cost basis = purchase price plus commissions, adjusted for splits and reinvested distributions
  • applicable rate = ordinary income rate if held ≤ 1 year, long-term rate if held > 1 year

200 shares bought at $30 and sold at $50 produce $10,000 of proceeds against a $6,000 basis, a $4,000 gain. Held eleven months, that $4,000 is added to ordinary income and taxed at the filer's marginal rate. Held thirteen months, it is taxed instead under the long-term schedule. Same trade and same profit, with the tax treatment decided by the calendar.

The one-year boundary

The holding period runs from the day after the purchase trade date to the trade date of the sale. More than one year is long-term; exactly one year or less is short-term. The one-year mark is what separates the two rate schedules.

Short-term gains carry no preferential treatment at all — they stack on top of wages and are taxed at the filer's marginal ordinary rate. Long-term gains use a separate schedule structured in three brackets, commonly 0%, 15% and 20%, with the applicable bracket depending on taxable income and filing status.

How the long-term brackets behave

Long-term capital gains are taxed in layers rather than at a single rate. Gains fill the 0% band first, then the 15% band, then 20%, in the same way ordinary income moves through its brackets. Crossing into a higher band does not reprice the gains already taxed in a lower one.

The gain is also stacked on top of ordinary income when working out which band applies. That means wages influence the rate paid on investment gains even though the two are taxed under different schedules.

A separate 3.8% net investment income tax applies to investment income above a modified adjusted gross income of $200,000 for single filers and heads of household, $250,000 for joint filers and $125,000 for married filing separately (IRS, Net Investment Income Tax). It sits on top of the capital gains rate rather than replacing it, so a filer in the 20% band above the threshold faces an effective 23.8% federal rate on the affected portion.

Long-term capital gains bands by taxable income, tax year 2026
Filing status0% up to15% up to
Single$49,450$545,500
Married filing jointly$98,900$613,700
Head of household$66,200$579,600
Married filing separately$49,450$306,850

IRS Revenue Procedure 2025-32, section 3.03, for taxable years beginning in 2026. The 20% band begins where the 15% band ends. Thresholds are measured against taxable income, not gross income, and are adjusted annually.

Losses offset gains, in a fixed order

A capital loss does not simply come off the tax bill by its own amount. It is applied in a set sequence, and only a capped slice of it ever reaches ordinary income in a single year.

  • Short-term losses offset short-term gains first.
  • Long-term losses offset long-term gains first.
  • Whatever is left over then crosses to offset the other type of gain.
  • Anything still remaining may be deducted against ordinary income, up to $3,000 a year ($1,500 for married filing separately), with the excess carried forward indefinitely and keeping its short-term or long-term character.

The wash sale rule can disallow a loss

Selling at a loss and acquiring the same or a substantially identical security within 30 days either side of the sale disallows that loss: a 61-day window centered on the transaction.

The disallowed amount is normally added to the basis of the replacement shares, so the benefit is deferred rather than destroyed. The rule also reaches across every account belonging to the same taxpayer. Where the replacement shares are bought inside an IRA or Roth IRA, the loss is disallowed and the basis in the account is not increased, so it is lost outright rather than deferred (IRS Revenue Ruling 2008-5). That is the case people most often miss.

State treatment is separate

State tax is levied independently of the federal calculation, and the approaches differ substantially. Some states tax capital gains as ordinary income, some apply their own preferential rate, and several levy no income tax on individuals at all. Because the two systems are computed separately, a combined effective rate is the sum of both rather than a single blended figure from either.

What this calculator does not account for

  • Bracket figures are for tax year 2026 (IRS Revenue Procedure 2025-32) and are adjusted annually. Net investment income tax thresholds are as published by the IRS. Confirm current figures at irs.gov before relying on any estimate.
  • The calculation covers federal tax only. State tax is separate and varies widely.
  • A single asset and a single holding period are assumed. Multiple lots with different purchase dates need to be treated separately.
  • Wash sale adjustments, carried-forward losses from prior years and the alternative minimum tax are not applied.
  • Collectibles and certain real-estate depreciation recapture are taxed under different rules not covered here.
  • This is an educational estimate, not tax advice. Individual circumstances change the result.

The stock profit calculator gives the pre-tax result of a trade; this page applies the holding-period rules to what is left afterwards. Stock Profit Calculator

How It Works

1

Enter your trade details

Purchase price per share, sale price per share, and number of shares.

2

Select holding period

Choose long-term (held more than 1 year) or short-term (held 1 year or less).

3

Enter your tax situation

Filing status and other taxable income to determine which tax bracket applies.

4

See your estimated tax

View estimated federal tax, effective rate, and net proceeds after tax.

Frequently Asked Questions

Capital gains are the profit from selling an investment for more than you paid. If you bought a stock at $50 and sold at $75, your capital gain is $25 per share. Capital gains are taxed differently depending on how long you held the investment.

Short-term capital gains apply to investments held for one year or less and are taxed at your ordinary income tax rate (10-37%). Long-term capital gains apply to investments held for more than one year and are taxed at reduced rates (0%, 15%, or 20% depending on your income). The one-year mark is what separates the two rate schedules.

Long-term gains are taxed at 0%, 15%, or 20% based on your total taxable income and filing status. Short-term gains are added to your ordinary income and taxed at your marginal rate (10-37%). High earners may also owe an additional 3.8% Net Investment Income Tax (not included in this calculator).

Capital losses can offset capital gains dollar for dollar. If your total losses exceed your gains, you can deduct up to $3,000 of net losses against ordinary income per year. Any remaining losses carry forward to future tax years indefinitely. This is sometimes called "tax-loss harvesting."

No. This calculator estimates federal taxes only. Most states also tax capital gains, often at your state income tax rate. Some states (like California) do not offer preferential rates for long-term gains. Check your state's specific rules or consult a tax professional for a complete picture.

The NIIT is an additional 3.8% tax on investment income (including capital gains) for individuals with modified adjusted gross income above $200,000 (single) or $250,000 (married filing jointly). This calculator does not include the NIIT — add 3.8% to your estimate if you exceed these thresholds.

Learn the Terms