finance calculator

Capital Gains Tax Calculator

Estimate tax on a sale using holding period and short vs long-term rates.

Results

Capital gain/loss
$8,000 USD
Estimated tax
$1,200 USD
Effective rate
15.00%

Overview

Any time you sell investments like stocks, ETFs, mutual funds, or crypto for more than you paid, you may owe capital gains tax. The tricky part is that not all gains are taxed the same way: short‑term gains (on assets held one year or less) are usually taxed at your ordinary income rate, while long‑term gains (on assets held more than a year) often get a lower, preferential rate.

This capital gains tax calculator walks you through that logic. By entering what you paid (cost basis), what you sold for (sale proceeds), how long you held the asset, and your estimated short‑term and long‑term tax rates, you can quickly see your gain or loss, an estimated tax bill, and the effective tax rate on the transaction. It’s a planning tool—not a filing engine—but it gives you a clear sense of the tax impact before you click “sell.”

How to use this calculator

  1. Gather your trade details: what you originally paid for the asset (including commissions) and what you expect to receive when you sell, excluding any new fees or taxes.
  2. Estimate how many months you have held the asset from the original trade date to the planned sale date. Round to whole months using your broker’s holding period information if available.
  3. Enter your cost basis, sale proceeds, and holding period in months into the calculator.
  4. Enter an estimated long‑term capital gains rate that matches your situation (for many U.S. investors this is 0%, 15%, or 20% federally, plus any state rate you want to blend in).
  5. Enter an estimated short‑term rate equal to your marginal ordinary income rate (for example, 22% or 24%) plus any state or local tax percentage you want to include.
  6. Review the calculated gain or loss, estimated tax, and effective tax rate. For a positive gain, the tool will show whether it treated your gain as long‑term or short‑term based on the holding period you entered.
  7. Experiment with different holding periods and rate assumptions—for example, compare selling at 11 months versus 13 months—to see how crossing the one‑year line might change your estimated tax bill.

Inputs explained

Cost basis
What you paid for the asset, including purchase price and allowable transaction costs such as commissions or fees. For reinvested dividends or multiple lots, your broker may give you an average or specific‑lot basis; use the basis figure that corresponds to the shares you are selling.
Sale proceeds
The amount you expect to receive when you sell, before taxes but after normal brokerage commissions or trading fees. Many brokerage confirmations list this as the total proceeds from the sale.
Holding period (months)
The length of time, in whole months, between when you acquired the asset and when you sell it. In this simplified model, 12 or more months is treated as long‑term and less than 12 months as short‑term. For borderline cases, consult your actual trade dates or your broker’s holding period information.
Long-term rate %
Your estimated blended long‑term capital gains tax rate. For U.S. federal taxes this is usually 0%, 15%, or 20%, but you can add in your state capital gains tax (if any) to create a combined rate that better reflects your situation.
Short-term rate %
Your estimated short‑term capital gains tax rate, generally equal to your marginal ordinary income rate plus any relevant state tax. Short‑term gains are usually taxed the same as wages or interest income, so this rate is often higher than the long‑term rate.

Outputs explained

Capital gain/loss
The difference between sale proceeds and cost basis. A positive number is a gain subject to capital gains tax under your input rates; a negative number is a capital loss, which may be usable to offset other gains or, in some situations, a limited amount of ordinary income.
Estimated tax
The tax on your gain computed using either the long‑term or short‑term rate you supplied, based on whether the holding period input is 12 months or more. If the calculator shows zero tax on a loss, that does not mean the loss has no tax value; it simply means this tool does not apply a rate to negative gains.
Effective rate
The ratio of estimated tax to the positive capital gain, expressed as a percentage. This helps you see at a glance what share of your profit is going to taxes under your assumptions.

How it works

Capital gain (or loss) is the difference between your sale proceeds and your cost basis. Cost basis typically includes the purchase price plus certain transaction costs such as commissions or fees; sale proceeds are what you receive from the sale before taxes but after normal selling commissions.

If the result of sale proceeds − cost basis is positive, you have a gain. If it is negative, you have a capital loss. This calculator reports both possibilities so you can see whether you are realizing a gain or harvesting a loss.

