Skip to main content

    Federal tax on a sale

    Capital Gains Tax Calculator

    This capital gains tax calculator estimates the federal tax on a stock, ETF or fund sale from your cost basis, sale amount, dates and other income. It works as a long term capital gains tax calculator and a short-term one: your buy and sell dates set the holding period, and the results show the tax for both.

    Free to use. No account or sign-up needed.

    Your sale

    What you paid for the shares, fees included.

    What you received for the shares, after fees.

    The day you bought the shares.

    The day you sold, or plan to sell.

    Filing status

    The status on your federal return.

    Wages and other income for the year before deductions, without this sale. The calculator takes off the 2026 standard deduction for your filing status.

    Estimated tax

    ResultValue
    Estimated federal tax$2,250
    Your gain$15,000
    Holding periodLong-term, 458 days
    2026 standard deduction$16,100
    Capital gains tax$2,250
    Net investment income tax$0.00
    Gain after tax$12,750
    Tax as a share of the gain15.00%
    If sold within one year$3,300, $1,050 more

    Selling for $35,000 after paying $20,000 gives a $15,000 long-term gain. With $75,000 of other income, filing single, the estimated federal tax is $2,250, leaving $12,750.

    How your gain is taxed

    RatePart of your gainTax
    0%$0.00$0.00
    15%$15,000$2,250
    20%$0.00$0.00

    Long-term gains stack on top of your taxable income, so each part is taxed at the rate of the band it falls in.

    2026 long-term capital gains rates

    RateSingleMarried filing jointly
    0%Up to $49,450Up to $98,900
    15%Over $49,450, up to $545,500Over $98,900, up to $613,700
    20%Over $545,500Over $613,700

    Amounts are taxable income, gains included. These rates and the standard deduction come from IRS Revenue Procedure 2025-32.

    How capital gains tax works

    A capital gain is what you receive for an asset above what you paid for it. The gain is the sale amount after fees minus your cost basis, the price you paid plus fees. Shares held more than one year give a long-term gain, and shares held one year or less give a short-term gain.

    Long-term gains are taxed at 0%, 15% or 20%, depending on your taxable income. The gain is stacked on top of your other taxable income, so the part that fits under the 0% limit owes nothing, the part up to the 15% limit owes 15% and the rest owes 20%. Short-term gains are taxed as ordinary income at your bracket rates.

    The calculator starts from your other income before deductions and takes off the 2026 standard deduction, $16,100 single or $32,200 joint. When your other income is below it, what is left of the deduction covers part or all of the gain, as it does on a tax return.

    The IRS worksheet also figures the tax with the gain at ordinary rates and charges the lower of the two. That can matter just above the top of the 0% band, where the ordinary rate can be below 15%, and the calculator does the same.

    In words, the long-term tax multiplies each part of the gain by the rate of the band it falls in and adds the results. The short-term tax is the tax on your income with the gain minus the tax on your income without it.

    Capital gains rates for 2026

    For 2026, single filers pay 0% on long-term gains up to $49,450 of taxable income, 15% up to $545,500 and 20% above. Married couples filing jointly pay 0% up to $98,900, 15% up to $613,700 and 20% above.

    Short-term gains use the ordinary brackets, from 10% to 37%. These figures come from IRS Revenue Procedure 2025-32, and the table under the calculator lists the long-term bands for both filing statuses.

    A worked example

    Say you file single with $75,000 of income before deductions. You bought shares for $20,000 on Mar 14, 2025 and sold them for $35,000 on Jun 15, 2026, 458 days later. They turned long-term on Mar 15, 2026, so the $15,000 gain is long-term.

    The 2026 standard deduction of $16,100 leaves $58,900 of taxable income, already above $49,450, the top of the single 0% band, so the whole gain is taxed at 15%: $2,250. The estimated modified adjusted gross income is $90,000, below the net investment income tax line, so you keep $12,750 and the tax is 15.00% of the gain.

    Sold on or before Mar 14, 2026, the same gain is short-term and taxed at 22% as ordinary income: $3,300, $1,050 more.

    At $60,000 of income, $43,900 after the deduction, $5,550 of the gain fits in the 0% band and $9,450 is taxed at 15%: $1,418. Married filing jointly at $75,000, the $32,200 deduction leaves $42,800 taxable, so the whole gain sits in the 0% band and owes $0.00.

    Long-term vs short-term

    The IRS treats a gain as long-term when you hold the asset for more than one year, and short-term when you hold it one year or less. The count starts the day after you buy, so the first long-term day is the day after the one-year anniversary of the purchase.

    Enter a planned sell date to see when a holding turns long-term. The results show the tax for the other holding period beside yours, so you can compare the two at the same gain and income.

    Gifts, inherited shares and some other assets follow different holding rules, and the calculator leaves them out.

    To see the gain or loss and the annualized return on a stock, use the stock calculator.

    Net investment income tax

    On top of the capital gains rates, the 3.8% net investment income tax applies when modified adjusted gross income is above $200,000 single or $250,000 joint. It taxes the lesser of your net investment income and the amount your income is above that line.

    The calculator does not ask for modified adjusted gross income. It estimates it as your other income plus this gain, and counts this gain as your only investment income.

    Single at $190,000 of income before deductions with the same $15,000 gain, the estimate is $205,000, so $5,000 is taxed at 3.8%: $190.00.

    Other investment income, itemized deductions or adjustments to income change the real figure, so read this line as an estimate.

    What the calculator assumes

    • Federal tax only. State and local income taxes are left out.
    • The 2026 rates and brackets apply to every sale date you enter.
    • This sale alone, with no netting against other gains or losses and no losses carried over from earlier years.
    • The 2026 standard deduction for your filing status. Itemized deductions and the extra deductions for age or blindness are left out.
    • Modified adjusted gross income for the net investment income tax is your other income plus this gain, with this gain your only investment income.
    • Stocks, ETFs and funds. Collectibles, real estate, gifts, inherited shares and other special cases follow other rules and are left out.
    • Inputs can contain errors, and results are estimates for planning. Nothing here is tax or investment advice.

    Capital gains tax calculator FAQ

    How is capital gains tax calculated?

    Subtract your cost basis from the sale amount to get the gain. A gain on shares held more than one year is taxed at 0%, 15% or 20% by taxable income, and a shorter hold at ordinary rates. Single at $75,000 of income before deductions, a $15,000 long-term gain owes $2,250.

    What are the capital gains tax rates for 2026?

    Long-term gains are taxed at 0% up to $49,450 of taxable income single and $98,900 joint, 15% up to $545,500 and $613,700, and 20% above. Short-term gains are taxed at the ordinary rates of 10% to 37%.

    How long do you have to hold a stock to pay long-term capital gains tax?

    More than one year. The count starts the day after you buy, so shares bought on Mar 14, 2025 turn long-term on Mar 15, 2026. Sold on or before Mar 14, 2026, the gain is short-term. Gifts and inherited shares follow other rules.

    How much is short-term capital gains tax?

    A short-term gain is taxed as ordinary income at your bracket rates, 10% to 37% in 2026. Single at $75,000 of income before deductions, a $15,000 short-term gain owes $3,300, against $2,250 if held more than one year.

    How do I calculate long-term capital gains tax?

    Stack the gain on top of your other taxable income. The part inside the 0% band owes nothing, the part up to the 15% limit owes 15% and the rest owes 20%. Single at $60,000 of income before deductions, a $15,000 gain owes $1,418.

    Do capital gains push you into a higher tax bracket?

    A long-term gain does not raise the rate on your other income, because it sits on top and is taxed at its own rates, though part of it can reach a higher capital gains band. A short-term gain adds to ordinary income, so it can fill higher brackets.

    Does the 3.8% net investment income tax apply to capital gains?

    Yes, when modified adjusted gross income is above $200,000 single or $250,000 joint. It taxes the lesser of the gain and the income above that line. Single at $190,000 of income before deductions, a $15,000 gain adds an estimated $190.00.

    Is this capital gains tax calculator free?

    Yes. It runs in your browser with no account and no sign-up. A free GNG account adds the Portfolio Tracker, where you can follow your own holdings.

    Track your own holdings in the Portfolio Tracker with a free GNG account.

    Sign Up Free

    This calculator is for education and is not tax or investment advice. Inputs can contain errors, and results are estimates of federal tax only, from the numbers you enter. Read our disclosures.