Capital Gains Calculator

Calculate capital gains tax on investment sales

Educational purposes only. This calculator is for informational purposes and should not be considered financial, tax, or legal advice. Consult a qualified professional for personalized guidance.

Try an example:

Investment Details

$
$
$

Used to determine if NIIT applies (3.8% surtax)

Calculate Capital Gains Tax

Enter your purchase and sale prices to calculate your tax liability.

Capital Gains Basics

Long vs Short-Term

Assets held 1+ year qualify for lower long-term rates. Under 1 year taxed as ordinary income.

NIIT Surtax

Additional 3.8% on investment income for those earning above $200k (single) or $250k (married).

Tax-Loss Harvesting

Selling losers to offset gains can reduce tax. Unused losses carry forward indefinitely.

How This Tool Works

Capital Gains Calculator

Computing Investment Profits and Tax Liability

When you sell an investment for more than you paid, the difference is your capital gain. This profit represents the reward for taking investment risk, but it also creates a tax obligation that varies dramatically based on how long you held the asset and your overall income level. The capital gains calculator transforms raw purchase and sale prices into actionable tax estimates, helping you understand what you will actually keep after taxes before you commit to selling.

Many investors focus solely on whether an investment has appreciated, ignoring the tax bite that reduces their actual return. An investment showing 50% gains might deliver only 40% after federal taxes, or even less when state taxes apply. The calculator reveals this after-tax reality, enabling comparison between selling now versus holding longer, or between selling different positions with varying tax implications.

Understanding your true after-tax gain transforms investment decisions from guesswork into strategic planning.

The Holding Period Distinction

The most consequential factor in capital gains taxation is time. The IRS draws a sharp line at one year: assets held for one year or less generate short-term capital gains, while those held longer than one year generate long-term capital gains. This seemingly simple distinction creates enormous tax differences.

Short-term capital gains receive no preferential treatment. They are taxed as ordinary income, meaning your gains face the same rates as your salary or wages. For investors in the highest federal bracket, short-term gains face 37% federal taxation plus any applicable state taxes. A $10,000 short-term gain might cost $3,700 in federal tax alone.

Long-term capital gains benefit from preferential rates specifically designed to encourage patient investing. Most taxpayers pay either 0%, 15%, or 20% on long-term gains, depending on their total taxable income. The 0% rate applies to lower-income taxpayers whose total income remains below approximately $47,000 for single filers or $94,000 for married couples filing jointly. The 15% rate covers the broad middle, while the 20% rate applies only to high earners.

The calculator determines your applicable rate based on filing status and income, showing exactly how holding period affects your tax bill.

Understanding Cost Basis

Your capital gain equals sale proceeds minus cost basis. While this sounds straightforward, cost basis determination often proves more complex than investors expect. Getting it wrong means either overpaying taxes or risking IRS penalties for underreporting.

For simple stock purchases, cost basis equals the purchase price plus any commissions or fees paid to acquire the shares. If you bought 100 shares at $50 per share with a $10 commission, your total cost basis is $5,010, not $5,000.

Mutual fund investors face additional complexity when dividends and capital gains distributions are reinvested. Each reinvestment creates a new purchase with its own cost basis. Failing to track these reinvestments results in double taxation because the distributions were already taxed when received, and failing to include them in basis means paying again when you sell.

For inherited investments, cost basis typically receives a "step-up" to fair market value at the date of death. This eliminates all gains accumulated during the original owner's lifetime, representing one of the most significant tax benefits in the code. Understanding stepped-up basis often changes the sell-versus-hold calculus for inherited positions.

The calculator accepts both purchase price and explicit cost basis inputs, accommodating various acquisition scenarios.

The Net Investment Income Tax

High-income investors face an additional 3.8% Net Investment Income Tax (NIIT) on top of regular capital gains rates. This surtax applies to the lesser of net investment income or the amount by which modified adjusted gross income exceeds threshold amounts: $200,000 for single filers or $250,000 for married couples filing jointly.

For taxpayers subject to NIIT, the effective maximum federal rate on long-term capital gains becomes 23.8% (20% base rate plus 3.8% NIIT). Combined with state taxes in high-rate states like California, total capital gains taxation can approach 37% even on long-term gains held for decades.

The calculator identifies when NIIT applies based on your income inputs, ensuring accurate total tax estimates for higher earners.

Capital Losses and Tax Offset Strategies

Not all investments appreciate. When you sell at a loss, that capital loss becomes a valuable tax asset that can offset gains elsewhere in your portfolio. Losses first offset gains of the same character: short-term losses offset short-term gains, and long-term losses offset long-term gains. Excess losses then cross over to offset the opposite character.

If your total losses exceed total gains, up to $3,000 of net capital loss can offset ordinary income each year. Any remaining losses carry forward indefinitely to future tax years, creating a tax asset that persists until fully utilized.

Strategic tax-loss harvesting involves intentionally realizing losses to offset gains elsewhere, reducing current-year tax liability while maintaining market exposure through similar investments. The calculator helps quantify the tax value of potential loss harvesting opportunities.

Filing Status and Rate Determination

Your tax filing status significantly affects capital gains rates because the income thresholds for each rate tier differ by status. Married couples filing jointly benefit from wider brackets at each rate level, while head of household filers receive thresholds between single and married rates.

Single filers reach the 15% long-term rate at approximately $47,000 of taxable income and the 20% rate at roughly $519,000. Married couples filing jointly can earn approximately $94,000 before reaching the 15% rate and $584,000 before the 20% rate applies.

The calculator adjusts all rate calculations based on your selected filing status, ensuring accurate estimates regardless of your tax situation.

Strategic Timing Considerations

Because you control when to sell investments, capital gains taxation offers planning opportunities unavailable with other income types. Waiting just a few days past the one-year holding mark can reduce federal tax rates from 37% to 15% or less, potentially saving thousands on significant gains.

Income variability creates additional timing opportunities. Selling appreciated assets during lower-income years such as between jobs, during early retirement, or during sabbaticals can capture gains at lower rates. Conversely, delaying sales until after high-income years like bonus payments or stock option exercises can avoid pushing gains into higher brackets.

Year-end timing matters too. Selling in December means tax is due the following April, while waiting until January defers the tax payment by an additional twelve months, providing time value on the tax amount.

Using the Calculator Effectively

Enter your purchase price or cost basis, the expected or actual sale price, your holding period, filing status, and any other income that affects your tax bracket. The calculator computes the capital gain, determines whether short-term or long-term rates apply, checks for NIIT applicability, and calculates your estimated federal tax.

Compare scenarios by adjusting inputs. Model the difference between selling now as a short-term gain versus waiting for long-term treatment. Estimate how additional income affects your capital gains rate. Evaluate whether a position with losses should be sold to offset gains from another sale.

For comprehensive planning, run multiple positions through the calculator to understand total capital gains tax across your planned transactions.


Capital gains represent investment success, but taxes claim a portion of that success. The calculator quantifies exactly what you keep after federal taxation, enabling strategic decisions about when to sell, which positions to sell first, and how to minimize the tax bite on your investment profits. Understanding after-tax returns, not just gross gains, leads to better investment decisions.