Capital Gains Calculator

Estimate U.S. Federal Capital Gains Tax Before You Sell

This free Capital Gains Calculator is designed primarily for U.S. federal capital gains tax estimates, with an optional state tax input. Enter purchase price, sale price, holding period, and income details to see the potential tax impact.

Capital Gains Calculator

U.S. federal estimate: This calculator applies U.S. federal long-term and short-term capital gains rules. It does not attempt to model capital gains tax for other countries.
Used to determine short-term vs long-term classification
Used to determine short-term vs long-term classification
Used to stack the gain on top of ordinary income for federal bracket calculation.
Modified adjusted gross income. Used for the NIIT threshold test.
Interest, dividends, rent, and similar items. Adds to the NIIT base. Leave at 0 if none.
Enter your state’s capital gains tax rate if applicable

Popular Calculators

Explore related financial calculators that pair well with this Capital Gains Calculator:

Estimated Capital Gains Tax

Estimated Total Tax Owed
—
Federal + state tax estimate

Tax Breakdown

ItemAmount
Purchase Price (Cost Basis)—
Sale Price (Proceeds)—
Capital Gain / Loss—
Holding Period—
Classification—
Federal tax calculation (bracket-based)
Applicable Federal Rate(s)—
Federal Capital Gains Tax—
Net Investment Income Tax (3.8%)—
State Capital Gains Tax—
Total Estimated Tax—
Blended Effective Tax Rate on Gain—
Net Gain After Tax—

This is an estimate. The NIIT figure uses the capital gain plus any other net investment income you entered as the base, and applies the 3.8% rate to the lesser of that base or the amount by which MAGI exceeds the threshold. It may still differ from your actual net investment income and NIIT. The state tax figure applies the rate you entered to the gain and does not model state-specific brackets, deductions, or exemptions. The calculator applies the standard 0%, 15%, and 20% long-term rates and ordinary income rates for short-term gains. Special capital-gains categories — such as 28% collectibles gain, 25% unrecaptured Section 1250 gain, and qualified small-business stock — are not modeled, and the calculator is not a full Schedule D tax engine. It does not net capital losses across transactions, apply the primary-residence exclusion, or handle other special situations. Actual tax liability depends on your complete tax situation. Consult a tax professional for precise figures.

Investment Summary

Cost Basis
—
Sale Proceeds
—
Capital Gain
—
Holding Period
—
Total Tax Owed
—
Net Gain After Tax
—
Effective Tax Rate
—
Return on Investment
—

What Is a Capital Gains Calculator?

A Capital Gains Calculator is a tool that estimates the tax you may owe when you sell an investment for more than you paid for it. It takes the difference between your sale proceeds and your original cost basis, determines whether the gain is short-term or long-term based on how long you held the asset, and applies the appropriate tax treatment based on your income level and filing status.

The result is not a final tax bill. It is a planning estimate that helps you understand the potential tax impact of a sale before you commit to it. This Capital Gains Calculator is built primarily for U.S. federal tax estimation and includes an optional state tax input for a more complete picture. It breaks the estimate into federal tax, net investment income tax, and state tax components so you can see where the money goes.

The concept behind capital gains tax is straightforward: you are taxed on the profit, not the total sale amount. If you bought an asset for 10,000 and sold it for 25,000, the taxable gain is 15,000 — not 25,000. The Capital Gains Calculator focuses on that gain and applies the rules that determine how much of it goes to the government.

How the Capital Gains Calculator Works

The calculator follows a logical sequence to arrive at your estimated tax. Here are the steps it performs:

  1. Calculate the gain or loss. It subtracts the purchase price (cost basis) from the sale price (proceeds). A positive result is a gain; a negative result is a loss.
  2. Determine the holding period. It compares the purchase and sale dates against the long-term holding requirement — more than one year after acquisition — to decide whether the gain is short-term or long-term. If dates are not provided, the calculator defaults to long-term treatment and shows a visible notice in the results.
  3. Classify the gain. Assets held one year or less produce short-term gains, which are taxed at ordinary income rates. Assets held more than one year produce long-term gains, which qualify for preferential rates of 0%, 15%, or 20%.
  4. Apply progressive federal tax. The calculator stacks the gain on top of your annual taxable income and walks through each applicable bracket. A gain that spans more than one bracket is taxed in layers, not at a single flat rate.
  5. Add the net investment income tax (NIIT). The calculator adds any other net investment income you entered to the capital gain to form a net investment income base. The 3.8% NIIT is then applied to the lesser of that base or the amount by which your MAGI exceeds the threshold. This is a more precise estimate than using the capital gain alone, though it may still differ from your actual net investment income.
  6. Add state tax. If you entered a state tax rate, the calculator applies it to the gain and adds it to the total. This is a simplified estimate that does not model state-specific brackets or rules.

