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.

Updates automatically as you type.

Calculated in your browser; your inputs are not sent to us. Privacy

Results will appear here.
Calculation details
Every figure above is calculated locally in your browser from the assumptions shown. No inputs are sent anywhere. See the methodology section below for how this tool works.
Use this resultShare the current inputs, or ask ChatGPT to explain the calculation in context.
Ask an AI to explain this result
Share this result

Review the generated output before relying on it.

This tool runs in your browser. Your calculator inputs and results are never transmitted to us or to ad/affiliate partners. Ads and sponsored links may set third-party cookies to serve and measure them, but they never receive your calculation values. If you explicitly save a scenario, its permitted fields stay in local browser storage until you clear them. See our Privacy Policy.

Use this result

Share the current inputs or ask ChatGPT to explain the calculation in context.

More options
Report a calculation issue
Direct answer

What does this calculator estimate?

Capital gains tax applies to the profit from selling an asset for more than you paid. The gain is the sale price minus your cost basis. Assets held one year or less are short term and taxed at ordinary income rates; assets held more than one year are long term and taxed at the preferential 0%, 15%, or 20% schedule. Enter your purchase price, sale price, holding period, and an assumed rate in the calculator to see the estimated tax and what you keep.

  • The taxable gain is the sale price minus the cost basis, which includes the purchase price plus qualifying acquisition costs and improvements. (Source: BoringToolsKit calculation methodology)
  • Holding period of one year or less means short-term treatment at ordinary income rates; more than one year means long-term treatment at 0%, 15%, or 20% for most assets. (Source: BoringToolsKit calculation methodology)
  • In the worked example, a $24,000 gain taxed at an assumed 24% short-term rate costs $5,760; the same gain at an assumed 15% long-term rate costs $3,600, a $2,160 difference. (Source: BoringToolsKit illustrative example)
  • This calculator uses rates you enter. It does not look up current IRS brackets, and its output is an estimate, not tax advice. (Source: BoringToolsKit methodology)

What a capital gain actually is

A capital gain is the profit you realize when you sell a capital asset for more than you paid for it. Stocks, bonds, mutual fund shares, real estate, cryptocurrency, collectibles, and even a used car sold at a profit can all produce capital gains. The raw number is simple arithmetic: sale price minus cost basis. If you bought shares for $10,000 and sold them for $16,000, your gain is $6,000 and that is the figure the tax system cares about, not the full sale price.

The cost basis is where most of the real-world complexity hides. Basis starts as your purchase price, but it adjusts upward for certain acquisition costs like commissions and closing fees, and for capital improvements to real estate. It can adjust downward for depreciation you claimed or could have claimed. Getting basis right is the highest-leverage thing you can do, because every dollar of basis you can document is a dollar that is not taxed. The calculator takes your basis as an input precisely because the correct figure depends on records only you have.

One more distinction matters before any arithmetic: realized versus unrealized. A gain becomes real for tax purposes only when you sell. Shares that climbed from $10,000 to $16,000 on paper owe nothing until you dispose of them. This is why the timing of a sale, not just the size of the gain, is one of the few levers an individual investor actually controls.

Short-term versus long-term: the holding period that changes everything

The single most important fact about capital gains tax is that the tax system treats you very differently depending on how long you held the asset before selling. The clock runs from the day after you acquire the asset to the day you dispose of it. Hold for one year or less and your gain is short term, taxed as ordinary income at the same brackets that apply to your wages. Hold for more than one year and the gain is long term, taxed at the preferential schedule of 0%, 15%, or 20% for most taxpayers, with high earners potentially owing an additional net investment income tax.

The gap between those two regimes is the largest structural arbitrage available to ordinary investors, and it is why financial planning obsesses over the one-year mark. An investor in a 24% ordinary bracket pays 9 percentage points more on a short-term gain than on a 15% long-term gain. On a $50,000 gain that is $4,500 for doing nothing but waiting past the threshold. The calculator's worked example shows exactly this spread on a $24,000 gain.

