This site explains how Social Security, Medicare, and retirement accounts work as systems. It is not financial, tax, or legal advice, and it does not tell you what to do with your own retirement. For official guidance, see the Social Security Administration and Medicare.gov. What this is.

Capital Gains Tax on Retirement Investments

Capital gains taxation in the context of retirement investing is not a single rule. It is the intersection of two separate frameworks: the federal capital gains rate structure, which applies to assets sold in taxable brokerage accounts, and the account-level tax treatment that governs traditional IRAs, Roth IRAs, and 401(k) plans. Whether a gain is taxed as a capital gain at all depends on where the asset is held, not merely on whether the asset appreciated.

This piece covers how the federal capital gains rate brackets operate, how account type overrides or bypasses those brackets entirely, and where the interaction between the two frameworks produces results that differ from what a straightforward reading of either rule would suggest.

Turn Test Results Into Better Decisions

Learn practical approaches to test analytics, reliability, observability, reporting, and AI-powered quality.

Learn more

How the Federal Capital Gains Rate Structure Actually Works

The Internal Revenue Code distinguishes between short-term and long-term capital gains. A short-term gain arises from the sale of an asset held for one year or less; it is taxed at ordinary income rates, the same brackets that apply to wages and salaries. A long-term gain arises from an asset held for more than one year and is taxed at preferential rates: 0%, 15%, or 20%, depending on the taxpayer's taxable income and filing status for the year of sale. A separate 3.8% Net Investment Income Tax (NIIT) can also apply to net investment income — including capital gains — for taxpayers whose modified adjusted gross income exceeds statutory thresholds ($200,000 for single filers, $250,000 for married filing jointly, as set by IRC § 1411). These thresholds are not indexed for inflation.

The 0% long-term rate applies to gains that fall within the lower taxable income brackets. For 2024, a single filer with taxable income up to $47,025 pays 0% on long-term capital gains; the 15% rate applies up to $518,900; the 20% rate applies above that. These thresholds are adjusted annually by the IRS. The critical point is that capital gains are stacked on top of ordinary income when determining which rate applies — ordinary income fills the lower brackets first, and gains occupy whatever space remains.

Assets sold inside a tax-advantaged retirement account — a traditional IRA, Roth IRA, or 401(k) — do not generate a capital gains event at the time of sale. The account wrapper absorbs the transaction. Gains compound without triggering a reportable gain in the year they occur. The tax consequence arrives only at distribution, and at that point the character of the income is determined by the account type, not by the nature of the original asset or how long it was held. This is the central mechanical distinction that separates retirement account investing from taxable account investing.

For traditional IRAs and 401(k) plans, distributions are taxed as ordinary income regardless of whether the underlying assets generated long-term capital gains, dividends, or interest while inside the account. The preferential long-term capital gains rate does not apply to distributions from these accounts. A full explanation of how withdrawal taxation differs by account type covers the mechanics of each account's distribution rules in detail. For Roth IRAs and Roth 401(k)s, qualified distributions are excluded from gross income entirely — meaning neither ordinary income rates nor capital gains rates apply, provided the distribution meets the qualified distribution requirements (the account must be at least five years old and the account holder must be at least 59½, deceased, or disabled).

In a taxable brokerage account, by contrast, every sale of an appreciated asset is a taxable event in the year it occurs. The investor or the account's custodian reports the gain on Form 1099-B. Short-term gains are folded into ordinary income. Long-term gains are reported separately and taxed at the preferential rates described above. Reinvested dividends increase the cost basis of shares, which affects the size of the gain calculated at sale. Wash-sale rules can also disallow a loss if a substantially identical security is repurchased within 30 days before or after the sale.

Who Administers Capital Gains Reporting for Retirement Investors

For assets held in taxable accounts, the custodian — typically a brokerage — is required under IRS rules to track cost basis and report proceeds and basis information to both the account holder and the IRS on Form 1099-B. The account holder is responsible for reporting the gain or loss on Schedule D of Form 1040 and, where applicable, on Form 8949. The custodian's cost-basis reporting applies to "covered" securities, generally those acquired after the effective dates established by the Emergency Economic Stabilization Act of 2008 and subsequent IRS guidance. For "uncovered" securities acquired before those dates, cost basis is not reported to the IRS by the custodian, and the account holder bears full responsibility for the calculation.

For assets held inside a traditional IRA or 401(k), the plan administrator or IRA custodian does not report capital gains to the IRS because no taxable event occurs at the point of sale within the account. When a distribution is taken, the administrator issues a Form 1099-R reporting the gross distribution amount and the taxable amount. The form does not distinguish between amounts attributable to capital gains, dividends, or interest earned inside the account — all of it is reported as a single ordinary income figure. The IRS receives no breakdown of what generated the growth.