Each of these steps matters. A Capital Gains Calculator that skips the holding period test, ignores the NIIT, or applies a single flat rate to the entire gain can significantly understate or overstate what you owe.

Because taxable income and MAGI are separate concepts, the calculator accepts them as separate inputs. Taxable income drives the federal bracket stacking, and MAGI drives the NIIT threshold test. Using the same number for both would produce a less accurate result in many situations.

Short-Term vs Long-Term Capital Gains

The single biggest factor in how much tax you pay on an investment gain is how long you held the asset. The dividing line is one year.

Short-term gains apply to assets held for one year or less. These gains are treated like ordinary income and taxed at your marginal tax rate, which can be as high as 37% depending on your bracket. The holding period starts the day after acquisition and ends on the day of disposition, which is why the exact purchase and sale dates matter.

Long-term gains apply to assets held for more than one year. These gains qualify for preferential rates — 0%, 15%, or 20% — that are usually lower than ordinary income rates. For some investors, selling after the long-term holding-period requirement is met can result in a lower federal tax rate than selling earlier.

A Capital Gains Calculator automatically applies the holding period test using the dates you enter. If you are close to the one-year mark, running a few scenarios with different sale dates can show you how the tax treatment changes.

What Is Cost Basis and Why Does It Matter?

Cost basis is the amount you originally paid for an asset, including certain fees and adjustments. It is the starting point for every capital gains calculation. If your cost basis is 15,000 and you sell for 25,000, your gain is 10,000. If your cost basis is higher — because you paid commissions, for example — your taxable gain is lower.

Cost basis can be adjusted over time. Reinvested dividends increase your basis because you paid tax on those dividends already. Stock splits change the number of shares and the per-share basis, though the total basis remains the same. Return of capital distributions reduce your basis.

When you sell only part of a position, the cost basis method you choose determines which shares are considered sold. Common methods include First-In First-Out (FIFO), Specific Identification, Average Cost, and Highest-In First-Out (HIFO). Each method can produce a different gain and therefore a different tax bill. A Capital Gains Calculator uses the total purchase and sale amounts you enter, so the basis method is already reflected in those numbers if you calculated them correctly.

Long-Term Capital Gains Tax Rates

Long-term capital gains are taxed at three possible rates: 0%, 15%, or 20%. The rate that applies depends on your taxable income and filing status, and it works on a bracket basis — the same way ordinary income brackets work.

  • 0% rate: Applies to the portion of the gain that falls within the lowest income range.
  • 15% rate: Applies to the portion of the gain that falls within the middle income range. This is the most common rate for long-term gains.
  • 20% rate: Applies to the portion of the gain that falls within the highest income range.

Because the brackets are progressive, a single gain can be split across more than one rate. A gain that starts in the 0% bracket and spills into the 15% bracket is taxed at 0% for the first portion and 15% for the remainder. The Capital Gains Calculator applies the bracket structure correctly so that a gain spanning multiple brackets is not over- or under-taxed.

It is important to note that the long-term rates apply only to the gain itself. The rest of your income continues to be taxed at ordinary rates. The Capital Gains Calculator isolates the gain and stacks it on top of your ordinary taxable income to determine which portion of the gain falls in each bracket.

Some capital assets carry special rates above the standard 0/15/20 structure. For example, certain collectibles gain may be taxed at 28%, and unrecaptured Section 1250 gain on depreciated real property may be taxed at 25%. Gains from qualified small-business stock can also receive special treatment. This calculator does not model these special categories — it applies the standard long-term rates and ordinary income rates. If your gain may fall into a special category, consult a tax professional.

The 3.8% Net Investment Income Tax

High-income taxpayers may owe an additional 3.8% tax on net investment income, including capital gains. This is known as the Net Investment Income Tax (NIIT). It applies when your modified adjusted gross income exceeds 200,000 for single filers, 250,000 for married filing jointly, or 125,000 for married filing separately.

The NIIT is calculated on the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. Net investment income includes capital gains, interest, dividends, royalties, rental income, and certain other items, less allocable deductions. This Capital Gains Calculator lets you enter other net investment income alongside the capital gain, so the base is closer to your actual net investment income than a gain-only estimate would be. Even so, the NIIT figure remains an estimate and may differ from your final calculation.

This tax is separate from the capital gains rate itself. A long-term gain taxed at 15% could effectively become an 18.8% tax when NIIT is added. For a 20% gain, the combined rate reaches 23.8%. Understanding this stacking effect is one reason a Capital Gains Calculator is more useful than a simple rate table.