The flip side deserves honest treatment: the one-year line is a cliff, not a slope. Selling at 11 months forfeits the entire benefit even if you would have held forever at 13 months. And the preferential rate is not a promise that waiting is always right. If the asset falls 10% during the wait, you gave up more in market value than you saved in tax. The holding period is a lever, not a law of returns; the calculator exists so you can quantify the trade before making it.

The formula, term by term

The core calculation uses four terms, and each one has a precise definition that changes the answer:

Taxable gain = sale price - cost basis. The sale price is what you actually received, after transaction costs you can substantiate. The cost basis is purchase price plus buy-side commissions and, for real estate, qualifying closing costs and capital improvements. Basis is not your down payment on a house; it is the full purchase price plus improvements, which surprises many first-time sellers.

Estimated tax = taxable gain x rate. The rate is a single number you supply, representing either your ordinary marginal rate for short-term gains or the applicable long-term rate for your bracket. Because the real rate schedule is progressive and layered with surtaxes, a single rate is an approximation. The calculator keeps the rate editable rather than hard-coding figures, so the output stays honest about what it knows.

Net proceeds = sale price - estimated tax. This is the number people actually care about: what lands in your account. On the default example inputs, a $64,000 sale with a $40,000 basis at an assumed 24% rate leaves $58,240 after an estimated $5,760 of tax. Run the same inputs at 15% and the keep-figure rises to $60,400. That two-number comparison, done before you sell, is the entire point of the tool.

  • Sale price: gross proceeds you can document, ideally net of selling costs.
  • Cost basis: purchase price plus acquisition costs plus capital improvements minus depreciation claimed.
  • Rate: your ordinary marginal rate for short-term gains, or 0/15/20 percent schedule plus any surtax for long-term gains; enter the figure that matches your situation.

Worked example: selling stock

Suppose you bought 200 shares at $200 each, a $40,000 total cost, and you sell them for $64,000. Your basis is $40,000 (add $20 of commission if you paid one; every documented dollar of cost lowers the gain). The gain is $64,000 - $40,000 = $24,000. Now the holding period decides the rest.

Short-term case: you held 11 months. The $24,000 stacks on top of your ordinary income, and at an assumed 24% marginal rate the estimated tax is $24,000 x 0.24 = $5,760. You keep $58,240 of the sale. Because short-term gains stack on wages, they can also push other income into higher brackets in the same year, an interaction this simple calculator does not model but a real filing will show.

Long-term case: you wait 5 more weeks and sell after a full year plus a day. The same $24,000 gain now falls under the preferential schedule. For a single filer with taxable income in the middle band, an assumed 15% rate applies: $24,000 x 0.15 = $3,600 in estimated tax, leaving $60,400. The five-week wait saved $2,160 on identical numbers. That is the entire mechanical reason the calculator asks for a holding period. All figures here are illustrative; your actual rate depends on your total taxable income and current law.

Worked example: selling a house

Real estate basis works differently enough that it deserves its own walkthrough. Say you bought a home for $300,000, paid $9,000 in closing costs on the buy side, and spent $40,000 on a qualifying capital improvement, a new addition rather than a repaint. Your basis is $349,000. If you sell for $520,000 with $26,000 in selling costs, the amount realized is $494,000 and the gain is $494,000 - $349,000 = $145,000.

Two things bend this picture. First, most owners who sell a primary residence can exclude a large slice of the gain from tax entirely, up to statutory limits, if they owned and occupied the home as their main residence for at least two of the last five years. A gain inside the exclusion produces no capital gains tax at all, which is why millions of home sales generate no tax even when the paper profit is large. Check current IRS guidance for the exact limits and conditions; this calculator does not model the exclusion.

