Capital Gains Tax Calculator
Estimate capital gains tax on investment sales.
Formula
Tax = Gain × Rate (long-term vs short-term)
Example
Buy $10K, sell $15K after 18 months, 22% bracket → long-term ~$600 tax.
Embed this calculator on your site
Add this free calculator to your own website with one line of code. The embedded version is responsive, ad-free, and includes a small attribution link back to CalcNest AI.
<iframe src="https://calcnestai.com/embed/capital-gains-tax-calculator.html" width="100%" height="700" frameborder="0" style="border: 1px solid #e5e5e5; border-radius: 12px; max-width: 720px;" loading="lazy" title="Capital Gains Tax Calculator — Free Tool by CalcNest AI"></iframe>
Understanding the Capital Gains Tax Calculator
A capital gains tax calculator estimates what you'll owe when you sell an asset for more than you paid, and the single variable that moves the answer most isn't the size of the gain. It's how long you held the asset. Crossing the one-year mark typically shifts a gain from being taxed as ordinary income to a substantially lower long-term rate, which is why the holding period is the first thing to check before selling anything.
How it actually works
Enter the purchase price, the sale price, the holding period in months, and your marginal tax bracket. The calculator subtracts purchase from sale to get the gain, classifies it as long-term if held twelve months or more, applies your full bracket rate to short-term gains or a reduced rate to long-term ones, and reports the tax and net profit. A $10,000 purchase sold for $18,000 after 24 months at a 24% bracket produces an $8,000 gain taxed at an estimated 14.4%, for $1,152 in tax and $6,848 net.
| Holding period | Classification | Rate applied | Estimated tax |
|---|---|---|---|
| 6 months | Short-term | 24.0% | $1,920 |
| 11 months | Short-term | 24.0% | $1,920 |
| 12 months | Long-term | 14.4% | $1,152 |
| 24 months | Long-term | 14.4% | $1,152 |
The deeper context most people miss
The jump between month eleven and month twelve is worth $768 on this gain, and nothing about the investment changed. That's the highest-return decision available in the whole transaction, and it's purely a matter of timing. It also cuts the other way: selling at month eleven because you're nervous about a small price move can easily cost more in tax than the price move you were trying to avoid, which is a trade worth calculating explicitly before acting on it.
An important caveat about how this calculator estimates the long-term rate
This tool applies a simplified model for long-term gains, taking 60% of your marginal bracket and capping the result at 20%. That produces a reasonable ballpark, but it is not how the actual system works, and you should understand the difference before relying on the number. In the United States, long-term capital gains are taxed under their own separate rate schedule with distinct brackets, and the applicable rate is generally one of three figures rather than a proportion of your ordinary income rate. Which of those three applies depends on your total taxable income and filing status, and the thresholds are adjusted periodically. This means the real long-term rate is a step function: taxpayers below a certain income threshold can owe nothing at all on long-term gains, most middle-income taxpayers fall into the middle rate, and only higher-income taxpayers reach the top rate. The simplified 60%-of-bracket approach happens to land near the middle rate for many common brackets, which is why it works as an approximation, but it will be wrong for anyone near a threshold and substantially wrong for lower-income taxpayers who may actually owe zero. There are also additional layers this doesn't model, including a net investment income tax that applies above certain income levels, state capital gains taxes that vary enormously and in some states don't exist at all, and special rates for particular asset classes such as collectibles and certain real estate depreciation recapture. Treat this calculator as a planning estimate for the scale of a liability, and use actual bracket tables or a tax professional before making a decision that turns on the precise figure.
A worked example: the cost of selling eleven months in
Suppose you bought shares for $10,000 and they're now worth $18,000, an $8,000 gain, and you're in the 24% bracket. Sell at month eleven and the gain is short-term, taxed at your full ordinary rate of 24%, producing $1,920 in tax and $6,080 net profit. Wait until month twelve and it becomes long-term. Under the real US schedule, a taxpayer in the 24% ordinary bracket would typically face the 15% long-term rate, giving $1,200 in tax and $6,800 net. That's a $720 difference for waiting roughly four weeks, which annualises to an extraordinary rate of return on doing nothing. The calculation that matters is comparing that tax saving against the risk of holding four more weeks. If the position is volatile enough that a 5% adverse move is plausible, that's $900 of downside risk against $720 of tax saving, and holding may not be worth it. If the position is relatively stable, waiting is close to free money. The point is that this should be an explicit calculation rather than an afterthought, and a surprising number of investors sell just short of the threshold without ever running it.
Deciding whether to harvest losses against a gain
If you're sitting on a large realised gain, one of the more useful moves available is offsetting it with realised losses elsewhere in your portfolio, a practice usually called tax-loss harvesting. The mechanics are that capital losses offset capital gains of the same type first, then the other type, and any remaining net loss can typically offset a limited amount of ordinary income per year, with the excess carried forward indefinitely. So if you have that $8,000 gain and also hold a position sitting on a $3,000 unrealised loss that you no longer believe in, selling both in the same tax year reduces the taxable gain to $5,000 and cuts the tax bill proportionally. Two cautions matter here. First, wash sale rules in many jurisdictions disallow the loss if you buy back the same or a substantially identical security within a defined window around the sale, typically thirty days either side, so harvesting requires either staying out or buying something genuinely different. Second, harvesting a loss on a position you actually still want to own is usually a mistake dressed up as tax efficiency, since you're taking a real economic loss to save a fraction of it in tax. The technique works best when you already wanted to exit the position and the tax benefit is a bonus rather than the motivation.
Cost basis: the number that determines the gain in the first place
The calculator asks for a purchase price, but the figure that actually matters legally is the cost basis, and the two aren't always the same. Cost basis generally includes what you paid plus certain acquisition costs such as commissions, and it can be adjusted over time by events that have nothing to do with a purchase or sale. Reinvested dividends are the most commonly missed adjustment: every time a dividend is automatically reinvested, you're buying additional shares at that day's price, and those purchases add to your total basis. Investors who ignore this frequently overstate their gain and overpay tax, sometimes substantially, on long-held dividend-paying positions. Stock splits adjust the per-share basis, return-of-capital distributions reduce basis, and for real estate, capital improvements increase basis while depreciation claimed reduces it. Which shares you're deemed to have sold also matters when you've bought the same security at different prices over time: default methods such as first-in-first-out may produce a very different gain from specific identification, where you nominate exactly which lots to sell, and choosing the highest-basis lots can materially reduce the taxable gain. Brokers generally track basis for you now, but the records can be incomplete for older holdings or assets transferred between institutions, and the responsibility for accuracy ultimately sits with the taxpayer.
Variations: asset types, jurisdictions, and special cases
Capital gains treatment varies considerably by what you sold and where you live. Collectibles including art, precious metals, and some other tangible assets are frequently taxed at a higher maximum rate than ordinary long-term gains. Real estate carries its own complications, including depreciation recapture taxed at a different rate for investment property, and a substantial exclusion on gains from selling a primary residence if ownership and occupancy tests are met, which means many homeowners owe nothing at all. Assets held inside tax-advantaged retirement accounts generally don't trigger capital gains tax on sale at all, since the account itself is the taxable event on withdrawal, which is why rebalancing inside such an account is far cheaper than rebalancing a taxable brokerage account. Inherited assets typically receive a stepped-up basis to the value at the date of death in many jurisdictions, which can eliminate a lifetime of unrealised gain entirely. And state or provincial treatment varies enormously, with some jurisdictions taxing gains as ordinary income, some at a reduced rate, and some not at all, so the federal calculation alone may understate the full liability.
Managing capital gains tax sensibly
Check the holding period before selling anything with a meaningful gain, since crossing twelve months typically shifts the rate substantially and waiting a few weeks can be worth more than the price movement you're trying to avoid. Verify your cost basis rather than assuming it's your original purchase price, particularly on long-held dividend-paying positions where reinvested dividends have been steadily increasing your basis. If you're realising a large gain, look for genuine losses elsewhere worth harvesting in the same tax year, while respecting wash sale rules and avoiding the trap of selling something you actually want to keep. Do rebalancing inside tax-advantaged accounts where possible, since it avoids triggering gains at all. And treat this calculator's long-term rate as an approximation rather than a figure to file on, because the real schedule uses its own separate brackets rather than a proportion of your income rate.
What people get wrong
- Selling just under the twelve-month mark without calculating what the short-term rate costs, which on a moderate gain can far exceed the price risk of waiting.
- Using the original purchase price as cost basis on a long-held dividend-paying position, ignoring reinvested dividends that have raised the basis and overstating the taxable gain.
- Treating the long-term rate as a fixed proportion of your income bracket, when it's actually a separate schedule where lower-income taxpayers may owe nothing at all.
- Harvesting a loss on a position you still believe in purely for the tax benefit, taking a real economic loss to recover a fraction of it.
Where the math comes from
Capital Gain = Sale Price - Purchase Price. If Holding Period ≥ 12 months, the gain is classified long-term and this calculator estimates the rate as min(Marginal Bracket × 0.6, 20%); otherwise the full marginal bracket rate applies. Tax = max(Gain, 0) × Rate / 100. Net Profit = Gain - Tax. The long-term rate here is a simplifying approximation: actual long-term capital gains use a separate bracket schedule based on total taxable income and filing status, so verify against current tables before relying on the figure.
Questions and answers
Should I take the standard deduction or itemize?
Standard deduction is $14,600 (single) / $29,200 (MFJ) in 2026. Itemize only if your eligible expenses (mortgage interest, charitable giving, SALT capped at $10K, medical above 7.5% AGI) exceed the standard.
What is the marginal vs effective rate?
Marginal is the rate on your last dollar of income. Effective is total tax divided by total income. They diverge because of progressive brackets - your marginal rate is always at or above your effective rate.
Should I do my own taxes or hire a pro?
Simple returns (W-2 income, standard deduction): software like TurboTax or FreeTaxUSA works well. Complex returns (self-employment, rental property, capital gains, multiple states): a CPA or EA usually pays for themselves.
How do I lower my tax bill legally?
Tax-advantaged retirement accounts (401k, IRA, HSA), tax-loss harvesting, charitable donations, business deductions if self-employed, and timing of capital gains realizations are the main legal levers.
What about quarterly estimated taxes?
Required if you will owe $1,000+ at filing time. Self-employed and freelancers typically pay quarterly to avoid underpayment penalties. The IRS publishes Form 1040-ES for the calculation.
How long do I need to hold an asset for the lower tax rate?
Generally more than one year. Assets held twelve months or less produce short-term gains taxed at your ordinary income rate, while those held longer qualify for long-term treatment at a substantially lower rate. On an $8,000 gain in a 24% bracket, crossing that threshold can save several hundred dollars for no change in the investment itself.
Is this calculator's long-term rate accurate?
It's an approximation, taking 60% of your marginal bracket capped at 20%. The real system uses a separate long-term capital gains bracket schedule based on total taxable income and filing status, where lower-income taxpayers may owe nothing at all and only higher earners reach the top rate. Use it to gauge the scale of a liability, then check current bracket tables before acting on a precise figure.
What is cost basis and why does it matter?
Cost basis is what the asset is treated as having cost you for tax purposes, and it determines the size of the taxable gain. It includes the purchase price plus acquisition costs, adjusted over time by reinvested dividends, stock splits, return-of-capital distributions, and for property, improvements and depreciation. Ignoring reinvested dividends is the most common error and causes people to overstate gains and overpay.
Can capital losses reduce my tax bill?
Yes. Realised losses offset realised gains, and any remaining net loss can typically offset a limited amount of ordinary income per year with the excess carried forward. Wash sale rules generally disallow the loss if you repurchase the same or a substantially identical security within about thirty days either side of the sale, so harvesting requires care.
Do I owe capital gains tax on investments in a retirement account?
Generally not on sales within the account. Buying and selling inside a tax-advantaged retirement account typically doesn't trigger capital gains tax, with taxation instead occurring on withdrawal according to the account type's rules. This is why rebalancing inside such accounts is considerably cheaper than doing the same trades in a taxable brokerage account.
Does this include state taxes?
No, it estimates federal-style treatment only. State and provincial treatment varies enormously, with some jurisdictions taxing capital gains as ordinary income, some applying a reduced rate, and some not taxing them at all. There may also be an additional net investment income tax above certain income levels, so the full liability can exceed what this calculator shows.
What happens if I sell at a loss?
There's no tax on a loss, and this calculator floors the tax at zero when the sale price is below the purchase price. The loss itself can generally be used to offset other capital gains in the same year, and any excess can offset a limited amount of ordinary income with the remainder carried forward to future years.
Sources & References
Authoritative references consulted in building this calculator and educational content. These are primary sources — check directly for the most current figures.
Related calculators
Paycheck · LLC Tax · Tax · Quarterly Estimated Tax · Sales Tax