Tax-loss harvesting sounds fancy, but the idea is simple: if you have investments in a taxable brokerage account that are down, you may be able to sell them at a loss and use that loss to lower your tax bill.

The catch is the wash sale rule. It is basically the IRS saying, “You do not get to claim a loss if you sold it and then bought the same thing right back.” And the wash sale rule can sneak up on you, especially if you have automatic dividend reinvestment turned on.

This guide walks through how loss harvesting works in brokerage accounts, how wash sales work for stocks and ETFs, and the clean year-end moves I’d make if I wanted the deduction without the headache.

A person at a kitchen table reviewing a taxable brokerage account portfolio on a laptop with papers and a notebook nearby, realistic photo

What tax-loss harvesting actually does

Tax-loss harvesting means selling an investment in a taxable account for less than you paid for it, creating a realized capital loss.

That realized loss can help you in three main ways:

  • Offset capital gains you realized from other sales this year (or future years if you carry losses forward).
  • Reduce up to $3,000 of ordinary income per year if your losses exceed your gains (for most filers).
  • Carry forward extra losses to future tax years if you still have losses left after the offsets.

Important note: this only applies to taxable brokerage accounts where gains and losses are reportable. This is different from retirement accounts where the tax treatment works differently.

Realized vs unrealized losses

If your investment is down but you still hold it, that is an unrealized loss. It feels painful, but it does nothing for your taxes.

You only get tax value from a loss when it becomes realized, meaning you sold the position (or a specific tax lot) and locked in the loss.

That is why loss harvesting is usually a deliberate move: you sell, capture the loss, and then decide what to hold instead going forward.

Wash sale rules in plain English

A wash sale happens when you sell an investment at a loss and then buy the same or “substantially identical” investment within the wash sale window.

The window is:

  • 30 days before the sale date
  • the day of the sale
  • 30 days after the sale date

So in practice, you are looking at a 61-day period that can trigger trouble.

When a wash sale happens in a taxable account, the IRS does not let you claim that loss right now. Instead, the disallowed loss typically gets added to the cost basis of the replacement shares, which can reduce taxes later when you eventually sell those replacement shares.

If you were counting on the loss to offset gains this year, a wash sale can ruin the plan.

Wash sales with stocks and ETFs

Stocks

With individual stocks, the “same” part is usually straightforward. If you sell Apple (AAPL) at a loss and buy AAPL again inside the 61-day window, that is a classic wash sale.

ETFs

ETFs are where people get tripped up. If you sell one ETF at a loss and buy another ETF that is substantially identical, that can potentially trigger a wash sale.

The IRS has not published a simple, universal list that says which ETF pairs are “substantially identical.” So the safe approach is:

  • Avoid replacing an ETF with another ETF that tracks the same index.
  • If you want to stay invested, consider swapping into a fund with a different index provider or different underlying methodology.
  • Keep documentation of what you sold and what you bought, including tickers and dates.

If you want a simple rule of thumb: replacing a total US stock market ETF with a large-cap US ETF is usually a clearer “not identical” move than swapping one S&P 500 tracker for another S&P 500 tracker.

A person holding a smartphone while placing a stock trade in a brokerage app at home, realistic photo

Sneaky wash sale triggers

Dividend reinvestment

If you have automatic dividend reinvestment turned on and it buys even a small number of shares inside the wash sale window, you can create a partial wash sale. This is a big one around year-end because distributions can hit on schedules you are not actively watching.

If you are planning to harvest a loss, consider turning off dividend reinvestment on the position ahead of time and taking dividends in cash temporarily.

Buying in another taxable account

Wash sales are not limited to one account at one brokerage. If you sell at a loss in Account A and buy the same security in Account B within the window, you can still trigger a wash sale.

Spouse accounts

If you are married and file jointly, the wash sale rule can also bite across both spouses’ accounts. In plain terms: if you sell at a loss and your spouse buys the same (or substantially identical) security within the window, you can still have a wash sale.

Practical takeaway: if you harvest losses near year-end, coordinate trades and automatic reinvestments across both people’s taxable accounts.

The IRA and Roth IRA trap

This is the one that deserves extra bold ink.

If you sell a security at a loss in a taxable account, and the replacement shares are bought in your IRA or Roth IRA (including via an automatic purchase, dividend reinvestment, or a spouse’s IRA in some situations), you can trigger a wash sale where the loss is permanently disallowed, not merely deferred via a cost basis adjustment. This is a major pitfall because IRAs do not track cost basis the same way a taxable brokerage account does, so you do not get the usual “add it to basis and use it later” treatment.

If you are loss harvesting, consider avoiding purchases of the same ticker in any IRA or Roth IRA during the full 61-day window. That includes turning off dividend reinvestment inside the IRA if it would buy the same fund.

Partial wash sales

