Although it's always better to sell a stock for a profit than a loss, there can be a tax benefit when taking a loss on stock sale. If your capital losses exceed your gains, you can deduct the capital loss against your other income — up to a limit of $3,000 in one year. If the loss is greater than $3,000, you can carry over the excess amount to the next tax year.
Capital Gains Tax
When you sell a security or investment property at a profit, the IRS charges you a tax on the profit. If you hold the security or property for a year or less, you will pay the same rate as your ordinary income rate for the year. However, if you held the property for longer than a year, you will pay a lower long-term capital gains tax.
If you sell a security as a loss, you can then subtract the loss from your capital gains for the year, lowering your tax bill. For example, if you gained $10,000 on the sale of a stock you held for six months, and you lost $5,000 on the sale of another stock in the same year, you would pay short-term capital gains tax on only $5,000, and not on $10,000. You are taxed only on the net difference between your gains and losses, if the gains are greater than the losses.
If you have more capital losses at the end of the year than capital gains, you can use the losses to offset up to $3,000 of taxable income per year. If you have excess losses beyond $3,000, you can carry forward your loss to offset up to $3,000 per year. You can repeat the process until your capital losses are written off.
Wash Sale Rules
If you sell a security at a loss, you cannot use the loss to offset gains if you buy back the same or a substantially identical security within 30 days of your sale. After 30 days, you can buy back your original holding if you want.