The wash sale rule prevents you from deducting losses when you buy replacement stocks or securities (including contracts or options) within a 30-day period either before or after you sold substantially identical securities.
The rule doesn't apply if you're a securities dealer and the trade was part of your business activity. Additionally, the wash sale rule doesn’t currently apply to cryptocurrency, which the IRS treats as property.
The tax or cost basis of the replacement securities is the new cost increased by the disallowed loss. This applies even if you buy the replacement stock in a different account. Buying the replacement stock in an IRA can be especially painful since cost basis isn't typically recognized in these accounts. Therefore, the loss on the sale would be lost.
Tip: If you purchased and sold stock at a loss within 30 days, but didn't purchase or acquire substantially identical stock or securities, you have a short-term capital loss instead of a wash sale.