BRT
Investing/Article
Home/Investing/Tax-Loss Harvesting: How It Works and When It's Worth the Trouble
Investing7 min readPublished

Tax-Loss Harvesting: How It Works and When It's Worth the Trouble

The mechanics of realizing a loss for a tax benefit, the wash-sale rule that trips people up, and an honest look at who actually gains enough to bother.

Author Morgan EllisReviewed by — (see editorial policy)

A holding down 15% in your taxable brokerage account isn't only a loss on paper. Sell it, and that loss becomes a real number you can use to offset other gains, or a limited amount of ordinary income, on this year's tax return. That's the entire idea behind tax-loss harvesting. It's a genuinely useful tool for some people and genuinely not worth the complexity for others, and which group you're in depends on specifics this article walks through rather than a blanket yes or no.

The mechanic, step by step

You sell a security in a taxable account for less than you paid for it, realizing a capital loss. That loss first offsets any capital gains you realized elsewhere in the same year: short-term losses against short-term gains, long-term against long-term, with any excess netting across the two categories. If your losses exceed your gains for the year, up to $3,000 of the excess ($1,500 if married filing separately) can offset ordinary income, and anything beyond that carries forward to future tax years indefinitely, per IRS Topic 409. To stay invested rather than sitting in cash, you typically use the sale proceeds to buy a similar (not identical) fund or stock, then optionally swap back later.

The wash-sale rule, precisely

The rule that trips up more people than any other part of this: if you sell a security at a loss and buy the same or a "substantially identical" security within 30 days before or after the sale, the loss is disallowed for current tax purposes. IRS Publication 550 states this covers not just the stock itself but options and contracts to acquire it, so buying a call option on the same stock inside the window also triggers it. The disallowed loss doesn't vanish; it's added to the cost basis of the replacement shares, deferring the benefit rather than eliminating it, but that deferral can matter if you needed the loss this year specifically.

The practical fix: if you want to stay invested in the same asset class immediately, sell the individual stock or fund and buy something correlated but not identical (a different index fund tracking a different, but similar, benchmark, for example), and wait out the 30-day window before considering a swap back, if you swap back at all.

A worked example

Illustrative numbers only, not a real trade. Say you're in the 32% federal ordinary-income bracket and the 15% long-term capital gains bracket. This year you have $8,000 in realized long-term capital gains from rebalancing elsewhere in your portfolio. You also hold a fund down $5,000 from your purchase price, which you sell to harvest the loss, replacing it same-day with a similar but not identical fund.

| Item | Amount | |---|---| | Long-term capital gains realized elsewhere | $8,000 | | Long-term loss harvested | −$5,000 | | Net long-term gain after offset | $3,000 | | Tax on gain before harvesting (15% × $8,000) | $1,200 | | Tax on gain after harvesting (15% × $3,000) | $450 | | Tax saved this year | $750 |

If you had no gains to offset at all, the loss would instead reduce up to $3,000 of ordinary income at your marginal rate (in the 32% bracket, worth $960), with the remaining $2,000 of loss carried forward to next year.

Which shares you sell matters, if you bought in batches

If you bought the same fund across several purchases at different prices, most brokers let you choose which specific shares (which "tax lot") to sell, rather than defaulting to first-in-first-out. Selling your highest-cost-basis lots first generates the largest loss (or smallest gain) for a given number of shares sold, which is usually what you want when harvesting. Check your broker's default lot-selection method before placing the trade; a default of "average cost" or FIFO can quietly sell a different, less tax-efficient lot than the one you intended, and once the trade settles, some brokers won't let you re-designate which lot it came from after the fact.

This is also where automation earns its keep. A number of brokerages and robo-advisors now offer to scan taxable accounts for harvesting opportunities and execute the swap automatically, subject to their own wash-sale-avoidance logic. That can be worth asking about if you'd otherwise never get around to doing this manually, though it's still worth understanding the mechanics above rather than treating the feature as a black box, since you're the one who ultimately has to reconcile the 1099-B at tax time.

