How the Wash Sale Rule Applies to Your 401(k)

The wash sale rule can apply to your 401(k), and when it does the damage is worse than an ordinary wash sale. If you sell a security at a loss in a taxable brokerage account and your 401(k) buys substantially identical shares within 30 days before or after that sale, the IRS disallows the loss. In a normal wash sale the disallowed loss shifts onto the cost basis of the replacement shares, so you recover it later. When the replacement purchase happens inside a 401(k), there is no basis to adjust. The loss is gone permanently.

How the Rule Works in Plain Terms

Internal Revenue Code Section 1091 disallows a loss from selling stock or securities if you buy back substantially identical shares within a 61-day window that runs from 30 days before the sale through 30 days after it.1Office of the Law Revision Counsel. 26 U.S. Code 1091 – Loss From Wash Sales of Stock or Securities The point is to stop investors from selling for a deductible loss and then immediately restoring the same position.

Between two taxable accounts, the consequence is a delay, not an erasure. The disallowed loss gets added to the cost basis of the replacement shares, so when you eventually sell those for good you recover the deduction.1Office of the Law Revision Counsel. 26 U.S. Code 1091 – Loss From Wash Sales of Stock or Securities A retirement account changes that outcome completely.

Why a 401(k) Repurchase Permanently Destroys the Loss

Inside a 401(k), gains and losses on individual holdings never hit your tax return. Distributions come out as ordinary income when you withdraw, regardless of what any single investment did along the way.2Internal Revenue Service. What if My 401(k) Drops in Value? Because you can never deduct a capital loss inside the plan, the cost basis of individual holdings is meaningless for tax purposes.

That is why a cross-account wash sale involving a 401(k) is so punishing. The disallowed loss would ordinarily be preserved by increasing the basis of the replacement shares. You cannot make that adjustment inside a 401(k) in any way that ever benefits you. The deduction disappears.

The IRS took this position directly in Revenue Ruling 2008-5, holding that when a taxpayer sells stock at a loss and their IRA buys substantially identical shares within the 61-day window, the loss is disallowed and the basis of the IRA shares does not increase.3Internal Revenue Service. Rev. Rul. 2008-5 The ruling addresses IRAs, but the statutory logic carries over to 401(k) plans, and tax practitioners apply the same reasoning.

A Roth 401(k) is treated no differently for this purpose. Roth accounts use after-tax contributions and qualified withdrawals come out tax-free, but the IRS still treats them as retirement accounts where capital losses cannot be claimed.2Internal Revenue Service. What if My 401(k) Drops in Value? A repurchase inside a Roth 401(k) triggers the same permanent loss of the deduction.

How the Trap Usually Gets Sprung

Deliberate timing is rarely the cause. Almost every cross-account wash sale involving a 401(k) happens because contributions are automatic. Your paycheck runs, the plan buys the funds you selected months or years ago, and if any of those funds overlap with something you just sold at a loss in a taxable account, the wash sale triggers. Dividend reinvestment inside the plan works the same way. The purchase does not need to be intentional to count as an acquisition.

A concrete example. You hold 100 shares of Company X in your brokerage account with a $10,000 cost basis. You sell for $8,000, realizing a $2,000 loss. Two weeks later, your biweekly 401(k) contribution buys shares of Company X. That $2,000 loss is permanently disallowed. You took a real economic loss and you will never deduct it.

The most common overlap comes from broad market index funds. You sell an S&P 500 ETF at a loss in your brokerage account while your 401(k) keeps buying an S&P 500 index fund every pay period. If both track the same index and hold essentially the same securities, the IRS will likely treat them as substantially identical.

What Counts as Substantially Identical

The IRS has never issued a precise definition, which leaves real gray area. The clearest cases are the exact same stock or the same mutual fund and ETF share class. Options and warrants on the same underlying stock also count.

Index funds from different providers are the murkier question. Two S&P 500 funds from different companies hold the same 500 stocks and behave almost identically. There is no definitive IRS ruling on whether these are substantially identical, but conservative practice treats them as if they are. Funds tracking genuinely different indexes are generally safe. Selling an S&P 500 fund and letting your 401(k) buy a total market fund or a Russell 1000 fund introduces enough difference that most practitioners would not flag it.

Spousal Accounts Count Too

The rule does not stop at your own accounts. If you sell at a loss and your spouse’s 401(k) or IRA buys substantially identical shares within the 61-day window, the IRS can disallow the loss. Section 267 coordinates loss disallowance between related parties, including spouses, and references Section 1091 directly.4Office of the Law Revision Counsel. 26 U.S. Code 267 – Losses, Expenses, and Interest With Respect to Transactions Between Related Taxpayers If you tax-loss harvest, check what your spouse’s retirement contributions are buying, not just your own.

Trading Only Inside the 401(k)

Selling a fund at a loss inside your 401(k) and buying it back a week later within the same plan technically meets the definition of a wash sale, but it has no effect. You could not have deducted the loss anyway, so there is nothing for the rule to disallow.2Internal Revenue Service. What if My 401(k) Drops in Value? Rebalance and switch funds inside the plan freely. The rule only bites when a taxable-account loss meets a retirement-account purchase.

How to Avoid It

The main protection is awareness. Before selling any position at a loss in a taxable account, look at what your 401(k) has bought in the prior 30 days and what it is scheduled to buy in the next 30. If there is overlap, you have three practical options.

  • Change your 401(k) allocation before you sell. Move contributions away from the overlapping fund at least 31 days ahead of the taxable sale, and keep them out until the 61-day window closes. Then switch back.
  • Replace with a non-identical fund in the taxable account. Sell the S&P 500 ETF and buy something that tracks a different index, such as a total market fund or a large-cap value fund. Your exposure stays similar and the wash sale rule does not apply.
  • Wait out the window. If the 401(k) already bought the overlapping fund, delay your taxable sale until at least 31 days after that purchase, and keep the 401(k) out of that fund for 30 days after the sale.

The replacement-fund approach is what active tax-loss harvesters lean on. It keeps you in the market with roughly the same exposure while creating enough distinction to avoid the substantially identical question.

Reporting a Cross-Account Wash Sale

Your brokerage will not know about the 401(k) purchase. The 1099-B will show the full loss, and correcting it is on you. The adjustment goes on IRS Form 8949. Enter the sale in Part I for short-term holdings or Part II for long-term. Report proceeds in column (d) and basis in column (e). Put code “W” in column (f) and the disallowed loss as a positive number in column (g), which zeroes out the loss in column (h).5Internal Revenue Service. Instructions for Form 8949 (2025)

Keep records of the 401(k) purchase dates and the securities bought. A quarterly statement or transaction history from the plan is usually enough. If the IRS asks, you need to show the repurchase fell inside the 61-day window and involved a substantially identical security.

What Happens If You Skip the Adjustment

Ignoring a wash sale understates your tax. The IRS charges a 20% accuracy-related penalty on the underpaid tax when the understatement results from negligence or disregard of the rules, plus interest from the original due date. For an individual, a substantial understatement is the greater of 10% of the correct tax or $5,000.6Internal Revenue Service. Accuracy-Related Penalty

One missed wash sale on a small loss will not usually cross the substantial-understatement line by itself. But if you are actively harvesting losses across several positions while your 401(k) keeps buying the same funds, the unreported adjustments compound. The IRS can match 1099-B data against your return and flag losses that were not adjusted. Reporting correctly the first time is far cheaper than answering a notice later.