A concrete example of tax loss harvesting

You bought 100 shares of a tech stock fund at $50 per share in January. By November, it has dropped to $35 per share. You have an unrealized loss of $1,500. If you sell now, you lock in that loss and can use it to offset capital gains elsewhere in your portfolio — or up to $3,000 of ordinary income in the current tax year.

Here is the sequence: You sell the 100 shares at $35, realizing the $1,500 loss. You when ready buy a similar but not identical fund — perhaps a different tech index fund or one tracking a slightly different market segment. The IRS wash-sale rule prevents you from buying the exact same security within 30 days before or after the sale, so the replacement fund must be genuinely different. You now own a similar position, have captured the tax loss, and can use it on your 2024 return.

The math on your taxes: If you have $2,000 in capital gains from selling other investments this year, the $1,500 loss wipes out most of that gain. You report only $500 in net capital gains instead of $2,000. If you have no gains to offset, you can deduct up to $3,000 of the loss against your ordinary income (wages, interest, etc.). Any loss beyond that carries forward to future years.

Key Takeaways

  • You sell a security at a loss, then buy a similar (but not identical) replacement within the same asset class to stay invested while capturing the tax loss.
  • The wash-sale rule blocks you from buying the same or substantially identical security for 30 days before or after the sale, or the loss is disallowed.
  • A $1,500 loss can offset $1,500 in capital gains, or up to $3,000 of ordinary income if you have no gains, with excess losses rolling forward indefinitely.
  • Tax loss harvesting makes the most sense when you have gains to offset or high ordinary income, and when the replacement fund is genuinely different from the one you sold.
  • Tracking the cost basis and wash-sale dates is essential; most brokers flag wash-sale violations, but the IRS will disallow the loss if you miss it.

When the loss is larger than your gains

Suppose you harvested a $5,000 loss but only have $2,000 in capital gains that year. You can deduct $3,000 of the loss against your ordinary income (up to the annual cap). The remaining $2,000 loss does not disappear — it carries forward to 2025 and beyond, usable in future years against gains or ordinary income.

This carryforward is valuable if you expect higher income or larger gains in coming years. A loss harvested in a low-income year can shelter gains in a high-income year. However, if you die before using the loss, it expires and provides no benefit to your heirs.

The wash-sale rule and how to avoid it

The wash-sale rule is the main trap. If you sell a security at a loss and buy the same or "substantially identical" security within 30 days before or after the sale, the IRS disallows the loss. The 30-day window runs from 30 days before the sale through 30 days after — a 61-day period total.

To stay compliant, buy a different fund in the same category. If you sold a US large-cap index fund, buy a different large-cap index fund or a large-cap value fund. If you sold a bond fund, switch to a different bond fund with a different duration or credit focus. The replacement does not have to be worse — it just has to be genuinely different.

Your broker will usually flag wash-sale violations when you place the trade, but not always. Check your year-end tax documents (Form 1099-B) for wash-sale adjustments. If the IRS catches a violation during an audit, the loss is disallowed and you owe back taxes plus interest.

A multi-position example

You own three funds: Fund A (down $2,000), Fund B (down $1,200), and Fund C (up $800). You also have $1,500 in capital gains from selling a stock earlier in the year. Your total unrealized losses are $3,200.

You could sell Fund A and Fund B, realizing $3,200 in losses. This offsets the $1,500 in gains and $1,500 of ordinary income (hitting the annual cap). You replace Fund A with a similar but different large-cap fund and Fund B with a different mid-cap fund. Fund C you leave alone because it is a winner.

By year-end, you have harvested $3,200 in losses, reduced your tax bill, and stayed invested in similar positions. The replacement funds may perform differently, but the goal was tax efficiency, not market timing.

Timing and market conditions

Tax loss harvesting works best late in the year when you know your full income and gains picture. In November or December, you can see whether you have gains to offset or whether you are in a high-income year. If the market has been volatile, you may have both winners and losers to work with.

However, harvesting is not limited to year-end. If you realize a large gain mid-year from a bonus or the sale of a business stake, you can harvest losses when ready to offset it. The key is matching the timing of the loss to the timing of the gain or income you want to shelter.

Avoid harvesting losses in a year when you expect lower income next year. If you are retiring or taking a sabbatical, you may be in a lower tax bracket in the future, making the loss more valuable then. Conversely, if you expect a promotion or bonus, harvest now to shelter that higher income.

Cost basis and record-keeping

Your broker tracks cost basis — the original price you paid — but you are responsible for knowing it and reporting it correctly on your tax return. When you sell, you must specify which shares you are selling if you bought at different times or prices. Most brokers default to FIFO (first in, first out), but you can elect specific identification to choose which lot to sell.

For tax loss harvesting, you want to sell the shares with the highest cost basis (the biggest loss). If you bought 50 shares at $50 and 50 shares at $45, and the stock is now $35, selling the first 50 gives you a $750 loss instead of $500. Specify this when you place the trade, and confirm it in the trade confirmation.

Keep records of the sale date, purchase date, cost basis, and sale price for at least three years after filing the return. If you harvest losses and buy a replacement fund, note the replacement fund name and purchase date to document that you avoided the wash-sale rule.

When tax loss harvesting does not make sense

If you have no capital gains and low ordinary income, harvesting a loss may not help you this year. You can carry it forward, but if you are in a low tax bracket, the benefit is smaller. Similarly, if you are in a tax-deferred account (401(k), IRA), losses do not matter — you cannot harvest them, and gains are not taxed anyway.

Harvesting also costs money in trading commissions and bid-ask spreads, though most brokers now offer commission-free trades. The tax benefit must outweigh the cost of switching funds. For small losses (under $500), the benefit may not justify the effort.

If you have a strong conviction that the fund you sold will outperform the replacement, harvesting may not be worth it. The tax savings are real, but they are not information programs — you are trading a position you believe in for a similar one you believe in less.

Frequently Asked Questions

Can I harvest losses in a retirement account like a 401(k)?

No. Losses in tax-deferred accounts cannot be harvested because the account itself is not taxed. Gains and losses inside the account do not affect your tax return. You can only harvest losses in taxable brokerage accounts.

What happens if I accidentally buy the same fund within 30 days?

The IRS disallows the loss. The cost basis of the replacement fund is adjusted upward by the disallowed loss amount, so you do not lose the loss entirely — it just shifts to the new position and reduces your gain when you eventually sell that fund.

Can I harvest losses to offset long-term capital gains?

Yes. Losses (both short-term and long-term) offset gains in any order. The IRS applies losses to reduce long-term gains first, then short-term gains, which is usually favorable because long-term gains are taxed at lower rates.

Do I need to tell my broker I am tax loss harvesting?

No. You straightforward sell the losing position and buy the replacement. Your broker may flag a potential wash-sale violation if you try to buy the same fund within 30 days, but you do not need to file any special form or notify anyone of your intent.

What if I sell at a loss and the replacement fund goes down further?

You have locked in the tax loss, which is separate from the market performance of the replacement fund. If the replacement fund drops further, you can harvest that loss too in a future year. The tax benefit is real regardless of what happens to the replacement fund afterward.