State tax agencies receive copies of federal information returns in many states, but state treatment of retirement income varies considerably — some states exempt retirement account distributions entirely, others tax them at ordinary income rates, and a handful have no income tax at all. State treatment of capital gains from taxable accounts also varies; some states tax all capital gains as ordinary income, while others provide partial exclusions.

Where Capital Gains Rules Produce Unexpected Results for Retirement Investors

The most common point of friction is the conversion of long-term capital gain character into ordinary income inside a traditional IRA or 401(k). An investor who holds a stock for twenty years inside a traditional IRA, watching it appreciate substantially, does not benefit from the 0%, 15%, or 20% long-term capital gains rates when the funds are eventually distributed. Every dollar comes out as ordinary income. For investors in higher income brackets during retirement, this can mean the effective rate on that growth is higher than it would have been in a taxable account where long-term gains would have qualified for preferential treatment.

The inverse situation arises with Roth IRAs. Because qualified Roth distributions are excluded from gross income entirely, assets that would have generated ordinary income — such as interest from bonds or short-term trading gains — benefit from the same tax-free treatment as assets that would have generated long-term capital gains. The Roth account does not distinguish between asset types at distribution. The interaction between traditional and Roth IRA tax treatment determines which account type produces a more favorable outcome for a given asset class, though the answer depends on future tax rates and income levels that are unknown at the time of contribution.

A second friction point involves required minimum distributions (RMDs) from traditional IRAs and 401(k) plans. RMDs are calculated based on the account balance and a life expectancy factor from IRS tables, not on realized gains. A year in which markets have risen sharply increases account balances and can increase the following year's RMD, which in turn increases ordinary income — potentially pushing the account holder into a higher bracket or triggering the NIIT on other investment income. The RMD itself does not constitute a capital gain; it is ordinary income. However, the increased ordinary income it generates can cause long-term capital gains from taxable accounts in the same year to be taxed at a higher rate, because ordinary income fills the lower brackets first.

A third friction point involves the step-up in cost basis at death. Assets held in a taxable account receive a stepped-up basis to fair market value at the date of the owner's death under IRC § 1014. This effectively eliminates the capital gains tax on appreciation that occurred during the decedent's lifetime for assets passing through an estate. Assets inside a traditional IRA or 401(k) do not receive this treatment — the income tax deferral that accumulated inside the account remains embedded in the asset, and beneficiaries who inherit these accounts must take distributions and pay ordinary income tax on them, subject to the rules applicable to inherited retirement accounts under the SECURE Act and SECURE 2.0.

A fourth friction point involves tax-loss harvesting in taxable accounts. Selling a depreciated asset to realize a loss that offsets capital gains elsewhere in the portfolio is only possible in a taxable account. Inside an IRA or 401(k), losses on individual securities have no tax consequence — they reduce the account balance, but they cannot be harvested to offset gains, because no taxable event occurs inside the account wrapper.

What Tax Documents Show — and Do Not Show — for These Gains

For taxable brokerage accounts, the Form 1099-B issued by the custodian each January shows proceeds from sales, cost basis (for covered securities), and whether each position was held short-term or long-term. It does not show unrealized gains on positions still held. The account holder uses this information to complete Form 8949 and Schedule D. The 1099-B will also report any wash-sale adjustments that the custodian tracked, though the custodian is only required to track wash sales within the same account — cross-account wash sales remain the account holder's responsibility to identify.

For traditional IRA and 401(k) distributions, the Form 1099-R shows the gross distribution in Box 1 and the taxable amount in Box 2a. Box 7 contains a distribution code indicating the nature of the distribution (normal, early, death, disability, etc.). The form does not show what portion of the distribution represents original contributions, employer contributions, earnings from interest, earnings from dividends, or appreciation from capital gains. All of it is collapsed into a single taxable figure. There is no mechanism on the 1099-R for the IRS to distinguish between the character of the underlying assets that generated the account's growth.

For Roth IRA distributions, Form 1099-R is still issued, but Box 2a may show $0 taxable if the distribution is qualified. The account holder must track the five-year holding period and other qualification criteria independently; the custodian does not certify on the form that a distribution is qualified. The IRS may request substantiation, and the account holder is responsible for demonstrating that the distribution meets the requirements for tax-free treatment.

Annual account statements from custodians and plan administrators show the account balance and may show unrealized gains, but these figures are informational only. No tax liability attaches to unrealized gains inside any account type — taxable or tax-advantaged — until a sale or distribution occurs.

The capital gains framework and the retirement account tax framework operate on separate tracks that intersect at the point of distribution, and the interaction between them — particularly the loss of preferential rates inside traditional accounts and the elimination of basis step-up — is a structural feature of the tax code rather than an anomaly.

Sources

Note: This explains how a retirement system works. It is not financial, tax, or legal advice, it is not specific to any individual's retirement, and it is not a substitute for a licensed financial, tax, or legal professional. Rules, ages, and dollar limits change by year — check the cited sources.

6 desks. How it works, not what to do.

Start from the top