If you sell 100 shares at a loss but only buy back 20 shares inside the window, you may have a wash sale on part of the loss. The brokerage may track this, but you should still understand what happened so your tax reporting matches reality.

Cost basis and tax lots

When you sell, your taxable gain or loss depends on your cost basis, usually the price you paid plus certain adjustments.

Most brokerages let you choose a cost basis method. Common options include:

  • FIFO (first in, first out)
  • Specific identification (you choose the exact tax lots you sell)
  • Average cost (common for some mutual funds)

If your goal is tax-loss harvesting, specific identification is often the most flexible because you can sell the lots that create the biggest loss (or manage gains more intentionally).

Two quick moves before year-end

  • Confirm your cost basis method in your brokerage settings and learn how to select lots before you place the trade.
  • Download your realized gains and losses report so you know whether you actually need more losses to offset gains this year.

How the deduction works

Capital losses first offset capital gains:

  • Short-term losses offset short-term gains first (these are typically taxed at ordinary income rates).
  • Long-term losses offset long-term gains first (often taxed at preferential rates).

Then comes an important detail that trips people up: if one bucket has extra losses, they can cross over to offset the other bucket. For example, if your short-term losses exceed your short-term gains, the remaining short-term loss can offset long-term gains (and vice versa).

If you have more total losses than gains, you can generally deduct up to $3,000 against ordinary income (and carry the rest forward).

Your brokerage will typically send you a Form 1099-B and summary statements that show proceeds, cost basis, and realized gains and losses. You or your tax software uses that information to complete the capital gains and losses forms.

Year-end checklist

If I were doing a clean year-end loss harvest, this is the sequence I would follow:

  1. Run a gains and losses snapshot for the year so far in your brokerage.
  2. Identify positions and specific lots that are at a loss and make sense to sell.
  3. Check for upcoming dividends and consider pausing dividend reinvestment to avoid accidental wash sales.
  4. Check all related accounts, including other brokerages, a spouse’s accounts, and any IRA or Roth IRA that might buy the same holding.
  5. Plan your replacement holding if you want to stay invested, and make sure it is not the same or arguably substantially identical.
  6. Place the sale using the correct lot selection.
  7. Wait out the 31 days before buying back the same security if you want to return to it, and keep the entire 61-day window in mind for any related accounts.
  8. Save confirmations and screenshots of trades, dates, and lot details for your records.
A home office desk with printed brokerage statements, a calculator, and a laptop open to a finance webpage, realistic photo

Common mistakes to avoid

  • Harvesting a loss and immediately rebuying the same ticker because the market moved and you got nervous.
  • Forgetting dividend reinvestment and triggering a wash sale with a tiny reinvested purchase.
  • Selling without checking tax lots and accidentally realizing a gain instead of the loss you intended.
  • Ignoring spouse activity and accidentally triggering a wash sale because your spouse bought the same fund in their account.
  • Buying the replacement in an IRA or Roth IRA and permanently losing the deduction.
  • Letting the tax tail wag the investing dog. Do not buy a bad fit investment just to avoid a wash sale. Make sure the replacement still matches your risk tolerance and plan.

Quick example

Say you bought 10 shares of an ETF for $200 per share ($2,000 total). Later it drops to $150 per share and you sell all 10 shares for $1,500.

  • Your realized capital loss is $500.

If you also realized $500 of capital gains from another sale this year, that $500 loss can offset those gains dollar for dollar. If you do not have gains, that loss can still help by offsetting up to $3,000 of ordinary income, with any extra carried forward.

But if you buy back that same ETF within the wash sale window in a taxable account, the $500 loss may be disallowed for now and folded into the basis of the replacement shares.

And if the buyback happens in an IRA or Roth IRA, you can be looking at the harsher version of the rule where the loss is permanently disallowed.

When it is worth it

It can be worth it when

  • You have realized gains this year and want to reduce the tax hit.
  • You are holding a position you were ready to replace anyway.
  • The loss is meaningful relative to your portfolio and transaction costs.

It might not be worth it when

  • The loss is tiny and you will create a bunch of complexity for little benefit.
  • You will pay high trading costs or large bid-ask spreads (less common now, but still possible).
  • You are likely to trigger wash sales due to frequent buying, automatic reinvestments, or short-term trading.

The bottom line

Tax-loss harvesting is one of the few legal “reset buttons” that can turn a frustrating down investment into something useful on your tax return. In a taxable brokerage account, it can offset gains, reduce up to $3,000 of ordinary income, and carry forward if you have more losses than you can use right now.

Just respect the wash sale rules, manage your cost basis and tax lots intentionally, and be extra careful around year-end when dividend reinvestments, spouse purchases, IRA activity, and quick buybacks can accidentally wipe out the deduction you were trying to capture.

Friendly note: Tax rules can get nuanced fast, especially around “substantially identical” funds, spouse activity, and IRA wash sale edge cases. If you are making large moves, it can be worth running your plan by a qualified tax pro.