# Capital Gains Calculator

> Capital gains calculator: compute profit, short vs long-term treatment, and estimated tax due from purchase price, sale price, and holding period. Editable rates.

- **Canonical URL:** https://boringtoolskit.com/capital-gains-calculator/
- **Category:** Finance & Investing
- **Evidence level:** authored-methodology
- **Reviewed:** July 26, 2026
- **Last verified:** 2026-10-12
- **Privacy:** Inputs and results stay in this browser unless the page clearly labels an external request.

## How it works

Taxable gain = sale price - cost basis. Estimated tax = taxable gain x rate you enter. Net proceeds = sale price - estimated tax - cost basis.

## Worked example

A $64,000 sale with a $40,000 cost basis produces a $24,000 gain. At an assumed 24% short-term rate the estimated tax is $5,760 and you keep $58,240 of the sale. Holding past one year at an assumed 15% long-term rate would cut the tax to $3,600.

## Assumptions

- Rates are values you enter or the calculator's default illustration; they are not a lookup of current tax law.
- The calculation is a single-layer estimate: it does not model netting across multiple sales, state taxes, the NIIT, or basis adjustments beyond what you enter.
- Cost basis is what you type in. For inherited or gifted property the correct basis follows special rules not modeled here.

## Common questions

### How is capital gains tax calculated?

Multiply the taxable gain by the applicable rate. The taxable gain is the sale price minus your cost basis. For a $64,000 sale with a $40,000 basis, the gain is $24,000; at an assumed 15% rate the estimated tax is $3,600. The calculator does this arithmetic and shows the net amount you keep.

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

Assets held one year or less produce short-term gains taxed at your ordinary income rate. Assets held more than one year produce long-term gains taxed at the preferential 0%, 15%, or 20% schedule for most assets. The same dollar of gain can cost several percentage points more in tax if realized a few weeks before the one-year mark.

### How do I find my cost basis?

Start with the purchase price, add acquisition costs such as commissions or buy-side closing costs, add capital improvements (for real estate), and subtract any depreciation claimed. Brokerages report basis for securities they sold you after 2011, but inherited property, gifts, old paper certificates, and home improvements often require your own records.

### Do I pay capital gains tax on my primary residence?

Most sellers can exclude a substantial portion of the gain on a primary residence if they owned and used it as their main home for at least two of the last five years. Gains within the exclusion are untaxed. The exclusion has statutory limits and conditions, so check current IRS guidance; this calculator does not model the exclusion, so subtract any excluded amount from the gain before using it.

### Does this calculator use current 2026 tax rates?

No. The rate is an input you control, which keeps the tool from going stale when brackets adjust and keeps it honest about what it knows. Use your own marginal ordinary rate for short-term gains, or the long-term rate that matches your taxable income for long-term gains, and treat the output as an estimate. IRS Topic 409 has the current figures.

### Can capital losses offset my gains?

Yes. Losses offset gains of the same character first, then cross over to the other character, then offset up to a statutory limit of ordinary income per year, with the rest carried forward. Tax applies to net gains, not each sale in isolation. Note the wash-sale rule: repurchasing a substantially identical security around the loss sale can disallow the loss.

### Is this calculator tax advice?

No. It is a general-purpose estimation tool for one simple scenario: a single sale, a basis you supply, and a rate you supply. It does not model netting across sales, the NIIT, state taxes, depreciation recapture, exclusions, or your specific facts. For decisions with real money attached, confirm with a qualified tax professional.

### What is the net investment income tax?

An additional 3.8% tax that can apply to net investment income, including capital gains, for taxpayers with modified adjusted gross income above statutory thresholds. It stacks on top of the regular capital gains rate. If it applies to you, add it to the rate you enter in the calculator to get a more realistic estimate.

### Does this handle a 1031 exchange?

A Section 1031 like-kind exchange defers capital gains tax when investment real estate is exchanged for similar investment property, rather than sold. This calculator computes the gain on a plain sale; it does not model 1031 deferral. If you completed a 1031 exchange, your realized gain is generally deferred (not eliminated) and your cost basis carries over - talk to a tax professional before acting.

## Related tools

- /stock-calc/
- /stock-average-cost-calculator/
- /compound-interest/
- /dca-investment-calculator/
- /cagr-calculator/

## Sources

- [Topic 409: Capital Gains and Losses](https://www.irs.gov/taxtopics/tc409)
- [Publication 550: Investment Income and Expenses](https://www.irs.gov/publications/p550)
- [Calculation methodology](/methodology/)

---

*Local planning estimate. Verify current terms, rates, and policies before acting.*

