The tax treatment of stock sales depends on several factors: how long you held the shares, your income level, the type of account the stock is held in and whether you are selling at a gain or a loss.