State Capital Gains Tax

Most states also tax capital gains, though the rules vary widely. Some states tax gains as ordinary income, and some apply a separate rate, while a few have no state income tax at all.

The Capital Gains Calculator includes an optional state tax rate field. If you know your state’s treatment of capital gains, you can enter the rate and see the combined federal and state impact. The calculator multiplies the gain by the rate you enter, which is a simplified approach that does not model state-specific brackets, deductions, or exemptions.

Because state rules change and can be complex, the state tax figure in the calculator is an estimate. For a precise state tax calculation, consult your state’s tax authority or a tax professional.

How to Use a Capital Gains Calculator Effectively

A Capital Gains Calculator is most useful when you use it to compare scenarios before you sell. Here are some practical ways to get more value from it:

  1. Test the holding period. If you are close to the one-year mark, enter sale dates on either side of the threshold to see the tax difference.
  2. Compare gain sizes. Selling in two smaller transactions across two tax years may keep you in a lower bracket than selling everything at once.
  3. Factor in losses. If you have other investments showing losses, selling them can offset gains and reduce your taxable amount. The calculator does not automatically net losses, so subtract them from your gain before entering the numbers if you plan to harvest losses.
  4. Enter other net investment income. If you also earn interest, dividends, or rental income, entering that amount helps the NIIT estimate reflect your broader investment picture.
  5. Check NIIT impact. If your MAGI is near the NIIT threshold, a large gain could push you over and trigger the additional 3.8% tax. The calculator shows this separately so you can see the effect.
  6. Use it as a planning tool. The estimate helps you set aside enough cash to cover the tax bill and avoid surprises at filing time.

When to Use a Capital Gains Calculator

A Capital Gains Calculator is useful in many situations:

  • Selling stocks or ETFs from a taxable brokerage account
  • Selling mutual fund shares that have appreciated over time
  • Selling investment real estate (though primary residence exclusions may apply)
  • Selling cryptocurrency or other digital assets
  • Planning year-end tax strategy by estimating gains before December 31
  • Comparing the tax cost of selling now versus waiting

In each case, the Capital Gains Calculator turns a complex tax question into a clear dollar figure you can plan around. It is a starting point for the conversation you may have with a tax advisor, not a replacement for professional advice.

Related Calculators

These investment and tax calculators are closely related to the Capital Gains Calculator:

External Resources

The following resources provide authoritative guidance on U.S. capital gains tax rules. Tax laws vary by country, and the information below is primarily U.S.-focused.

Frequently Asked Questions

What is a Capital Gains Calculator?

A Capital Gains Calculator is a tool that estimates the tax owed when an investment is sold for more than its purchase price. It calculates the gain, determines whether it is short-term or long-term based on the holding period, and applies the appropriate bracket structure based on income and filing status.

How is capital gains tax calculated?

Capital gains tax is calculated by subtracting the cost basis from the sale proceeds. The result is the gain. Short-term gains, held one year or less, are taxed at ordinary income rates. Long-term gains, held more than one year, are taxed at 0%, 15%, or 20% depending on the portion of the gain that falls into each income bracket. An additional 3.8% NIIT may apply at higher income levels.

What happens if I don’t provide purchase and sale dates?

If you leave the dates blank, the calculator defaults to long-term treatment because that is the more common scenario for appreciated investments. However, this is an assumption, not a determination. The results page shows a visible notice explaining that long-term classification was assumed. For an accurate classification, always enter the actual purchase and sale dates so the holding period test runs correctly.

Why does the calculator ask for taxable income and MAGI separately?

Taxable income and modified adjusted gross income (MAGI) are different figures. Taxable income is used for stacking the gain on top of ordinary income and applying the correct federal brackets. MAGI is used for the NIIT threshold test. Using a single number for both would produce a less accurate result, especially for taxpayers whose MAGI is significantly higher than their taxable income.

What is “Other Annual Net Investment Income” and why does the calculator ask for it?

Net investment income includes not just capital gains but also interest, dividends, royalties, rental income, and certain other items. The NIIT applies to the lesser of your net investment income or the amount by which MAGI exceeds the threshold. By entering other net investment income, you help the calculator estimate the NIIT base more accurately. Leave it at zero if you have none.

Does the calculator apply one rate or multiple brackets?

The calculator applies progressive brackets. If your gain spans more than one capital gains bracket, it is taxed in layers — the portion in each bracket is taxed at that bracket’s rate. This matches how the U.S. capital gains rules generally work and avoids the inaccuracy of a single-rate calculation.

What is the difference between short-term and long-term capital gains?

