How exactly does the wash-sale rule work?
The wash-sale rule blocks you from claiming a tax loss if you buy a "substantially identical" security within 30 days before or after selling at a loss – a 61-day window total. If triggered, the disallowed loss isn't gone; it's added to the cost basis of the replacement shares and deferred until you sell those. The rule covers purchases in any of your accounts, including your spouse's and your IRA – buying in an IRA permanently destroys the loss. It also catches automatic dividend reinvestment and 401(k) buys. To harvest a loss cleanly, sell the holding and either wait 31 days or immediately buy a similar-but-not-identical fund (for example, swap one total-market index fund for a different provider's). The rule applies to stocks, bonds, and funds; the IRS has not formally extended it to crypto yet.