Capital gains tax calculator
The rate on a long-term gain depends on where it lands once stacked on your ordinary income — which is why the same sale costs one person nothing and another twenty percent.
Taxed at 0%, 15% or 20% depending on where it lands on top of your income.
No preferential rate at all — this is taxed as ordinary income.
The gain itself costs 15.00% — $6,000 on $40,000
- Tax on your ordinary income
- $9,870
- Long-term gain taxed at 15.00%$40,000 of the gain falls in this band
- $6,000
- Net investment income taxBelow the threshold — not charged
- —
What this does not model. Long-term gains stack on top of your ordinary income, so the rate depends on your total taxable income and not on the gain alone. Does not model collectibles (28%), qualified small business stock, opportunity zones, wash sales or state capital gains rules.
Long-term gains do not have their own brackets — they stack on your income
This is the mechanic that almost every simple calculator gets wrong, and it changes the answer by thousands. The 0%, 15% and 20% rates are not applied to the gain in isolation. Your ordinary income fills the space first, and the gain sits on top of it. Where the top of that stack falls decides the rate.
The same $30,000 gain, two people. On $40,000 of ordinary income the gain costs $668, because much of it lands below the zero-rate ceiling of $49,450 for a single filer. On $150,000 of ordinary income the same gain costs $4,500 — $3,833 more, on an identical sale.
The ceiling is on taxable income, after your deduction, which gives more room than the headline number suggests. A single filer with $16,100 of deduction can have $65,550 of total income and still have the last dollar of gain taxed at nothing.
That creates a genuine planning window, and it is widest exactly when income is lowest: a gap year, a sabbatical, the first years of retirement before required distributions start, or any year with an unusually low salary. Realising gains deliberately in those years — and immediately repurchasing, since there is no wash-sale rule on gains — resets your basis higher at zero cost.
And it works in reverse. A large gain pushes your own stack upward, so a single sale can move part of itself from the 15% band into the 20% band. Splitting a sale across two tax years is the standard response, and it is worth modelling before selling rather than after.
A year and a day is worth a great deal
Held one year or less, a gain is short-term and taxed as ordinary income at your full marginal rate. Held more than a year, it is long-term and taxed on the preferential schedule. There is no gradient between them: the holding period is a cliff, not a slope.
On $150,000 of ordinary income, $30,000 of short-term gain costs $7,200 while the same gain held past the anniversary costs $4,500 — a difference of $2,700 for waiting. Few decisions in the tax code pay that well for doing nothing.
The clock starts the day after acquisition and ends on the day of disposal. "More than one year" means exactly that, so selling on the anniversary itself is short-term. For shares acquired in several purchases, each lot has its own clock, and which lot you are deemed to sell depends on the identification method your broker uses — specific identification gives you control that first-in-first-out does not.
The exceptions are worth knowing before assuming the preferential rate. Collectibles are taxed at up to 28%. Depreciation on real property comes back as unrecaptured § 1250 gain at up to 25%. And gains inside a retirement account are not capital gains at all — they are ordinary income when withdrawn from a traditional account, and nothing at all from a Roth.
Crypto follows the same rules as any other property: each disposal is a taxable event, including swapping one token for another and spending it on something, and the holding period applies exactly as it does to shares. There is no separate crypto regime, which surprises people in both directions.
The 3.8% surcharge with a threshold nobody indexed
The net investment income tax adds 3.80% on top of the capital gains rate, and it catches people who have never heard of it. It applies to the lesser of your net investment income and the amount by which your modified AGI exceeds $200,000 single or $250,000 joint.
"The lesser of" is the part that matters and the part most explanations skip. Someone $10,000 over the threshold with $80,000 of gain pays the surcharge on $10,000, not on $80,000 — $380 rather than $3,040. It phases in with your income rather than switching on at full force.
Those thresholds have not been indexed since the tax took effect in 2013. Every other significant figure in the code moves with inflation each January; this one has not moved at all in over a decade, which means it reaches steadily further down the income distribution every year without any decision being taken.
Net investment income is broader than capital gains: interest, dividends, rental income, royalties, annuities and passive business income all count. Wages do not, and neither do retirement account distributions — though those distributions raise your modified AGI and can therefore push other investment income over the line.
The marriage penalty here is unusually sharp. Two single people at $190,000 each pay none of it; the same two married pay it on everything above $250,000 of combined income. The joint threshold is not double the single one, and this is one of the places where that arithmetic is most visible.
What losses can and cannot do
Capital losses offset capital gains dollar for dollar, first within the same category and then across it. Beyond that, up to $3,000 of net loss can be deducted against ordinary income each year — a figure set in 1978 and never indexed, which would be about $15,000 in today's money if it had been.
Anything above that carries forward indefinitely. There is no expiry and no limit to the carryforward, so a large loss year continues to shelter gains for as long as it takes to use up, which for some people is a decade or more.
Harvesting losses deliberately is one of the few genuinely free optimisations available: selling a position that is down, banking the loss against gains, and reinvesting. The constraint is the wash-sale rule, which disallows the loss if you buy the same or a substantially identical security within 30 days either side of the sale. Sixty-one days in total, and it applies across accounts including a spouse's.
Note the asymmetry that catches people: the wash-sale rule applies to losses only. There is no equivalent restriction on realising a gain and immediately repurchasing, which is what makes deliberate gain harvesting in a low-income year work.
And losses inside a retirement account do nothing at all. They cannot be harvested, cannot offset anything, and cannot be deducted — the account is outside the capital gains system entirely, in both directions.
Five ways a capital gains estimate goes wrong
Applying 15% flat. The rate depends on where the gain lands once stacked on your ordinary income. The same $30,000 gain costs $668 on a modest income and $4,500 on a high one.
Taxing the whole sale price. Only the gain is taxable — proceeds minus basis. Basis is what you paid plus commissions and, for property, plus improvements and minus depreciation. Someone selling $80,000 of shares bought for $55,000 has $25,000 of gain, not $80,000 of income.
Assuming the short-term rate is a rate. There is no short-term capital gains rate. It is ordinary income, taxed at whatever bracket it lands in — up to 37.00%.
Forgetting the 3.8% surcharge. Above $200,000 single it applies to the lesser of investment income and the excess, so it is easy to miss on the way in and unmissable on the return.
Ignoring the state. Most states tax capital gains as ordinary income with no preferential rate at all, so the state line on a large gain is often the largest single surprise — and a handful tax them at a higher rate than ordinary income rather than a lower one.
Selling your home is the big exception
Section 121 excludes up to $250,000 of gain on the sale of a primary residence, or $500,000 for a married couple filing jointly. For most households selling a home, that means no capital gains tax at all — which is why the general rules above so often do not apply to the largest asset people own.
The conditions are ownership and use: you must have owned the home and lived in it as your main residence for at least two of the five years before the sale. The two years do not have to be continuous, and the exclusion can generally be used again after two years.
Those exclusion amounts have never been indexed. They were set in 1997 and have not moved since, while house prices have. In expensive markets a long-held family home can now produce a gain well beyond $500,000, and the excess is taxable at long-term rates plus potentially the 3.80% surcharge — a situation the provision was never designed for and which affects more households every year.
Basis is what reduces the gain, and it is where records pay. Purchase price plus closing costs plus capital improvements over the years of ownership: a new roof, an extension, a kitchen replacement. Ordinary repairs do not count. A household that kept receipts for twenty years of improvements can add substantially to basis; one that did not cannot.
Partial exclusions exist for sales forced by a change of employment, health, or other unforeseen circumstances, prorated by how much of the two-year period was met. And a property that was ever a rental brings depreciation recapture with it regardless of the exclusion, which is the single most common surprise in this area.
Crypto follows property rules, and every disposal counts
Digital assets are treated as property, not currency, so the ordinary capital gains rules apply in full. Every disposal is a taxable event, and "disposal" is broader than people expect.
Selling for dollars is obvious. Swapping one token for another is also a disposal of the first — you have sold it and bought something else, and the gain on the first is realised whether or not any cash appeared. Spending crypto on goods is a disposal too, at the value on the day.
Each acquisition has its own basis and its own holding period, exactly as with shares bought in separate lots. Which lot you are deemed to dispose of matters, and specific identification gives more control than a default first-in-first-out method — but it requires records showing which units were which, kept at the time.
The wash-sale rule has historically been understood to apply to securities rather than to property generally, which has made loss harvesting easier in this asset class than in equities. That is an area where the rules have been subject to legislative attention, so it is worth confirming the current position rather than relying on what was true a couple of years ago.
Exchange reporting has expanded substantially, so the assumption that transactions are invisible is no longer safe if it ever was. The practical requirement is a complete transaction history — every acquisition with its date and cost, every disposal with its date and proceeds — because reconstructing it years later across several platforms is the single most expensive tax admin problem in this category.
The levers that actually move a capital gains bill
Holding past the one-year mark is the largest and the simplest. The difference between ordinary rates and the preferential schedule is frequently ten percentage points or more on the same gain, for a decision that costs nothing but patience.
Realising gains deliberately in a low-income year is the second, and the most underused. Because the zero-rate band is a ceiling on total taxable income, a year with little other income lets you realise gain and pay nothing on it — then repurchase immediately, since the wash-sale rule restricts losses and not gains, resetting your basis higher for free.
Harvesting losses is the mirror image, restricted by the 30-day window either side of the sale. Substituting a similar but not substantially identical investment keeps you in the market while banking the loss, which is standard practice and specifically permitted.
Charitable giving of appreciated assets held over a year avoids the gain entirely: you deduct the market value and never realise the appreciation. It is markedly better than selling, paying tax and donating the proceeds, and it is the single most tax-efficient way to give at any meaningful size.
And asset location matters as much as asset selection. Holding investments that generate ordinary income inside tax-advantaged accounts, and holding those that generate long-term gains in taxable ones, uses the preferential rate where it is available and shelters what cannot benefit from it — a decision made once that compounds for decades.
What your state does with the same gain
The federal preferential rate is a federal concept. Most states tax capital gains as ordinary income at their normal rates, which means a large gain can produce a state bill comparable to the federal one even though the federal calculation looked modest.
A handful of states go further and tax gains at a higher rate than ordinary income, or apply an additional levy above a threshold. A few provide partial exclusions or preferential treatment, usually tied to holding period or to in-state investment. And the states with no income tax do not tax them at all.
Residency at the time of sale generally determines which state taxes the gain, which makes timing relative to a move genuinely consequential. Selling before or after a change of residence can move the entire state liability, and states with high rates scrutinise the timing of large gains around a departure carefully.
Real property is the exception: gain on land and buildings is generally taxed by the state where the property sits regardless of where you live, and that state will expect a non-resident return. A landlord selling out of state should expect to file in two places.
Each state page on this site carries its own rates with the document they were read from and the date they were checked, which for capital gains matters more than usual — this is an area several states have legislated on recently, and compiled sources lag legislation by months.
Where to go next
Questions
- What are the 2026 capital gains tax rates?
- 0%, 15% and 20% for long-term gains. For a single filer the zero rate applies up to $49,450 of taxable income and the 15% rate up to $545,500; joint filers get $98,900 and $613,700. Those are ceilings on total taxable income, not on the gain — the gain stacks on top of your ordinary income.
- How much tax will I pay on a $30,000 gain?
- It depends entirely on your other income. On $85,000 of salary, a $30,000 long-term gain costs $4,500 federally plus no net investment income tax at this level, plus whatever your state charges. Held a year or less it would instead be taxed as ordinary income at your marginal rate.
- Do I pay capital gains tax if I reinvest?
- Yes. Realising the gain is the taxable event; what you do with the proceeds afterwards is irrelevant. The exceptions are narrow and specific — a 1031 exchange for investment real estate, and gains inside a retirement account, which are outside the capital gains system entirely.
- How long do I have to hold to get the lower rate?
- More than one year. The clock starts the day after you acquire and ends the day you dispose, so selling on the anniversary itself is still short-term. It is a cliff rather than a gradient — one day either side changes the rate from your full marginal bracket to the preferential schedule.
- Can I offset gains with losses?
- Yes, dollar for dollar without limit. Beyond that, up to $3,000 of net loss can be deducted against ordinary income each year and the rest carries forward indefinitely. The wash-sale rule disallows a loss if you repurchase the same or a substantially identical security within 30 days either side — and it applies to losses only, not to gains.
- Does my state tax capital gains?
- Most states tax them as ordinary income with no preferential rate, which means the state bill on a large gain can exceed the federal one at moderate incomes. A few tax them at a higher rate than ordinary income, and the states with no income tax do not tax them at all. Each state page here carries its own rates.