The holding period determines whether the gain is treated as short‑term or long‑term. In a simplified model like this one, we treat 12 or more months as long‑term and anything less than 12 months as short‑term.

You provide your estimated long‑term capital gains rate (often 0%, 15%, or 20% at the federal level in the U.S.) and your short‑term rate (generally your marginal ordinary income rate, such as 22%, 24%, or 32%).

When the gain is positive, the calculator checks your holding period. If holdingMonths is 12 or more, it applies the long‑term rate you entered. If it is less than 12, it applies the short‑term rate. For losses or zero gains, estimated tax is shown as zero in this simplified model.

The effective rate is computed as Estimated tax ÷ Positive gain, expressed as a percentage, so you can see how much of the gain you are giving up in taxes under your assumptions.

Because real‑world tax systems include brackets, surcharges, and special rules (like the Net Investment Income Tax or state taxes), this tool focuses on a single blended rate that you supply rather than computing the entire tax return.

Formula

Let B = Cost basis, P = Sale proceeds.\nGain = P − B.\nIf Gain ≤ 0: Tax = 0 (loss not monetized here).\nIf Gain > 0 and HoldingMonths ≥ 12: Tax = Gain × (Long‑term rate ÷ 100).\nIf Gain > 0 and HoldingMonths < 12: Tax = Gain × (Short‑term rate ÷ 100).\nEffective rate (if Gain > 0) = Tax ÷ Gain.

When to use it

  • Checking the tax impact of selling appreciated stock, ETFs, mutual funds, or crypto before a big expense or portfolio change so there are no surprises at tax time.
  • Comparing the effect of selling now versus waiting until an investment qualifies for long‑term treatment, especially when you are close to the one‑year holding period threshold.
  • Estimating the tax cost of raising cash for a down payment, tuition, or another major goal by selling a mix of winners and losers in a taxable brokerage account.
  • Evaluating how much tax you might owe when rebalancing a portfolio that has drifted away from its target allocation, particularly when trimming highly appreciated positions.
  • Modeling the potential tax difference between harvesting a long‑term gain today versus spreading sales across multiple calendar years.
  • Teaching new investors the basic mechanics of capital gains and why holding period and tax brackets matter when planning trades.

Tips & cautions

  • Holding an investment for more than one year often reduces your tax rate on gains, but waiting is not always best—consider market risk, diversification, and your need for cash alongside tax savings.
  • Always include trading commissions and certain fees in your cost basis where allowed; failing to do so can overstate your gain and your tax bill.
  • If you have realized capital losses elsewhere in your portfolio, those may offset some or all of your gains; this calculator treats each transaction in isolation and does not net gains and losses together.
  • Federal and state tax systems use brackets and additional surtaxes such as the Net Investment Income Tax (NIIT) for high earners. To approximate this complexity, you can adjust your input rates upward slightly if you expect to land in higher brackets.
  • Before executing a very large sale, consider running multiple scenarios with different rate assumptions or asking a tax professional to sanity‑check your estimates, especially if the sale could push you into a new bracket.
  • Remember that retirement accounts like traditional IRAs, 401(k)s, and many employer plans typically do not trigger capital gains tax when you trade inside the account; taxation happens when you withdraw. This tool is best suited for taxable brokerage accounts.
  • This calculator uses a single blended long‑term and short‑term rate that you provide; it does not compute bracketed taxes, phaseouts, or additional surtaxes like the Net Investment Income Tax automatically.
  • It does not model state or local tax systems separately. If you want state taxes included, you must fold those percentages into the long‑term and short‑term rates you enter.
  • Treatment of specific assets can vary by country and by asset class (for example, collectibles, futures, or certain real estate investments). This simplified tool assumes standard capital asset treatment in a generic tax system.
  • Wash‑sale rules, specific‑lot selection, dividend reinvestment, corporate actions, and return‑of‑capital distributions can all affect your true cost basis; this calculator assumes the cost basis number you enter is already correct.
  • Timing details such as trade settlement dates, record dates, or end‑of‑year cutoffs are not modeled; we simply use your holding period in months to choose between long‑ and short‑term treatment.
  • Nothing here should be taken as personalized tax, legal, or investment advice. Always consult official tax guidance and, where appropriate, a qualified professional before making large financial decisions.

