Profession Calculators
Tax & PayrollPopular

Capital Gains Tax Calculator

Calculate short-term and long-term capital gains tax with 2026 federal rate thresholds, NIIT (3.8%), state tax, and net proceeds after all taxes.

Share:

Wages, business income, etc. Used to determine your capital gains bracket and NIIT applicability.

Most states tax capital gains as ordinary income. Enter 0 for no-income-tax states (TX, FL, WA, etc.).

Your Results

$

Enter purchase and sale details to calculate.

Embed This Calculator on Your Website

Add this free calculator to your blog, website, or CMS with a simple copy-paste embed code.

Introduction

Selling an investment without calculating the tax first is like negotiating a salary without knowing the take-home. A single day can change your federal rate from 37% to 20%. Hold a stock for 366 days instead of 365, and a $50,000 gain that would cost $18,500 in federal tax at the short-term ordinary rate instead costs $7,500 at the 15% long-term rate -- a difference of $11,000 from one extra day of patience. The IRS Publication 550 governs investment income taxation and the rules are not simple: long-term vs. short-term classification, the 3.8% Net Investment Income Tax for high earners, the stepped-up basis rules for inherited assets, depreciation recapture on real estate, and state capital gains taxes that in California add another 13.3% on top. This calculator handles federal long-term and short-term capital gains, the NIIT surtax, and your state rate -- giving you the full after-tax picture before you hit sell.

What This Calculator Does

This capital gains tax calculator estimates total federal and state tax on profits from selling investments, real estate, or other capital assets. It distinguishes between short-term gains (held one year or less, taxed as ordinary income at rates up to 37%) and long-term gains (held over one year, taxed at 0%, 15%, or 20% based on income). It accounts for the 3.8% Net Investment Income Tax (NIIT) on high earners, state capital gains tax at your entered rate, and produces: total tax owed, net after-tax proceeds, and effective rate on the gain.

The Formula

Capital Gain = Sale Price - Cost Basis | Federal CG Tax = Gain x Applicable Rate | NIIT = 3.8% x Min(Net Investment Income, MAGI above threshold) | Net Proceeds = Sale Price - Federal Tax - NIIT - State Tax

Long-term capital gains rates for 2026: 0% for single filers with taxable income up to $48,350, 15% up to $533,400, and 20% above. The gain does not trigger ordinary income rates -- it is stacked on top of ordinary income to determine which bracket applies. Short-term gains are added to ordinary income and taxed at marginal rates up to 37%. The NIIT of 3.8% applies to the lesser of net investment income or modified AGI above $200,000 (single) or $250,000 (married filing jointly) -- thresholds that have not been inflation-adjusted since 2013. Most states tax capital gains as ordinary income.

Step-by-Step Example

1

Enter purchase and sale information

Stock purchased: 500 shares at $48 = $24,000 cost basis. Sold: 500 shares at $110 = $55,000. Capital gain: $55,000 - $24,000 = $31,000. Holding period: 14 months (long-term).

2

Determine applicable long-term rate

Other taxable income: $82,000 (single filer). Total income including gain: $113,000. This falls in the 15% long-term CG bracket (taxable income $48,350 to $533,400 for single filers). Federal CG tax: $31,000 x 15% = $4,650.

3

Apply NIIT if applicable

MAGI: $82,000 + $31,000 = $113,000. Single filer NIIT threshold: $200,000. MAGI is below threshold: NIIT = $0. If income were $210,000 with a $31,000 gain, NIIT would apply to $10,000 of the gain (gain limited by MAGI above threshold): $10,000 x 3.8% = $380.

4

Add state tax and calculate net proceeds

State tax (5% on $31,000 gain): $1,550. Total tax: $4,650 + $1,550 = $6,200. Net proceeds after all taxes: $55,000 - $6,200 = $48,800. Effective tax rate on gain: 20.0%.

Real-World Use Cases

Stock Sale Timing Decision

An investor holds a position with a $45,000 gain purchased 11 months ago. Selling now at short-term rates (22% federal + 5% state + NIIT potential) costs $12,150. Waiting 31 more days for long-term status at the 15% rate costs $9,000 -- a $3,150 savings worth the wait.

Real Estate Investment Sale

An investor sells a rental property for $420,000 with a $180,000 cost basis (original purchase) and $35,000 in improvements. Capital gain: $420,000 - $215,000 = $205,000 (long-term). At 20% + 3.8% NIIT (high earner) + 5% state: total tax $58,240. Note: depreciation recapture of $24,000 on claimed depreciation is taxed separately at 25% ($6,000 additional).

Tax-Loss Harvesting Coordination

An investor with $28,000 in long-term gains from one position identifies an unrealized loss of $18,000 in another. Harvesting the loss reduces taxable gain to $10,000, cutting federal tax from $4,200 to $1,500 (at 15%) -- a $2,700 tax reduction with no change to overall portfolio allocation if replacement securities comply with wash sale rules.

Comparison

Holding PeriodTax TreatmentFederal Rate (Single, $80K income)Example Tax on $30K Gain
365 days or less (short-term)Ordinary income rates22% marginal$6,600
366+ days (long-term)Preferential CG rates15%$4,500
Long-term, high earner (>$533K single)Top CG rate20%$6,000
Long-term + NIIT (MAGI >$200K)15% + 3.8%18.8%$5,640
Long-term + NIIT + top bracket20% + 3.8%23.8%$7,140
Inherited assets (stepped-up basis)Long-term on post-death gain0% to 20%Depends on post-death gain only

Common Mistakes to Avoid

  • Selling before the one-year mark without calculating the rate difference. The gap between short-term (up to 37%) and long-term (0-20%) is the single most controllable variable in investment tax planning. Even a few weeks' difference in holding period can save thousands.

  • Forgetting the 3.8% NIIT threshold. High earners with modified AGI above $200,000 (single) or $250,000 (married) pay an additional 3.8% on investment income. The effective long-term rate for these taxpayers is 23.8%, not 20%.

  • Using the wrong cost basis. Stock received as a gift carries over the donor's original basis. Inherited stock receives a stepped-up basis to fair market value at the date of death, potentially eliminating a lifetime of embedded gain. Reinvested dividends add to cost basis -- failing to track this leads to overpaying tax.

  • Ignoring the primary residence exclusion for real estate. Single homeowners can exclude up to $250,000 of gain ($500,000 married filing jointly) on a primary residence under IRC Section 121 if they have owned and used it as their main home for at least two of the past five years.

Frequently Asked Questions

Accuracy and Disclaimer

Capital gains tax calculations are based on 2026 projected federal thresholds, rates, and NIIT rules. Actual tax liability depends on your complete tax situation including other income sources, deductions, credits, filing status, and state-specific rules. This calculator does not account for depreciation recapture (taxed at 25%), qualified opportunity zone deferrals, installment sale treatment, wash sale limitations, or estate and gift tax implications. Consult a licensed tax professional or financial advisor for investment tax planning.

Conclusion

Capital gains tax planning is most effective before you sell. Holding periods, loss harvesting, Roth account positioning, and income timing all affect your final tax liability significantly. After computing your capital gains tax, use the Portfolio Rebalancing Calculator to plan how selling fits into your overall allocation strategy, or the Net Worth Tracker Calculator to update your financial picture after the transaction.