Capital gains tax in retirement accounts is essentially a non-issue while the money stays inside the account: selling a winning stock, rebalancing a fund, or rotating between investments inside a traditional IRA, Roth IRA, 401(k), or Roth 401(k) produces no tax bill. What matters is how the money is taxed when it leaves. Traditional account withdrawals are taxed as ordinary income at rates from 10% to 37% for 2026.1Internal Revenue Service. Tax Inflation Adjustments for Tax Year 2026 Qualified Roth withdrawals come out entirely tax-free, gains included. The preferential long-term capital gains rates that matter so much in a brokerage account don’t exist inside either type of retirement plan.
Why Trades Inside the Account Aren’t Taxed
The trust that holds a qualified retirement plan is itself exempt from federal income tax under the same provision that covers charities and other tax-exempt organizations.2Office of the Law Revision Counsel. 26 USC 501 – Exemption From Tax on Corporations, Certain Trusts, Etc. Because the trust doesn’t owe tax, nothing that happens inside it triggers a taxable event. Sell a stock that tripled, move the proceeds into a bond fund, sell that a year later, rotate into an index fund. None of those trades produces a 1099-B or a line on your return. The full amount of every gain stays invested and keeps compounding.
This is the structural advantage of a retirement account. In a regular brokerage account, selling a winner creates a tax liability that year, which means less money reinvested going forward. Inside a 401(k) or IRA, the account acts as a tax-free bubble where the IRS only cares about money flowing in and money flowing out. What happens between those two events is invisible to the tax code.
Why the Long-Term Capital Gains Rates Don’t Apply
In a taxable brokerage account, long-term capital gains on assets held longer than a year get favorable treatment: 0%, 15%, or 20% depending on your income.3Internal Revenue Service. Topic No. 409, Capital Gains and Losses Retirement accounts don’t use those rates at all.
The IRS treats each retirement account as a single pool of money. It doesn’t track which dollars came from stock appreciation, which from dividends, which from bond interest. When money leaves the account, the character of the underlying gains is erased. For traditional accounts, every withdrawal is ordinary income. For Roth accounts, qualified withdrawals are tax-free regardless of what generated the growth. The careful tracking of cost basis and holding periods that matters in a brokerage account is unnecessary inside a retirement plan.
This is where the trade-off lives. Hold growth stocks for decades in a taxable account and you’d pay at most 20% on the appreciation when you sell. The same growth inside a traditional IRA eventually gets taxed at your ordinary income rate, which could be 22%, 24%, or higher. Decades of tax-free compounding and the deferral itself usually more than compensate for the higher rate on withdrawal, but the mechanics are worth understanding rather than assuming a retirement account is always the better wrapper for every investment.
How Traditional Withdrawals Are Taxed
When you withdraw money from a traditional IRA or 401(k), the full distribution is treated as ordinary income for that year.4Office of the Law Revision Counsel. 26 USC 72 – Annuities; Certain Proceeds of Endowment and Life Insurance Contracts The plan administrator reports the distribution on Form 1099-R, and you include it on your return.5Internal Revenue Service. Instructions for Forms 1099-R and 5498 For 2026, federal income tax brackets run from 10% on the first $12,400 of taxable income (single filers) up to 37% on income above $640,600.1Internal Revenue Service. Tax Inflation Adjustments for Tax Year 2026
A large withdrawal can push you into a higher bracket for the year. Take out $80,000 in a single year on top of $30,000 in Social Security income, and you’re looking at $110,000 in combined income, well into the 24% bracket for a single filer. Spreading withdrawals across multiple years or timing them into lower-income years is one of the more effective tax planning moves in retirement.
Nondeductible Contributions and Basis
There’s one exception to the everything-is-taxable rule for traditional accounts. If you made nondeductible contributions to a traditional IRA (typically because your income exceeded the deduction threshold), those contributions created a cost basis in the account. Since you already paid tax on that money going in, the IRS doesn’t tax it again coming out. You track this basis on Form 8606, and each withdrawal is split proportionally between taxable and nontaxable portions based on the ratio of your basis to your total traditional IRA balance. Failing to file Form 8606 is one of the most common and costly mistakes people make, because without it, you’ll pay tax on money that should come out free.
How Roth Withdrawals Are Taxed
Qualified distributions from a Roth IRA are entirely tax-free, and that includes every dollar of investment gains. To qualify, you must be at least 59½ and the account must have been open for at least five tax years from the date of your first Roth contribution.6Office of the Law Revision Counsel. 26 USC 408A – Roth IRAs Once both conditions are met, you can withdraw everything without owing federal income tax.
Withdraw before meeting those requirements and the rules layer. Your direct contributions come out first, tax-free and penalty-free, because you already paid tax on them. Conversion amounts come out next (taxable portion before nontaxable). Earnings come out last and are subject to ordinary income tax plus a potential 10% early withdrawal penalty if you’re under 59½. The ordering matters more than people realize: you can access your contribution dollars at any time, but touching earnings early triggers real costs.
Roth 401(k) accounts follow the same principle of tax-free qualified withdrawals. Since 2024, they also share the Roth IRA’s exemption from required minimum distributions during the owner’s lifetime, so you’re no longer forced to draw the account down at a specific age.
The One Place Capital Gains Rates Do Apply: NUA
There is one narrow scenario where retirement account gains actually get taxed at capital gains rates rather than ordinary income rates. If your 401(k) holds your employer’s stock, you may qualify for net unrealized appreciation (NUA) treatment when you take a lump-sum distribution.7Office of the Law Revision Counsel. 26 USC 402 – Taxability of Beneficiary of Employees Trust
Here’s how it works. When you distribute the employer stock in-kind, as actual shares rather than cash, you pay ordinary income tax only on the original cost basis of the stock. The appreciation that built up while the stock sat in the plan is taxed at long-term capital gains rates when you eventually sell the shares. If the cost basis was $30,000 and the stock is now worth $200,000, you’d pay ordinary income tax on $30,000 and long-term capital gains tax on the $170,000 gain when sold.
The requirements are strict. You must take a lump-sum distribution of your entire account balance within a single tax year, triggered by separation from service, reaching age 59½, disability, or death. The stock must be distributed as shares. Miss any requirement and the entire distribution reverts to ordinary income treatment. NUA only pays off when the appreciation is large relative to the cost basis, and coordinating it usually calls for a tax professional.
Where the Shelter Breaks: Collectibles and UBTI
The tax-free bubble has limits. If an IRA acquires a collectible such as artwork, antiques, rugs, gems, stamps, or most coins, the purchase price is treated as an immediate taxable distribution to the account owner.8Office of the Law Revision Counsel. 26 USC 408 – Individual Retirement Accounts The early withdrawal penalty can apply if the owner is under 59½. Certain U.S. gold, silver, and platinum coins and bullion held by an approved trustee are specifically exempted from this rule.
A separate issue arises when a retirement account invests in partnerships or debt-financed real estate. If the underlying investment uses borrowed money, the income attributable to that leverage can generate unrelated business taxable income. When gross UBTI across all investments in the account reaches $1,000 or more, the account must file Form 990-T and pay tax on the income.9Internal Revenue Service. Unrelated Business Income Tax This catches some investors off guard, because they expect everything inside a retirement account to be tax-sheltered. Leveraged real estate in a self-directed IRA and certain master limited partnerships are the most common triggers.
Inherited Accounts Don’t Get a Step-Up
Retirement accounts do not receive a step-up in cost basis when the owner dies. This is a critical difference from taxable investment accounts, where heirs inherit stocks and funds at their market value on the date of death, erasing all unrealized capital gains. When you inherit a traditional IRA or 401(k), every dollar you withdraw is ordinary income, just as it would have been for the original owner. The IRS classifies these distributions as income in respect of a decedent.10Internal Revenue Service. Publication 559, Survivors, Executors, and Administrators
Most non-spouse beneficiaries must empty an inherited retirement account within 10 years of the owner’s death.11Internal Revenue Service. Retirement Topics – Beneficiary Spouses have more flexibility, including the option to roll the inherited account into their own IRA and treat it as theirs. Inherited Roth IRAs are also subject to the 10-year rule for non-spouse beneficiaries, but since qualified Roth distributions are tax-free, the impact is less painful. The five-year clock for Roth qualification runs from the original owner’s first contribution, not from when you inherited the account.