Worked examples

Example 1: Long-term stock sale

  • You bought shares for a total cost basis of $20,000 and later sell them for $28,000 after holding them for 18 months.
  • Gain = 28,000 − 20,000 = $8,000.
  • HoldingMonths = 18, so the gain is treated as long‑term. Suppose your blended long‑term rate is 15%.
  • Estimated tax ≈ 8,000 × 0.15 = $1,200.
  • Effective rate = 1,200 ÷ 8,000 = 15%. You keep roughly $6,800 after tax (ignoring other factors).

Example 2: Short-term crypto trade

  • You buy a crypto asset for $5,000 and sell it six months later for $7,500.
  • Gain = 7,500 − 5,000 = $2,500.
  • HoldingMonths = 6, so this is short‑term. Assume your marginal income rate plus state is 24%.
  • Estimated tax ≈ 2,500 × 0.24 = $600.
  • Effective rate = 600 ÷ 2,500 = 24%. You keep about $1,900 of the gain after tax.

Example 3: Harvesting a capital loss

  • You bought an ETF for $15,000 and later sell it for $12,000 after 14 months to harvest a loss.
  • Gain = 12,000 − 15,000 = −$3,000 (a loss).
  • The calculator will show a negative gain (loss) and an estimated tax of $0 in this simple model.
  • In reality, that $3,000 capital loss may be available to offset other capital gains and, in some jurisdictions, up to a limited amount of ordinary income. This tool highlights the loss but does not apply complex tax‑loss rules automatically.

Deep dive

Estimate capital gains tax on an investment sale by entering cost basis, sale proceeds, holding period, and your long‑term and short‑term tax rates. See your gain or loss, an estimated tax bill, and the effective tax rate on the trade.

Use this capital gains tax calculator to compare selling now versus waiting for long‑term treatment, understand the impact of rebalancing or cash‑raising trades, and avoid unpleasant surprises at tax time.

Ideal for taxable brokerage accounts, this tool highlights the difference between short‑term and long‑term capital gains and helps investors translate price moves into after‑tax outcomes.

FAQs

How do I pick the right long-term and short-term rates to enter?
Start with your current marginal tax bracket and published long‑term capital gains brackets for your country. For U.S. investors, long‑term rates are often 0%, 15%, or 20% plus a possible 3.8% Net Investment Income Tax for high earners, while short‑term gains are taxed at your ordinary income rate. You can blend in state or local taxes by adding their percentages to your federal estimates.
Does this calculator handle multiple lots or partial sales?
It treats each run as a single aggregated position with one cost basis and one sale proceeds figure. If you are selling specific lots with different purchase dates and prices, you can either run the calculator separately for each lot or compute a weighted average basis and holding period based on your broker’s records.
What about wash-sale rules or buying back the asset after selling?
Wash‑sale rules, where applicable, can disallow or defer certain losses if you buy back a substantially identical security within a short window. This calculator does not model wash‑sale adjustments; it simply reports the difference between sale proceeds and the cost basis you provide.
Can I use this for real estate, collectibles, or other special assets?
Some asset classes—such as real estate, collectibles, futures, or certain business interests—have special holding period rules, depreciation recapture, or different tax rates. This calculator assumes standard capital asset treatment, so use caution and consult a professional before applying its outputs to those more complex situations.
Is this capital gains calculator a substitute for tax software or a CPA?
No. It is designed for quick planning and education. For actual tax filing, you should rely on tax software, official forms and instructions, or a qualified tax professional who can account for your full income picture, deductions, credits, and local rules.

Related calculators

This capital gains tax calculator provides simplified estimates based on user‑entered cost basis, sale proceeds, holding period, and tax rates. It does not compute full tax returns, apply all relevant rules, or account for every type of asset or jurisdiction. Treat the results as rough planning numbers only and consult official guidance or a qualified tax professional before making significant investment or tax decisions.