What a capital gain is and why the holding period dominates
A capital gain is the profit on the disposal of a capital asset: proceeds less adjusted basis less the costs of selling. Basis is what you paid plus everything the code lets you add — purchase commissions, reinvested dividends on a fund, capital improvements on property — and getting it wrong is the single largest source of error in this calculation, because every dollar of understated basis is a dollar of phantom gain.
The holding period then decides which rate schedule applies. More than one year and the gain is long-term, taxed under IRC §1(h) at 0, 15 or 20 percent. One year or less and it is short-term, which means it is simply ordinary income at your bracket rate. The count runs from the day after you acquired the asset to the day you disposed of it, so an asset bought on 3 March 2025 becomes long-term on 4 March 2026.
The difference is large. A single filer with $85,000 of ordinary taxable income who realises a $19,500 gain in 2026 pays $2,925 if the asset was long-term and $4,290 if it was short-term — a $1,365 difference for one day of holding. On a large position the gap runs to five and six figures, which is why the holding period is worth tracking lot by lot.
On top of either schedule sits the 3.8 percent net investment income tax under §1411, which applies once modified AGI passes $200,000 single, $250,000 joint or $125,000 married filing separately. Those thresholds are statutory and are not indexed for inflation, so more households cross them every year.
The formula, and what “stacking” means
Step one is the gain itself. Proceeds minus adjusted basis minus selling costs. Selling costs can be netted against proceeds or added to basis; the arithmetic is identical, and this calculator shows them as a separate line so you can see their effect.
Step two is stacking, and it is the part most calculators get wrong. Long-term capital gain is not taxed in isolation. Your ordinary taxable income fills the bottom of the scale first, and the gain sits on top of it. The capital gains breakpoints are then measured against total taxable income. So a single filer in 2026 with $45,000 of ordinary income and a $10,000 long-term gain does not get the whole gain in the 0 percent band: the band runs to $49,450 of total taxable income, so $4,450 of the gain is taxed at 0 percent and the remaining $5,550 at 15 percent.
Step three is short-term treatment when it applies. A short-term gain is ordinary income, so the tax it causes is the difference between your graduated tax with the gain and without it. That difference is the right way to compute it, because a large gain can push you through more than one bracket.
Step four is the net investment income tax. It is 3.8 percent of the lesser of net investment income and the excess of modified AGI over the threshold. The lesser-of test matters: a household $5,000 over the threshold with a $200,000 gain pays 3.8 percent on $5,000, not on $200,000. Note that MAGI is an AGI-based figure and is normally higher than taxable income, which is why the calculator asks for it separately rather than reusing the taxable income you entered.
Two rates the schedule does not cover. Long-term gain on collectibles is taxed at up to 28 percent, and unrecaptured §1250 gain on depreciable real property at up to 25 percent. Both are outside this calculator; if you are selling a rental, deal with depreciation recapture first — the rental property depreciation calculator shows how much has accumulated.
Worked example: $60,000 sale, $40,000 basis, held two years
A single filer with $85,000 of ordinary taxable income in 2026 sells shares for $60,000. They paid $40,000 including commission, and the broker charged $500 to sell. They have held the position for two years, and their modified AGI excluding the gain is $100,000.
- Realised gain. 60,000 − 40,000 − 500 = $19,500.
- Stack it. Ordinary taxable income is $85,000, so the gain occupies total taxable income from $85,000 to $104,500.
- Find the band. The 2026 single 0 percent band ends at $49,450 and the 15 percent band ends at $545,500. The whole slice from $85,000 to $104,500 sits inside the 15 percent band.
- Federal capital gains tax. 19,500 × 0.15 = $2,925.00.
- Net investment income tax. MAGI is 100,000 + 19,500 = $119,500, below the $200,000 single threshold, so the NIIT is $0.
- Cash after tax. 60,000 − 500 − 2,925 = $56,575.00.
- Effective rate on the gain. 2,925 ÷ 19,500 = 15.00 percent.
Now run the same sale as short-term. The gain becomes ordinary income stacked from $85,000 to $104,500, which is entirely inside the 22 percent bracket that runs from $50,400 to $105,700, so the tax is 19,500 × 0.22 = $4,290.00. The extra federal cost of selling early is 4,290 − 2,925 = $1,365, and the cash after tax falls to $55,210.
How to read the result
The effective rate on the gain is the number to compare across scenarios. It blends the bands the gain straddles plus any NIIT and state tax, so it answers “what did this sale actually cost me?” in one figure. In the straddle example above it is 8.325 percent, well below the 15 percent headline rate, because $4,450 of the gain paid nothing.
Your ordinary income, not the size of the gain, decides the band. Two people realising an identical $10,000 gain can pay $0 and $2,000 depending on what else they earned. That is why gain harvesting in a low-income year — a sabbatical, a gap between jobs, the years between retiring and claiming Social Security — is one of the few genuinely reliable tax strategies available to an individual investor.
Watch the NIIT threshold separately from the bracket thresholds. A gain that crosses $200,000 of MAGI adds 3.8 points to the marginal cost of every additional dollar of investment income, which is a bigger jump than the 15-to-20 percent step in most cases. Because the thresholds are not indexed, they behave like a slowly tightening ratchet.
A loss is not a wasted result. Capital losses offset capital gains of the same character first, then the opposite character, then up to $3,000 of ordinary income a year, with the remainder carried forward indefinitely. The wash sale rule disallows the loss if you buy a substantially identical security within 30 days either side of the sale — that window is 61 days long in total, and it applies across accounts.
State tax is often the larger surprise. Most states with an income tax treat capital gains as ordinary income with no preferential rate, so a 5 percent state rate adds a third again to a 15 percent federal bill. Use the marginal vs effective tax rate calculator to find the state marginal rate your income actually reaches.
Long-term capital gains breakpoints, tax year 2026
| Filing status | 0% band | 15% band | 20% band |
|---|---|---|---|
| Single | up to $49,450.000000 | $49,450.000000 to $545,500.000000 | over $545,500.000000 |
| Married filing jointly | up to $98,900.000000 | $98,900.000000 to $613,700.000000 | over $613,700.000000 |
| Married filing separately | up to $49,450.000000 | $49,450.000000 to $306,850.000000 | over $306,850.000000 |
| Head of household | up to $66,200.000000 | $66,200.000000 to $579,600.000000 | over $579,600.000000 |
Measured on total taxable income with the gain stacked on top of ordinary income. Figures come from the IRS annual inflation adjustments; the 2025 schedule is available in the calculator above.
Mistakes that change the answer
- Understating basis. Reinvested dividends and capital gain distributions are purchases, and each one adds to basis. Ignoring a decade of reinvestment on a fund can overstate the gain by a third.
- Miscounting the holding period. The clock starts the day after acquisition, and an asset held exactly twelve months is short-term. For inherited property the basis is stepped up to date-of-death value and the holding period is automatically long-term.
- Applying the capital gains rate to the whole gain when it straddles a band. Stack it and split it, exactly as the calculator's table shows.
- Forgetting that the gain moves you up the scale. A large long-term gain does not push your ordinary income into a higher bracket, but it does raise total taxable income, which can move later slices of the gain from 15 percent to 20 percent and can trigger the NIIT.
- Treating a wash sale as a realised loss. Buying back within 30 days disallows the loss and adds it to the basis of the replacement shares instead.
- Ignoring depreciation recapture on property. Depreciation taken on a rental is recaptured at up to 25 percent before the residual gain gets capital gains treatment.
- Assuming a home sale is fully taxable. Section 121 excludes up to $250,000 of gain, or $500,000 on a joint return, on a principal residence owned and occupied for two of the last five years.
The 0 percent band is not a tax-free allowance
The 0 percent long-term band is a band of total taxable income, not a per-taxpayer allowance you can spend anywhere. It applies only to the part of the gain that stacks below the breakpoint, and ordinary income fills that space first. A single filer in 2026 with $49,450 or more of ordinary taxable income gets none of it. And a gain taxed at 0 percent federally is still income for every other purpose: it counts toward the net investment income tax threshold, toward state tax, toward the taxable portion of Social Security benefits, and toward ACA premium tax credit reconciliation.
Key terms
- Adjusted basis
- Original cost plus purchase commissions, reinvested distributions and capital improvements, less depreciation taken and any return of capital.
- Realised versus recognised
- A gain is realised when you dispose of the asset and recognised when it enters taxable income. Like-kind exchanges under §1031 and installment sales delay recognition.
- Stacking
- Placing long-term gain on top of ordinary taxable income so that ordinary income determines which capital gains band each slice of gain falls in.
- Wash sale
- A sale at a loss with a purchase of substantially identical securities within 30 days before or after. The loss is disallowed and added to the basis of the replacement shares.
- Net investment income tax
- A 3.8 percent surtax under §1411 on the lesser of net investment income and the excess of modified AGI over a statutory, unindexed threshold.
Related calculations and when to use a different tool
This calculator prices a single disposal. For a whole year you would net short-term gains and losses against each other, net long-term against long-term, then net the two results, and only the surviving figure is taxed. Feed the result into the taxable income calculator as part of other income, then price the ordinary portion with the progressive tax bracket calculator.
A gain realised without withholding usually creates an estimated tax obligation. A large sale in one quarter can trigger an underpayment penalty even if you pay in full by April, because the safe harbours are tested quarter by quarter — size the instalments with the quarterly estimated tax calculator, and check the balance with the income tax refund estimator.
Different asset classes have their own rules that sit outside this schedule. Qualified small business stock under §1202 can be excluded from gain entirely; collectibles are capped at 28 percent; section 1256 contracts are marked to market and split 60/40 between long and short regardless of holding period; and gains inside a retirement account are not taxed on realisation at all, which is why asset location matters as much as asset allocation.
Finally, the character of the gain is worth as much attention as the amount. Converting ordinary income into long-term capital gain is the largest single rate arbitrage in the individual code — 37 percent against 20 percent at the top — and it is exactly why the rules on holding periods, carried interest and constructive sales are as detailed as they are.
