Tax year 2026 figures. Last updated .
What "avoid" can and cannot mean
Worth being precise, because the phrase covers two very different things. Concealing a gain you realised is evasion, it is a crime, and nothing on this page is about that. Arranging your affairs so that a gain is taxed at a lower rate, in a different year, or not at all is avoidance — and the levers below are ones the statute explicitly provides.
The useful mental model: the gain itself is rarely avoidable once you have decided to sell. The rate is very often avoidable, because the rate is set by facts you control.
1. Cross the one-year line
The largest lever, and the one requiring the least ingenuity. Holding more than one year moves a gain off the ordinary income table and onto the 0/15/20 ladder.
For a single filer at $80,000 of salary that is roughly 22-24% becoming 15%. Higher up it is 37% becoming 20%. On a $200,000 gain the saving exceeds $30,000, and the only requirement is a sale date.
2. Realise in a low-income year
Because the rate depends on total taxable income, the same gain costs different amounts in different years. A single filer whose taxable income including the gain stays at or below $49,450 pays nothing federally on a long-term gain.
A gap between jobs, a sabbatical, the years between retiring and drawing a pension, a year with business losses — these are the windows where a deliberately realised gain can be free. It also resets your basis upward at no cost, which reduces the taxable gain on a future sale.
3. Split the disposal across two tax years
Selling half in December and half in January puts each half lower in its own year’s stack. Where a single sale would push the top slice into the 20% band or over the net investment income tax threshold, two smaller ones may not.
This works best when the gain is large relative to your ordinary income, and not at all when your income already exceeds the ceilings on its own.
4. Harvest losses deliberately
Realising losses in the same year as gains offsets them dollar for dollar, and the netting rules apply short-term losses against short-term gains first — sheltering the most expensively taxed gains before anything else.
Excess losses offset up to $3,000 of ordinary income a year and carry forward indefinitely with no expiry. Mind the wash sale rule: buying a substantially identical security within thirty days before or after the sale disallows the loss.
5. Watch the net investment income tax threshold
The 3.8% surtax begins at $200,000 of modified AGI single, $250,000 joint. Because it applies to the lesser of net investment income and the excess over the threshold, keeping modified AGI just below the line can remove the tax entirely rather than reducing it.
Note this threshold is measured on modified AGI, before the deduction — so the levers that move it are different from the ones that move taxable income. Deductible retirement contributions reduce AGI; the standard deduction does not.
6. Give the asset away, or leave it
Appreciated assets donated to a qualifying charity generally avoid the gain entirely while producing a deduction based on market value, which is the rare lever that helps on both sides of the return.
Assets held until death generally receive a stepped-up basis, extinguishing the unrealised gain for the heirs. That is a real feature of the system rather than a loophole, and it is why "never sell" is sometimes the tax-optimal answer — though organising a portfolio around it is a decision with obvious non-tax costs.
What this page is not
These are levers, not advice. Which apply to you depends on facts this site cannot see, and several interact with rules — wash sales, the alternative minimum tax, state conformity — that the calculator does not model. Run the numbers here, then take them to a CPA or enrolled agent before acting.
Retirement accounts change the question entirely
Inside a 401(k), a traditional IRA or a Roth, there is no capital gains tax at all. Trades do not generate taxable events, so rebalancing is free and holding period is irrelevant.
What differs is the treatment on the way out. Traditional accounts tax withdrawals as ordinary income — so a long-term gain earned inside one is ultimately taxed at ordinary rates, not the preferential ladder. Roth accounts, funded with taxed money, generally come out free.
The practical implication is about asset location rather than avoidance: assets throwing off short-term gains or non-qualified income are better held in a tax-sheltered account, while assets you intend to hold for years and leave to heirs may be better in a taxable one, where the stepped-up basis applies and the preferential rates are available.
What does not work
Reinvesting the proceeds does not defer anything. Selling shares and immediately buying different shares is a completed disposal; the gain is taxable in that year regardless of what the money does next. The 1031 exchange, which does defer, applies to real property held for investment and not to securities.
Selling at a loss and buying back immediately does not bank the loss — that is the wash sale rule.
Neither does moving to a no-income-tax state on the eve of a sale, at least not reliably. States apply residency tests and source rules, and several audit exactly this pattern. Gains sourced to real property in a state are generally taxable by that state whatever your residency.
And gifting an appreciated asset does not erase the gain: the recipient generally takes your basis and your holding period, so the gain travels with the asset.
Charitable giving, in a little more detail
Donating an appreciated asset directly to a qualifying charity is the one lever that helps on both sides of the return at once, and it is worth understanding why.
If you sell first and donate the cash, you realise the gain and pay tax on it, then deduct the donation. If you donate the asset itself, the charity sells it free of tax and you generally deduct its market value — so the embedded gain is never taxed at all, to anyone.
The asset needs to have been held more than a year for the deduction to be based on market value rather than basis, and percentage-of-AGI limits cap how much can be deducted in a year, with the excess carried forward. Donor-advised funds are commonly used to take the deduction in a high-income year while distributing to charities over time.
This is genuinely one of the more efficient provisions in the code for someone who was going to give anyway. It is not a way of coming out ahead on a gift, and it involves rules — qualified appraisals for some assets, substantiation requirements — that sit outside anything this calculator models.
The order to consider these in
The levers are not equally powerful and they are not independent. A rough order of consideration, for someone deciding whether and when to sell.
Start with the holding period, because it is the largest single saving and the easiest to act on. Then the year: is there a lower-income year coming, or is this one unusually low? Then losses, since harvesting is available right up to year end. Then the threshold checks — the 0% ceiling and the net investment income tax line — which decide whether splitting the disposal is worth the trouble.
Charitable and estate considerations sit outside that sequence, because they answer a different question: not when to sell, but whether to sell at all.
Worked example
Computed by the same engine that powers the calculator, at the moment this page was built — not typed in by hand. Open the derivation to see every rule and citation.
The same gain realised in a low-income year
A single filer between jobs, with $20,000 of income for the year, realises a $28,000 long-term gain.
- Taxable income after deduction
- $31,900
- Taxable gain
- $28,000
- Tax owed without the sale
- $390
- Tax the sale added
- $0
- Total federal tax
- $390
- Effective rate on the gain
- 0%
Taxable income after the standard deduction stays inside the $49,450 zero-rate ceiling, so the federal tax on this gain is nothing at all — and the basis resets upward for free.
Caveats on this example (1)
- Net investment income was derived from capital gains and qualified dividends only. Interest, non-qualified dividends, rents, royalties and passive business income inside ordinaryIncome are also net investment income under IRC 1411(c) and are not counted here.
Show the working — 10 steps, each with its citation
- Net short-term capital gain or loss for the year$0
Assets held one year or less. Taxed at ordinary rates if a net gain.
- Net long-term capital gain or loss for the year$28,000
Assets held more than one year. Eligible for the 0/15/20% rates.
- Standard deduction-$16,100
Adjusted gross income of $48,000 less $16,100.
- Taxable income$31,900
The figure the rate tables and the capital gain ceilings are both measured against.
- Ordinary income taxed at 10%$390
$3,900 of taxable income between $0 and $3,900.
- Ordinary income stacked below the long-term gain$3,900
Long-term gain is taxed by reference to where it sits ON TOP of $3,900 of other taxable income, not from the bottom of the rate table.
- Long-term gain taxed at 0%$0
Taxable income stays at or below the $49,450 maximum zero-rate amount.
- Net investment income tax threshold$200,000
Modified AGI of $48,000 against the $200,000 threshold for a single filer. This threshold is statutory and is not adjusted for inflation.
- Net investment income tax does not apply$0
Modified AGI is $152,000 below the threshold.
- Total tax$390
$390 on $48,000 of total income, an effective rate of 0.81%.
Run your own figures
Nothing you enter leaves your browser. The calculation runs locally and no values are transmitted or stored on a server — see the privacy page.