The federal tax code holds a bracket that surprises even longtime retirees: a 0% rate on long-term capital gains, and it isn’t a rounding trick or a temporary provision. A retiree who sells stock, mutual fund shares, or other investments held more than a year can, inside the right income range, owe nothing on the gain, no matter how far the sale price climbed above the original purchase price. The part nobody advertises is that ordinary income claims the room in that bracket first, not the capital gain itself, which is why two retirees with identical portfolios can land on opposite sides of the line.
How the IRS Stacks Ordinary Income Ahead of the Gain
The mechanism works because the IRS treats a capital gain as sitting on top of every other dollar of income, not as a separate pool taxed on its own terms. A retiree’s wages, pension distributions, taxable IRA withdrawals, and any taxable portion of Social Security are added together first to establish taxable income, and only after that number is set does the tax code ask how much room remains under the 0% ceiling. If ordinary income already fills most of the available space, only the leftover room, not the full sale, actually clears the bracket tax-free.
That leftover room is defined by three exact numbers. According to the IRS’s current capital-gains guidance, the 0% rate applies in full when taxable income falls at or below $48,350 for single filers, $64,750 for heads of household, or $96,700 for married couples filing jointly, for the 2025 tax year. A married couple filing jointly gets nearly double the room of a single filer even though both face the identical 0% rate, and a widow or widower who becomes a single filer the year after a spouse’s death can watch the same portfolio sale that was untaxed one year generate real tax the next, without selling a single additional share.
The stacking rule also rewards spreading a large sale across tax years rather than realizing it all at once. A retiree sitting on a $60,000 unrealized gain who sells the entire position in one year risks pushing a meaningful slice of it above the ceiling into the 15% bracket, while selling only enough each year to stay under the threshold can move the full $60,000 through the 0% bracket over two or three years without a dollar of it ever crossing into a taxed rate.
Free retirement updates: Social Security and Medicare change every year, and nobody sends you a memo. Our free Retirement Shield newsletter breaks down what changed and what to do. Get it free in your inbox.
Why Taxed Social Security Benefits Shrink the Room
Social Security benefits complicate the math because they can convert from tax-free to partially taxable the moment a retiree adds capital gains into the picture. Under the formula the IRS applies to Social Security and equivalent railroad retirement benefits, up to 85% of benefits become taxable once modified adjusted gross income plus half of the benefits received in the year exceeds $25,000 for a single filer or $32,000 for a married couple filing jointly, thresholds that have never been adjusted for inflation since Congress fixed them in the 1980s. Once that taxable share of Social Security is counted, it behaves exactly like wages or pension income and occupies part of the 0% capital-gains ceiling before a single share is sold.
The interaction can be counterintuitive. Selling investments to realize a gain that is itself untaxed can simultaneously push a larger share of a retiree’s Social Security benefit into taxable territory, because the sale raises modified adjusted gross income even while the capital-gains rate on it stays at zero. A retiree who models only the capital-gains side of a planned sale can be surprised by a higher total tax bill driven entirely by the Social Security side of the same return.
Consider a retired single filer collecting $24,000 in Social Security and $20,000 from a pension. Roughly half of that Social Security becomes taxable once the pension is added on top of it, lifting taxable income into the mid-$30,000s before a single investment is sold, which leaves meaningfully less than the full $48,350 ceiling available for a 0% capital gain even though the retiree’s total cash income looks modest on paper.
The Guardrails: State Taxes, the Investment Surtax, and the One-Dollar Cliff Myth
The federal 0% rate does not guarantee a $0 total tax bill. Most states that tax income treat long-term capital gains as ordinary income with no parallel 0% bracket of their own, so a retiree can genuinely owe nothing to the IRS on a stock sale while still owing state tax on the identical gain, depending on where the return is filed. That state-level gap gets missed because retirement guidance overwhelmingly focuses on the federal number.
The other guardrail people worry about, the 3.8% net investment income tax, rarely touches anyone actually operating inside the 0% bracket. The IRS applies that surtax only once modified adjusted gross income exceeds $200,000 for a single filer or $250,000 for a married couple filing jointly, more than four times the ceiling that defines the 0% capital-gains bracket itself, which makes it a non-issue for the retirees this bracket is built for.
What trips people up instead is treating the ceiling as a cliff rather than a marginal line. Crossing the threshold by a single dollar does not tax the entire gain at 15%; it taxes only the portion of the gain that falls above the line, while everything under the ceiling still owes nothing. That distinction matters because it changes the real decision retirees face each year: not whether to sell at all, but how much of a gain to realize before the next dollar of ordinary income, a Roth conversion, an extra IRA withdrawal, a bonus pension payment, starts claiming the same room the capital gain was counting on.
This article was researched and drafted with the assistance of artificial intelligence.
More Financial Reading