Who this actually benefits

The benefit scales with two things: your marginal tax rate, and how much taxable capital gains or income you actually have to offset. A high earner with a large taxable brokerage account, meaningful realized gains from other activity, and a real unrealized loss sitting in a position has a genuine, quantifiable benefit: the $750 or $960 in the example above, repeated across positions and years, adds up. Someone in a low tax bracket, investing primarily through a 401(k) or IRA where gains aren't taxed annually in the first place, or holding modest taxable balances, has little or nothing to harvest, because there's no meaningful tax bill to reduce.

Who it's usually not worth the trouble for

If most of your investing happens inside tax-advantaged accounts, this doesn't apply there at all; the wash-sale rule and loss harvesting are concepts specific to taxable accounts. If your taxable account is small, or you're in the 0% long-term capital gains bracket, the dollar benefit of harvesting a loss can be smaller than the time and complexity of tracking replacement funds, wash-sale windows across multiple accounts (the rule applies across all your accounts, including a spouse's, and even applies if the repurchase happens in an IRA), and adjusted cost basis. Complexity has a real cost even when the mechanics are simple in principle, and for a lot of long-term index investors, that cost outweighs a few hundred dollars of tax savings. It's also worth being honest about a second cost: harvesting a loss and reinvesting in a "similar but not identical" fund means your portfolio isn't exactly the one you designed anymore, at least for the 30-day window, and stacking several of these swaps across a volatile year can leave you holding a patchwork of near-substitute funds you didn't originally choose for their own merits.

Decision framework

Work through this in order:

  1. Do you have a taxable brokerage account with a position currently worth less than you paid for it? If everything you hold is in a 401(k)/IRA, or your taxable positions are all up, there's nothing to harvest right now.
  2. What's your marginal tax bracket, and do you have capital gains elsewhere to offset (or ordinary income, up to the $3,000 annual cap)? The higher both are, the more this is worth doing.
  3. Can you replace the sold position with something similar enough to keep your allocation intact, but different enough to avoid the wash-sale rule? If not, you risk being out of the market during a rebound, or disallowing your own loss.
  4. Is the time cost of tracking this, across every account, every year, actually smaller than the tax benefit you'd realize? For a handful of large positions, usually yes. For a dozen small ones, often not.

Limits and exceptions

Harvesting a loss and rebalancing a portfolio both involve selling something; coordinate them rather than treating them as separate chores. See portfolio rebalancing for the tax angle on the other side of this coin: avoiding unnecessary gains in the first place.

This only applies to taxable accounts. It does nothing inside an IRA or 401(k), and the wash-sale rule reaches across all your accounts including a spouse's, so a repurchase inside a retirement account can still disallow a loss realized in a taxable one. The $3,000 annual cap against ordinary income is a federal figure and hasn't been indexed for inflation in decades, which is one reason large carryforward balances are common. State tax treatment can differ from federal. And harvesting a loss is not the same as avoiding a bad investment; the underlying position still needs to make sense in your portfolio; don't let the tax tail wag the investment dog by holding a fund you no longer believe in just to preserve a wash-sale-clean cost basis.

Sources

Source-backed
  1. [1]Topic no. 409, Capital gains and losses Internal Revenue Service, 2024
  2. [2]Publication 550, Investment Income and Expenses (wash sale rule) Internal Revenue Service, 2024

Frequently asked questions

Does tax-loss harvesting work inside a 401(k) or IRA?
No. The wash-sale rule and the entire concept of realizing a capital loss apply to taxable brokerage accounts. Trades inside a 401(k), traditional IRA, or Roth IRA aren't taxed on realized gains or losses in the first place, so there's no loss to harvest.
Can I buy back the exact same stock I just sold at a loss?
Not within 30 days before or after the sale, or the loss is disallowed under the wash-sale rule. You can buy back the same security after the 30-day window closes, or buy a similar-but-not-identical fund immediately to stay invested in the meantime.
← Back toInvestingNext article →The Three-Fund Portfolio, Explained Simply