If your investment portfolio has positions that are currently worth less than you paid for them, those losses have a hidden value: they can offset capital gains elsewhere in your portfolio and reduce your federal tax bill. This strategy is called tax-loss harvesting, and it is one of the few ways investors can actively reduce taxes within a taxable brokerage account.
What Is Tax-Loss Harvesting?
Tax-loss harvesting means selling an investment that has declined in value to realize a capital loss. That loss can then be used to offset capital gains you have realized -- or up to $3,000 of ordinary income per year if your losses exceed your gains. Losses that exceed the annual limit carry forward to future tax years indefinitely.
The key mechanic: capital losses first offset capital gains of the same type (short-term losses offset short-term gains, long-term losses offset long-term gains), then cross-offset. Any remaining net loss after all gains are eliminated offsets up to $3,000 of ordinary income.
A Worked Example
Suppose you have the following activity in a taxable brokerage account in 2026:
- Sold Stock A for a $8,000 long-term gain
- Sold Stock B for a $3,000 short-term gain
- Stock C is sitting at a $7,000 unrealized loss
Without harvesting, you owe tax on $11,000 of gains. If you sell Stock C before December 31 to realize the $7,000 loss:
- $7,000 loss offsets $7,000 of gains (long-term first: $8,000 - $7,000 = $1,000 long-term gain remaining)
- You now owe tax on $1,000 long-term gain + $3,000 short-term gain = $4,000 total
- At a 15% long-term rate and 22% short-term rate, you have saved roughly $1,050 in tax compared to the no-harvest scenario
The Wash-Sale Rule -- The Critical Trap
The IRS wash-sale rule (IRC Section 1091) disallows a loss if you buy a "substantially identical" security within 30 days before or after the sale. The 61-day window (30 days before sale + sale date + 30 days after) is strict. If you trigger a wash sale, the disallowed loss is added to the cost basis of the replacement shares -- you do not lose it permanently, but you do lose the timing benefit.
What counts as substantially identical? The same stock or fund. Switching from a mutual fund to an ETF tracking the same index is generally treated similarly. Most tax advisors treat two funds tracking the same index from different providers as acceptable substitutes, though the IRS has not published definitive guidance.
When Tax-Loss Harvesting Makes Sense
The strategy is most valuable when:
- You have realized capital gains elsewhere in the portfolio that year
- You are in a higher tax bracket (22% or above for ordinary income, 15% or above for long-term gains)
- The position can be replaced with a similar but not substantially identical investment to maintain your target allocation
- Transaction costs are low (most major brokers have eliminated per-trade commissions)
It makes less sense if you are in the 0% capital gains bracket (taxable income below $48,350 for single filers in 2026), if the loss is small and you would need to stay out of the position for 31 days in a rising market, or if the investment is inside a tax-advantaged account (losses in IRAs and 401(k)s do not generate deductible losses).
Practical Year-End Checklist
- Review your taxable accounts for unrealized losses in November and early December
- Identify offsetting gains already realized that year
- Check the 30-day window -- did you buy the same position recently?
- Identify a replacement security that maintains your allocation without triggering wash-sale rules
- Confirm the trade settles before December 31 (most brokers require trades placed by December 29 or 30)
Use the capital gains tax calculator to estimate your current-year gain exposure and see how harvested losses would change your bill. For more on how long-term and short-term rates differ, see the 2025 capital gains tax rates guide.
Source
IRS Publication 550 (Investment Income and Expenses); IRS Topic No. 409 (Capital Gains and Losses); IRC Section 1091 (Wash Sales).
How to Execute a Tax-Loss Harvest Step by Step
Tax-loss harvesting sounds complex but the actual execution is straightforward. Here is the exact process:
- Review your taxable accounts for unrealized losses. Look at each position's current value versus your cost basis. Most brokerage platforms show unrealized gain/loss per position. Focus on positions with losses large enough to generate meaningful tax savings after considering transaction costs.
- Identify what you will replace it with. To maintain your portfolio allocation, you need a replacement security that is similar but not substantially identical. If you are selling a large-cap U.S. stock index fund, you can replace it with a large-cap U.S. fund from a different provider or an S&P 500 ETF tracking a different index. The IRS has not published exact rules on what constitutes "substantially identical" for funds, but most tax professionals consider two funds tracking different indices (even in the same asset class) as acceptable substitutes.
- Execute the sale. Sell the losing position. Make sure the trade will settle before December 31 -- most brokers require you to place the trade by December 29 or 30 to settle in the same calendar year.
- Buy the replacement. Purchase the replacement security immediately. There is no rule preventing you from buying the replacement on the same day -- the wash-sale rule only prohibits buying back the same or substantially identical security within 30 days, not a different security.
- Wait 31 days before switching back. After 31 days, if you prefer to return to your original fund, you can sell the replacement and buy back the original without triggering a wash sale.
- Keep records. Save confirmation of both the sale and the replacement purchase. Your brokerage's year-end Form 1099-B will show the proceeds; you will need your cost basis records to complete Schedule D and Form 8949 accurately.
Tax-Loss Harvesting Across Multiple Accounts
The wash-sale rule applies across all of your accounts -- taxable accounts, IRAs, and even your spouse's accounts. If you sell a fund in a taxable account at a loss and then buy the same fund in your IRA within 30 days, the wash-sale rule is triggered and the loss is disallowed. This trips up many investors who use automated investing tools across multiple platforms. Review all accounts when planning a harvest, not just the account where the sale occurs.
When the Math Does Not Work
Tax-loss harvesting is not always worth doing. Skip it when the loss is small relative to the tax benefit, when the replacement security you are forced to hold for 31 days carries meaningfully more risk than the original, when you are in the 0% long-term capital gains bracket (no gains to offset), or when transaction costs exceed the tax savings. Also consider state taxes: if your state does not allow capital loss deductions or treats them differently from federal rules, your actual savings may be less than expected. Run a quick calculation: multiply the loss amount by your marginal rate on capital gains. If the tax savings exceeds the hassle and any opportunity cost, harvest. If not, hold.
Source
IRS Publication 550 (Investment Income and Expenses); IRS Topic No. 409 (Capital Gains and Losses); IRC Section 1091 (Wash Sales).