Capital Gains Tax Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Selling an asset for a profit? See the tax before you pull the trigger

Sell a stock, a rental, or a coin position that has appreciated, and the profit is not entirely yours to keep — a slice goes to capital gains tax. How big that slice is turns on two things you control more than you might expect: your cost basis (what you actually put in, not just the sticker purchase price) and how long you held the asset. This calculator takes the numbers from a specific sale — purchase price, sale price, the fees on both ends, any loss carryovers, a home-sale exclusion, and your holding period — and works out the taxable gain and the tax at short-term or long-term federal rates, plus a state rate if you add one.

Tax planning workspace with investment notes, forms, calculator, and capital gain figures.
Capital gains estimates depend on basis, holding period, filing assumptions, state tax, and how the sale fits the rest of the year.

Use it for a quick, educational estimate before you place a trade, sell a rental, or plan a home sale. The actual tax you owe will depend on your full tax situation and current law, so always confirm with a tax professional or official guidance.

What is a capital gain?

A capital gain is the profit you make when you sell a capital asset for more than your cost basis. Common capital assets include stocks, ETFs, mutual funds, bonds, rental property, your primary home, cryptocurrency, and collectibles.

In simple terms:

  • You have a capital gain if your net sale proceeds are higher than what you invested, after adjusting for eligible costs and improvements.
  • You have a capital loss if your net sale proceeds are lower than your adjusted investment.

Tax rules typically treat capital gains differently from wages or salary. Short-term gains are usually taxed at your ordinary income rate, while long-term gains often benefit from reduced tax rates.

Core formulas used in the calculator

This calculator follows a simplified version of common capital gains tax formulas. The basic steps are:

  1. Compute your adjusted basis.
  2. Compute your net proceeds from the sale.
  3. Find your capital gain or loss.
  4. Apply any loss carryovers and home sale exclusion.
  5. Multiply the taxable gain by your federal and state rates.

Adjusted basis

Your adjusted basis is your original purchase price plus certain purchase expenses and improvements.

In plain notation:

Adjusted basis = Purchase price + Purchase expenses / improvements

Net proceeds

Net proceeds are what you effectively receive after subtracting selling costs such as broker commissions, real estate agent commissions, and transfer fees.

Net proceeds = Sale price - Selling expenses

Capital gain before exclusions

Your preliminary gain (or loss) is:

Gain = NetProceeds AdjustedBasis

Taxable gain after adjustments

Next, the calculator subtracts capital loss carryovers and any home sale exclusion amount you enter (for example, up to $250,000 for a qualifying single taxpayer or $500,000 for certain married couples filing jointly on a primary residence, subject to IRS rules).

In simplified form:

Taxable gain = max( 0, Gain - Loss carryover - Home sale exclusion )

Estimated tax owed

Finally, the calculator multiplies the taxable gain by your short-term or long-term federal rate, plus the state rate (if you enter one):

Tax = TaxableGain × ( r + s )

where r is your federal rate (short-term or long-term, as appropriate) and s is your state rate. Rates are entered as percentages in the calculator and converted to decimals in the math.

How to use this Capital Gains Tax Calculator

  1. Enter purchase information
    • Purchase Price: What you originally paid for the asset.
    • Purchase expenses/improvements: Include broker commissions on purchase, closing costs on a property, and qualifying capital improvements.
    • Purchase date (optional): The date you acquired the asset.
  2. Enter sale information
    • Sale Price: The gross amount you receive when you sell.
    • Selling expenses: Broker commissions, listing fees, escrow fees, transfer taxes, and similar costs.
    • Sale date (optional): The date you sell the asset.
    • Holding period (years): If you do not enter exact dates, you can enter your approximate holding period here. A value at or below one year typically indicates short-term; over one year indicates long-term.
  3. Adjust for special items
    • Capital loss carryover: Prior-year net capital losses you have not yet used on your tax return.
    • Home sale exclusion amount: For a qualifying sale of a primary residence, enter the amount of gain you expect to exclude (for example, $250,000 or $500,000, subject to IRS rules).
  4. Enter filing status and income
    • Filing status: Single, Married filing jointly, Married filing separately, or Head of household.
    • Taxable income before this sale: Your estimated taxable income from all other sources, which helps you select appropriate federal long-term capital gains brackets if you are comparing rates.
  5. Specify tax rates
    • Short-Term Federal Rate: An estimate of your marginal ordinary income tax rate.
    • Long-Term Federal Rate: An estimate of your long-term capital gains rate based on your income and filing status.
    • State tax rate: Your state marginal rate on capital gains, if applicable.
  6. Run the calculation
    • Click Calculate to see your estimated taxable gain, total tax, and after-tax proceeds.
    • Use Copy Results to keep a record or share the estimate with a financial or tax advisor.

Reading the estimate: gain, tax bill, and what you keep

The results table walks the sale from raw profit down to cash in hand, but three numbers carry most of the weight:

  • Taxable gain after adjustments: what is left of your profit once basis, fees, loss carryovers, and any home-sale exclusion have been subtracted. This is the figure the tax rates actually bite into — not the headline gain.
  • Total tax owed: federal tax at the short- or long-term rate plus state tax, if you entered one. The tool also shows the combined effective rate so you can see the two layers stacked together.
  • Net proceeds after tax: the sale price minus selling costs and the tax — the cash that actually reaches your account.

Notice that the calculator picks the federal rate for you from the built-in brackets based on your filing status and income, but it defers to a rate you type in yourself. So if you leave the long-term rate untouched, you see the bracket the tool thinks you fall into; type over it and the tool honors your number and notes the default alongside it. That makes it easy to sanity-check whether a large sale would push part of your gain from the 15% into the 20% bracket.

