Q: I own a stock that's worth a lot less than I paid. I could use a tax deduction for the losses, but I still believe in the long-term value of the stock. Can I sell it, write off the loss, and then buy it back?

The act of selling losing stocks in order to deduct the losses is known as tax-loss harvesting and can be a very smart way to reduce your tax bill. Unfortunately, there's a provision known as the wash-sale rule that's designed to prevent exactly what you're describing.

In a nutshell, the wash-sale rule says that if you sell one security and buy a "substantially identical" security within 30 days, you can't use a loss on the sale for tax purposes.

Generally, "substantially identical" means buying or selling the exact same stock. However, in the case of mutual funds or ETFs, it can mean buying another fund with virtually identical investments -- such as selling one S&P 500 index fund and buying another.

So you can sell a stock, deduct the loss, and then buy it back, but only if you wait for more than 30 days to rebuy it. The problem with this strategy is the risk that after 30 days have passed, you won't be able to buy the stock back at a favorable price, so if you're certain that you want to own the stock for the long term, I'd advise against trying to capture your losses for tax purposes.

The Motley Fool has a disclosure policy.