Short-term gains apply to assets held for one year or less and are taxed at ordinary income rates, which can reach 37%. Long-term gains apply to assets held for more than one year and qualify for preferential rates of 0%, 15%, or 20%. Holding an asset for more than a year can substantially reduce the tax owed on the gain, though other factors matter too.

What is cost basis and how is it determined?

Cost basis is the amount originally paid for an asset, including commissions and certain adjustments. It can be increased by reinvested dividends or decreased by returns of capital. When only part of a position is sold, the cost basis method (such as FIFO or Specific Identification) determines which shares are considered sold and therefore what the gain is.

What is the Net Investment Income Tax (NIIT)?

The NIIT is an additional 3.8% tax on net investment income, including capital gains. It applies when modified adjusted gross income exceeds 200,000 for single filers, 250,000 for married filing jointly, or 125,000 for married filing separately. The tax applies to the lesser of net investment income or the excess income over the threshold. This calculator combines the capital gain with any other net investment income you enter, then applies the 3.8% rate to the lesser amount. The NIIT figure remains an estimate.

Does the calculator handle special capital gains rates?

No. The calculator applies the standard 0%, 15%, and 20% long-term rates and the ordinary income brackets for short-term gains. Special categories such as 28% collectibles gain, 25% unrecaptured Section 1250 gain, and qualified small-business stock are not modeled. If your gain may fall into one of these categories, use a tax professional or dedicated tax software that handles Schedule D and special rate computations.

What does the calculator show when I have a loss?

The calculator shows no capital gains tax on that transaction, because a loss does not generate capital gains tax. However, a capital loss can still have tax consequences. It may offset capital gains from other transactions, and up to a limited amount can be deducted against ordinary income each year, with remaining losses carried forward. The calculator does not net losses across multiple transactions, so a full picture requires considering all your capital activity together. Rules vary by jurisdiction, so consult a tax professional.

What is the wash sale rule?

The wash sale rule prevents you from claiming a capital loss if you buy a substantially identical security within 30 days before or after the sale. If triggered, the loss is disallowed and added to the cost basis of the replacement shares, deferring the loss rather than eliminating it.

Does the Capital Gains Calculator include state tax?

The calculator includes an optional state tax rate field. You can enter your state’s capital gains rate to see the combined federal and state estimate. The calculator multiplies the gain by the rate you enter, which is a simplified approach that does not model state-specific brackets, deductions, or exemptions. State treatment varies widely, so consult your state’s tax authority for a precise figure.

Can I avoid capital gains tax on my primary home?

In the United States, up to 250,000 of gain (500,000 for married filing jointly) can be excluded if you owned and lived in the home as your primary residence for at least two of the five years before the sale. However, this calculator does not automatically apply the primary residence exclusion. If your sale may qualify, consult a tax professional to determine the correct treatment.

Is this calculator a full tax return engine?

No. This Capital Gains Calculator is a planning tool for estimating the tax impact of a single transaction. It is not a full Schedule D engine. It does not net capital losses across multiple transactions, does not apply the primary-residence exclusion, does not handle special rate categories such as collectibles or unrecaptured Section 1250 gain, and does not replace the complete tax-return calculation. Use it for comparison and planning, and confirm final figures with a tax professional or tax software.

How accurate is a Capital Gains Calculator?

The calculator provides a useful estimate when the inputs are correct. The NIIT figure combines the capital gain with any other net investment income you entered and applies the 3.8% rate to the lesser amount, but it may still differ from your final calculation. The state tax figure applies the rate you enter to the gain without modeling state-specific brackets. Actual tax liability depends on your complete tax situation, including other income, deductions, credits, phase-outs, and state-specific rules. Use the result for planning and confirm the final figures with a tax professional or tax software.

Is this calculator designed for non-U.S. tax systems?

No. This Capital Gains Calculator is built primarily for U.S. federal capital gains tax estimation and includes an optional state tax rate for U.S. state-level estimates. It does not attempt to model capital gains rules for other countries. If you file taxes outside the United States, use the calculator that matches your jurisdiction.

Conclusion

The Capital Gains Calculator takes the guesswork out of estimating the tax impact of an investment sale. By combining the gain calculation, holding period test, progressive federal bracket math, a more accurate NIIT estimate, and optional state tax into one clear result, it gives you a dollar figure you can plan around before you sell.

Run a few scenarios — different sale dates, different sale amounts, different income levels — and the picture sharpens quickly. Use the result alongside a tax professional’s advice to make informed decisions about when and how to realize your gains. A Capital Gains Calculator is a planning tool, not a substitute for personalized tax guidance, but it puts the key numbers at your fingertips.