Tax guide
Do you pay capital gains tax in an IRA or 401(k)?
Updated 2026-08-18 · Educational only — not tax advice
Inside a traditional IRA or 401(k), buying and selling stocks, ETFs, or funds generally does not create a current capital-gains tax bill. The account is tax-deferred: you typically pay ordinary income tax on withdrawals later (and may owe a penalty on early distributions). Roth IRAs and designated Roth 401(k)s follow contribution and qualified-distribution rules instead of per-trade capital gains.
That is the opposite of a taxable brokerage account, where each sale can be a Form 8949 event with short-term or long-term rates, NIIT, and state tax. Tax-loss harvesting and wash sales are brokerage-account concepts; they do not create a deductible capital loss inside the IRA the way a taxable sale can.
When capital gains still matter
If you do a Roth conversion, the converted amount is generally taxed as ordinary income, not as a long-term capital gain — even if the IRA holds appreciated shares. After-tax basis in an IRA can change the taxable portion of a distribution.
Use the capital gains calculator for taxable account sales, not for IRA rebalancing. If you are comparing “sell in my 401(k)” vs “sell in my brokerage,” the brokerage sale is the one that needs holding period, basis, and state inputs.
