Wash sale. Under IRS rules, a wash sale occurs when the same or a similar security is purchased within 30 days before or after the sale of a security, when that sale involves a capital loss. When a wash sale is triggered, the capital loss is disallowed.
Okay. So you've got a loss in a stock. Is there anything you can do to take advantage of this situation? Well, if the stock is held in a taxable account, yes, there is. If it's held in a tax-advantaged account such as an IRA or 401(k) account, then you'll just have to suck it up and eat the loss or wait for the stock to recover.
In a taxable account, you can sell the stock at a loss and record a capital loss. This can be used to offset a capital gain from some other sale. There are rules to follow there about how to allocate the offset, so be sure to understand them.
However, all if for naught if you don't follow some simple rules regarding that sale for a capital loss.
First, the capital loss must be in a taxable account. (Alright, this was already said. Bears repeating.)
Second, you cannot have bought the same security within the 30 days preceding the sale.
Third, you cannot buy the same security within 30 days after the sale. The point of this rule is that the IRS wants you to be exposed to the risk that the stock price could rise after the sale. Otherwise, you could sell the stock, take the loss, then immediately buy the stock back and get the benefit of that price rise. Sweet, but not allowed.
Fourth, it doesn't matter whether you buy the stock back within the same taxable account or in a different account (other taxable account, IRA, etc.). So, you cannot sell the stock in your taxable account and two weeks later buy it back in your IRA. That's essentially the same security and you're out of luck on taking the loss.
Fifth, you cannot direct a company you own or have control over to buy the stock instead or have your spouse purchase the stock within that + / - 30 day window. This is part of the "essentially" definition according to the IRS. The IRS views both of those as "essentially" you doing the purchase.
In other words, Fool, if you want to take advantage of a capital loss to offset some taxes you owe on capital gains or even your income, you have to be completely out of the stock for a set amount of time. Just remember, that 30-day window applies to both sides of the sell date.
All is not lost
However, the loss is not disallowed forever. If you manage to forget and buy the stock back during that + / - 30-day window, the loss is not allowed. Instead, the disallowed loss is added to the basis for the new shares. This essentially wipes out the capital gain you would have up to the amount of the loss from when you do sell those shares in the future.
For example, suppose you buy 500 shares of XYZ for $10,000. You later sell them for $3,000, recording a $7,000 loss. If you buy XYZ 20 days later for $5,000, then you lose the ability to use that $7,000 loss to offset some gains elsewhere, but you increase the basis of those new shares to $12,000. So, if you sell them in the future for $14,000, you would only have a capital gain of $2,000, instead of $9,000.