If the gain comes out at zero or below, you have a capital loss rather than a gain, and there is no tax to compute on this sale. Losses can offset other gains and, within limits, ordinary income — the loss-carryover field is where you feed in unused losses from prior years and watch them shrink this year's taxable gain.

A few what-if moves the tool makes easy:

  • Change the holding period from less than one year to more than one year to see the difference between short-term and long-term rates.
  • Adjust the state rate to compare moving or selling while living in a different state.
  • Modify the loss carryover field to see how fully using losses affects your tax bill.

Walking one sale through the math

Numbers make the steps concrete. Say Maya bought a stock position for $12,000 and paid $50 in brokerage fees on the way in. Two years later she sells the whole position for $20,000, paying $100 in commissions on the way out. She still has $2,000 of capital losses carried over from a bad year, her state taxes gains at 5%, and her income puts her in the 15% long-term federal bracket. Because she held for more than a year, the gain is long-term. Here is how the calculator gets from those inputs to her take-home:

Step-by-step:

  1. Adjusted basis
    • Purchase price: $12,000
    • Purchase expenses: $50
    • Adjusted basis = $12,000 + $50 = $12,050
  2. Net proceeds
    • Sale price: $20,000
    • Selling expenses: $100
    • Net proceeds = $20,000 - $100 = $19,900
  3. Capital gain before exclusions
    • Gain = $19,900 - $12,050 = $7,850
  4. Apply loss carryover
    • Loss carryover: $2,000
    • Home sale exclusion: $0 (not a primary residence)
    • Taxable gain = $7,850 - $2,000 = $5,850
  5. Compute tax
    • Federal long-term rate: 15% (0.15)
    • State rate: 5% (0.05)
    • Total rate = 0.15 + 0.05 = 0.20 (20%)
    • Estimated tax = $5,850 × 0.20 = $1,170
  6. After-tax proceeds
    • Net proceeds: $19,900
    • Estimated tax: $1,170
    • After-tax proceeds = $19,900 - $1,170 = $18,730

By changing the rates or the holding period in the calculator, the investor can see how much more tax she would pay if the same gain were short-term instead of long-term.

Comparison: short-term vs. long-term capital gains

The table below summarizes some high-level differences between short-term and long-term capital gains treatment in the U.S. federal system. Exact details depend on your filing status, income, and current law.

Feature Short-Term Capital Gains Long-Term Capital Gains
Holding period requirement One year or less More than one year
Typical federal tax rate Ordinary income tax brackets (up to the top marginal rate) Preferential 0%, 15%, or 20% brackets for most assets
Common examples Frequent stock trades, crypto trades within a year Long-term investments held for growth, many real estate holdings
Impact of taxable income Directly uses your ordinary income bracket Uses special long-term capital gains brackets based on income and filing status
Planning opportunities Timing sales to avoid pushing into a higher ordinary bracket Waiting to cross the one-year mark, managing income to qualify for lower LTCG brackets

Where this estimate stops (and real returns pick up)

A clean estimate is only as honest as the corners it admits to cutting. This tool deliberately keeps the model simple, which means it skips a fair amount of the real tax code. Keep these gaps in mind before you treat a number here as final:

  • Not personalized tax advice: Results are estimates only and do not replace advice from a CPA, EA, or other qualified professional.
  • User-supplied tax rates: The calculator relies on the federal and state tax rates you enter. It does not automatically look up current IRS brackets or state rules.
  • Single-asset focus: The tool focuses on one sale at a time. It does not automatically net multiple gains and losses across different assets for the same year.
  • Simplified state tax treatment: State tax is modeled as a flat percentage applied to your taxable gain. Many states have more complex rules.
  • No special asset classes: It does not explicitly model collectibles tax rates, depreciation recapture, Section 1250 property rules, qualified small business stock exclusions, or other specialized regimes.
  • No wash sale or straddle rules: For stocks and other securities, the calculator does not apply wash sale rules, constructive sales, or straddle rules that can affect basis and recognized loss.
  • No 3.8% Net Investment Income Tax (NIIT): The potential additional 3.8% surtax on net investment income for higher-income taxpayers is not included.
  • No Alternative Minimum Tax (AMT): The tool does not compute AMT or interact with AMT rules.
  • Home sale exclusion entered manually: For primary residence sales, you must enter the exclusion amount yourself. The calculator does not test your eligibility or automatically cap the exclusion at statutory limits.
  • Approximate holding period: If you rely on the holding period in years instead of exact dates, the classification as short-term vs. long-term is approximate for planning scenarios only.

Because tax law changes periodically, numbers and examples may no longer match current rules. Always verify important decisions with up-to-date official sources, such as IRS publications, and with a qualified professional.

Short-term vs. long-term capital gains

The holding period - how long you held the asset - determines whether your gain is short-term or long-term.

  • Short-term capital gain: Asset held for one year or less. Taxed at your ordinary federal income tax rate (the same brackets used for wages).
  • Long-term capital gain: Asset held for more than one year. Taxed at reduced long-term capital gains rates (commonly 0%, 15%, or 20% at the federal level, depending on income and filing status).

This calculator lets you indicate the holding period using either:

  • Purchase date and sale date, or
  • Holding period (years) if you prefer to enter an approximate duration.

If you provide both exact dates and a holding period in years, treat the dates as your primary reference for real tax reporting. The holding period field is provided mainly for planning and what-if analysis.

Enter values and click Calculate.

Click to Play

Hold your sale until long-term windows open and dodge tax shocks.

Score: 0
Best: 0
Tap to hold, release to sell