Q: Do the wash-sale rules apply when you sell stock at a profit? In other words, can one sell and then buy the same stock back again soon thereafter, or does one have to wait a certain period of time?

G.C., Medford, Ore.

A: You don't have to worry about the wash-sale rules when you sell stock at a profit.

The rules typically do apply, however, when you sell a stock at a loss and plan to deduct that capital loss on your tax return, says Mark Luscombe, principal federal tax analyst at CCH, a Wolters Kluwer WKL.AE -1.27% Wolters Kluwer N.V. Netherlands: Amsterdam 20.68 -0.27 -1.27% July 11, 2014 5:35 pm Volume (Delayed 15m) : 992,862 P/E Ratio 18.08 Market Cap €6.24 Billion Dividend Yield 3.34% Rev. per Employee €194,501 More quote details and news » business that offers tax, accounting and audit information, software and services.

The Internal Revenue Service says a "wash sale" typically occurs when you sell or trade stock or other securities at a loss—and within 30 days before or after the sale, you buy the same stock or "substantially identical" securities. If you violate that rule, you typically can't deduct your loss. See Publication 550 at www.irs.gov.

If you violate the rules and your loss is disallowed, here's what you're supposed to do: Add the amount of that disallowed loss to the cost of your new stock or securities. "The result is your basis in the new stock or securities," the IRS says.

An example from the IRS: Say you purchased 100 shares of a stock for a total investment of $1,000. You sell all those shares for $750, giving you a $250 loss.

One week later, you buy 100 shares of the same stock for $800. In that case, you can't deduct the $250 loss because you have run afoul of the wash-sale rules. But you do add that $250 disallowed loss to the cost of the new stock ($800), giving you a basis in the new stock of $1,050.

Write to Tom Herman at tom.herman@wsj.com
