The short version
A capital gain is the profit from selling something for more than you paid: sale price minus cost basis. How long you held it decides the rate — more than a year gets the friendly 0%, 15%, 20% schedule; a year or less is taxed like wages. Then the gain stacks on top of your other income through the marginal brackets, so each dollar is taxed only at its own band’s rate. The 2026 capital gains brackets estimator runs the whole sequence instantly; the steps below show the hand method.
Step 1: figure your gain (sale price minus basis)
The tax is never on the full sale price — only on the gain. Start with what you received, then subtract your cost basis: usually what you paid, plus buying costs like commissions, plus improvements you made (for property — not repairs). Buy 100 shares at $50 ($5,000), pay a $10 commission, later sell at $62 ($6,200) minus a $10 selling fee: your gain is $6,190 − $5,010 = $1,180. Keep records — purchase confirmations, fee receipts, improvement invoices — because every documented dollar of basis is a dollar that is never taxed.
Step 2: check the holding period — the one-year rule
The holding period runs from the day after you acquire the asset through the day you sell it. Sell on day 365 and the gain is short-term, taxed at your ordinary income rates (10% to 37%). Sell on day 366 and it is long-term, eligible for 0%, 15%, or 20%. That single day is the highest-leverage date in tax planning: a $50,000 gain taxed at 35% instead of 15% costs an extra $10,000. When a sale is near the line, the calendar — not the market — should set the date.
Step 3: stack the gain through the 2026 brackets
Here is the part most explainers gloss over: the brackets apply to your total taxable income including the gain, and your ordinary income fills the lower bands first. Work it with real 2026 numbers. A single filer has $40,000 of other taxable income and a $10,000 long-term gain. The 0% ceiling is $49,450 — so $9,450 of the gain still fits underneath it and is taxed at 0%. The remaining $550 spills into the 15% band: $550 × 15% = $82.50 of tax. Total bill on a $10,000 profit: $82.50. A gain can straddle two or even three bands, but crossing a threshold never re-taxes the dollars below it — that is what “marginal” means.
The 0% bracket is real
For 2026, single filers with taxable income up to $49,450 — joint filers up to $98,900 — pay 0% on qualifying long-term gains. Both wages and gains count toward the income test, so it is reachable on genuinely middle-class incomes, especially in retirement when wages stop. The classic move is gain harvesting: deliberately selling and rebuying appreciated positions to reset the basis upward while the 0% room lasts. A 0% federal rate is not a promise of zero total tax — states may still take their cut — but federally the gain can be free.
Losses can shrink the bill
The IRS makes you net everything before any rate applies: long-term losses against long-term gains, short-term against short-term, then the leftovers cross categories. A $10,000 long-term gain and a $4,000 long-term loss net to a $6,000 taxable gain. If losses win outright, you can deduct up to $3,000 of the excess against ordinary income per year ($1,500 married filing separately) and carry the remainder forward indefinitely — carried losses keep their short/long character for future years. This is the machinery behind tax-loss harvesting: realizing losers in December to offset the year’s winners.
The 3.8% surtax for high earners
Above certain incomes a second tax layers on: the 3.8% Net Investment Income Tax applies when modified adjusted gross income exceeds $200,000 single (or head of household), $250,000 joint, or $125,000 separate. It hits the lesser of your net investment income or the MAGI over the threshold — so a $50,000 gain at $240,000 MAGI (single) adds $40,000 × 3.8% = $1,520, for a 23.8% marginal federal rate. Unlike the brackets, these thresholds are not inflation-adjusted, so more taxpayers drift into NIIT every year.
What the simple version leaves out
Reality has footnotes. Collectibles (art, coins) face up to 28%; unrecaptured Section 1250 gain on depreciated real estate up to 25%. Selling your main home can exclude $250,000 of gain single / $500,000 joint under §121 if you owned and lived there two of the last five years — the exclusion wipes out gain before any rate applies. States mostly tax gains as ordinary income on top of all this. And in a taxable account, reinvesting the proceeds does not help — the sale triggers the tax regardless; only IRAs, 401(k)s and HSAs defer it until withdrawal.
The bottom line: gain = sale price minus basis, the holding period picks the rate schedule, and the gain stacks on top of your other income through marginal bands — each dollar taxed only at its own band’s rate. Run your own numbers through the 2026 capital gains estimator, and check the 2026 federal tax brackets for the ordinary-income side of the stack.
Bright Side Kit. "How Capital Gains Tax Is Calculated." https://brightoolbox.com/guides/how-capital-gains-tax-is-calculated/ Accessed October 22, 2026.