Second, depreciation recapture applies if the property was ever a rental. Every dollar of depreciation you claimed lowers your basis and is later taxed at a specific recapture rate when you sell. A $145,000 gain on a former rental behaves nothing like a $145,000 stock gain. The honest workflow is: compute your true basis from records, subtract any exclusion, then use the calculator on the remainder with an appropriate assumed rate. The example numbers above are illustrative of the arithmetic, not a prediction of any actual tax bill.

2026 Rate Context: Structure, Not Promises

This section describes how the rate structure works rather than quoting bracket tables, because exact thresholds change with inflation adjustments and this calculator is designed around rates you enter. The structure has been stable for years: short-term gains are taxed at the same seven ordinary brackets that apply to wages. Long-term gains on most assets use a three-step schedule of 0%, 15%, and 20%, with the 0% band reserved for lower taxable incomes, 15% covering the broad middle, and 20% applying at the top. High earners can add a 3.8% net investment income tax on top, and some state income taxes apply to gains as ordinary income.

A few assets sit outside the standard schedule and are worth flagging. Collectibles such as art, coins, and antiques cap out at a 28% long-term rate. Certain small-business stock can qualify for partial exclusion. Real estate depreciation is recaptured at a specific rate regardless of your bracket. Unrecaptured Section 1250 gain, collectibles, and qualified small business stock each have their own lines on the schedule, which is one more reason a single flat rate is a model, not a mirror.

For current-year figures, the authoritative sources are IRS Topic 409 and the annual inflation-adjustment revenue procedure, both linked in the sources block on this page. The calculator's editable rate field exists so that when brackets shift, the tool does not silently go stale: you supply the rate that matches your situation and the arithmetic stays correct. That design choice trades convenience for honesty, and it is deliberate.

Loss offsets and netting: when the sale does not go your way

Capital losses work in the opposite direction of gains and are the tax system's one consolation prize. When you sell an asset for less than basis, the loss can offset gains of the same character first: short-term losses against short-term gains, long-term losses against long-term gains. Leftover losses cross over to the other category, and whatever remains after that can offset up to a statutory limit of ordinary income per year, with the excess carried forward indefinitely to future years.

The mechanical consequence is that tax is owed on net gains, not on every winning sale in isolation. If you realize a $30,000 long-term gain and a $10,000 long-term loss in the same year, the taxable long-term gain is $20,000 and that is the figure the rate applies to. Harvesting losses deliberately, selling positions that are underwater to realize the loss while keeping overall exposure, is a common and legitimate strategy built entirely on this netting logic. Watch the wash-sale rule for securities: buying a substantially identical asset within the window around the loss sale disallows the deduction.

Netting is where this simple calculator reaches its honest limit. The tool estimates tax on the single gain you enter. A real tax year with multiple sales, both characters of gains and losses, carryforwards from prior years, and state taxes produces a different number, usually a better one if you have losses available. Use the calculator for per-sale decisions, then confirm the full-year picture with tax software or a professional. This page is general information, not tax advice, and your situation may have features the model does not see.

Infographic: how long you hold changes the tax, comparing 22 percent short-term versus 15 percent long-term capital gains rates with a $10,000 worked example
Short-term vs long-term capital gains: the one-year line and what it does to a $10,000 gain. Illustrative, not tax advice.
Transparent methodology

How this calculator works

fact-checked against IRS

Formula

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 to verify

  • 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.

Frequently asked 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.

Cite this tool

BoringToolsKit. “Capital Gains Calculator.” boringtoolskit.com/capital-gains-calculator/. Free to reference in articles, syllabi, and answer posts with a link.

Privacy: Inputs and results stay in this browser. Any future sponsored recommendation or advertisement will be clearly labeled and kept separate from the calculation.

A $64,000 sale at 24%

You keep$58,240.00Capital gains tax$5,760.00Cost basis$40,000.00

What this means for your numbers: In the worked example the 24% rate taxes $5,760 of the $24,000 gain. Holding past one year at the 15% LTCG rate would cut that to $3,600: $2,160 for waiting.

Illustrative breakdown using the worked example above. The calculator computes your own numbers with the same formula.