The 30-day rule in the stock market – commonly referred to as the "wash sale" rule – affects the taxable gains and losses on stocks you sell. The purpose of the rule is to prevent you from selling stock for a tax loss and buying it right back.
An understanding of the aspects of the wash sale rule will prevent you from unintentionally running afoul of it and increasing your income tax bill.
If you sell an investment at a loss, it's called a capital loss and it can be used to reduce your taxable income. Capital losses are credited against any capital gains you have for the year and excess losses can be used to reduce the amount of your regular taxable income. The wash sale rule prevents you from selling shares of stock and buying the stock right back just so you can take a loss that you can write off on your taxes.
The wash sale rule does not apply to gains. If you sell a stock for a profit and buy it right back, you still owe taxes on the gain.
The 30-Day Limit
The timeframe for a wash sale is 30 days before to 30 days after the date you sold your shares for a loss. If you own 100 shares of stock and you buy 100 more, then you sell the first 100 shares for a loss 10 days later, the loss will be disallowed for tax purposes.
Buying back a "substantially identical" investment within the 30 days triggers the wash sale rule. For example, if you sell stock shares and buy a stock option on the same company, it would trigger a wash sale and invalidate any tax loss from the sale of the shares.
When the Rule Does Not Apply
Shares purchased within 30 days before or after the sale for a loss must be "replacement shares" for the wash sale rule to go into effect. You can buy shares and sell them a week later for a tax-deductible loss because the initial purchase was not intended to replace shares already owned or sold. In most cases, a wash sale is triggered when you sell an investment then buy the same investment again within 30 days after the sale.
Wash Sale No-No's
You can't try to get around the wash sale rule by buying back the shares in a different account, such as selling shares out of your regular brokerage account to book the loss and then buying the shares in your IRA account. Don't try to bend the rules by selling shares out of your individual brokerage account and buying them in a joint account. These transactions would still be classified as wash sales and the tax loss not allowed.