Tax-Loss Harvesting
Last updated July 2026
Short answer
Tax-loss harvesting is selling an investment that has dropped below what you paid to realize a capital loss, then using that loss to cut your tax bill. The realized loss offsets your capital gains dollar-for-dollar, and after gains are used up, up to 3,000 dollars per year (verify the current figure) can offset ordinary income, with anything left over carried forward indefinitely. To avoid sitting in cash, harvesters usually buy a similar but not substantially identical fund so their market exposure barely changes. It only works in taxable accounts, not an IRA or 401k, and the key constraint is the wash-sale rule, which disallows the loss if you rebuy the same or a substantially identical security within 30 days before or after the sale. Which tax lots you sell affects how much loss you bank. This is general information, not tax advice; consult a tax professional.
A falling investment is not only a paper loss; in a taxable account it can be a tax asset. Tax-loss harvesting is the practice of turning a decline you are still comfortable holding through into a realized loss that reduces what you owe, without meaningfully changing what you are invested in. Done carefully it lowers this year's tax bill and banks losses for the future. Done carelessly it trips the wash-sale rule and accomplishes nothing. This guide is the deep dive: how the loss is used, the yearly limit and carryforward, staying invested, why it is a taxable-account move, the wash-sale constraint, timing, and lot selection. It is descriptive and educational, not tax advice.
What tax-loss harvesting actually is
At its core, harvesting is simple: you sell a position that is worth less than you paid for it, which converts an unrealized (paper) loss into a realized capital loss the IRS recognizes. Until you sell, a decline does nothing for your taxes. Once realized, that loss becomes a number you can use on your return to offset gains and, within limits, income. The subtle part is that the goal is usually not to exit the position permanently but to capture the loss while staying invested through a replacement.
It helps to be clear about what harvesting does and does not do. It does not create free money: it mostly defers tax. When you sell and rebuy a replacement, your new position has a lower cost basis, so a larger gain will eventually be taxed when you sell that. The benefit comes from deferring tax into the future (money kept working longer) and potentially from the rate difference between the ordinary income offset now and a long-term gain later. This is educational framing, not tax advice.
How the loss is used: gains, then $3,000 of income, then carryforward
A realized capital loss is used in a specific order. First it offsets your realized capital gains dollar-for-dollar (long-term losses are matched against long-term gains and short-term against short-term first, then netted across). If you have a 10,000 dollar gain and harvest a 10,000 dollar loss, they cancel and there is no capital gains tax on that pair. For the mechanics of gains themselves, see capital gains tax.
If your losses exceed your gains, the leftover net loss can then offset up to 3,000 dollars of ordinary income per year (1,500 dollars if married filing separately). That offset is valuable because ordinary income is often taxed at a higher rate than long-term gains. Anything still unused after that carries forward indefinitely to future tax years, where it can again offset gains and up to the yearly income limit. That is why large harvested losses in a bad market can quietly reduce taxes for years. The 3,000 dollar figure can change, so verify current figures with the IRS or a tax professional.
Staying invested: the similar-but-not-identical swap
The point of harvesting is not to time the market by going to cash. If you sell a fund at a loss and it rebounds while you sit on the sidelines, you may lose more to the recovery than you saved in tax. So the standard technique is to sell the loser and immediately buy a similar but not substantially identical replacement, keeping your overall exposure nearly unchanged. A common example is selling one broad US stock index fund and buying a different broad US stock fund that tracks a different index.
The reason "not substantially identical" matters so much is the wash-sale rule, covered next. Two broad-market funds that track different underlying indexes are generally treated as not substantially identical, though this is a genuine gray area and the IRS has not drawn a bright line for funds. Getting the swap right is what lets you bank the loss and stay invested at the same time. Because the "substantially identical" question is a tax-advice question, confirm any specific swap with a tax professional.
Why it only works in taxable accounts
Harvesting is exclusively a taxable-account move. Inside a traditional IRA, Roth IRA, or 401k, gains and losses are not taxed as they occur, so a loss there is not deductible and there is nothing to harvest. Selling a loser in a sheltered account gives you no tax benefit at all. The entire value of harvesting comes from the fact that a taxable brokerage account taxes realized gains and lets you deduct realized losses.
There is also a cross-account trap worth flagging: the wash-sale rule reaches across your accounts, including your IRAs and, in many cases, a spouse's account. Selling a stock at a loss in your taxable account and buying the same security in your IRA within the window can disallow the loss, and unlike a normal wash sale, the basis adjustment may effectively be forfeited inside the IRA. So harvesting is not just "only in taxable"; it requires watching your other accounts too. See the wash-sale rule guide. This is general information, not tax advice.
The wash-sale rule: the constraint that defines harvesting
The wash-sale rule is the single biggest thing to get right. It disallows a loss if you buy the same or a substantially identical security within 30 days before or after the sale, a 61-day window centered on the sale date. If you harvest a loss and rebuy too soon, the IRS simply ignores the loss for now, defeating the whole exercise. The rule exists to stop people from selling only to capture a paper loss while keeping the exact same position.
Importantly, a disallowed loss is not gone: it is added to the cost basis of the replacement shares and their holding period is adjusted, so the benefit is deferred until you eventually sell those. Still, for a harvester the practical goal is to avoid tripping it in the first place, by using a not-substantially-identical replacement and being careful about automatic dividend reinvestment, which can quietly trigger a wash sale. The full mechanics, including what "substantially identical" means and the cross-account reach, live in the dedicated wash-sale rule guide.
Timing and lot selection
Two practical levers shape how much you actually harvest. The first is timing. A loss has to be realized by December 31 to count for that tax year, so year-end is when many investors review positions, but opportunities appear any time a holding falls below cost, and some harvest during market drops through the year rather than waiting. The second is which specific tax lots you sell.
If you bought a holding in several purchases at different prices, each purchase is a tax lot with its own basis. Using specific-lot identification, you can sell the highest-cost lots (the ones with the biggest loss) rather than defaulting to first-in-first-out, which maximizes the harvested loss. Not every broker defaults to this, so it usually has to be set at the time of sale. For the broader menu of tax levers this sits within, see how to reduce investment taxes. Lot choice has real tax consequences, so confirm the mechanics with a tax professional.
How a harvested loss is used, at a glance
| Step | What happens |
|---|---|
| Offsets capital gains | Realized capital losses cancel realized capital gains dollar-for-dollar, long-term against long-term first, then across types |
| Offsets ordinary income | After gains are used up, up to 3,000 dollars of net loss per year can offset ordinary income (verify current figure) |
| Carries forward | Any unused loss beyond that carries forward indefinitely to future tax years |
| Taxable accounts only | Losses inside an IRA, Roth, or 401k are not deductible, so harvesting only works in a taxable brokerage account |
The order is fixed: the realized loss cancels capital gains first, then offsets up to the yearly ordinary-income limit, then carries forward indefinitely, and none of it works inside a tax-advantaged account. Harvesting mostly defers tax rather than erasing it, since a lower basis means a larger gain later, but deferral and a favorable rate swap can still be worthwhile. The exact dollar limits and rates change and depend on your circumstances, so treat this as a framework and verify current figures with the IRS or a tax professional. It is not tax advice.
Where Walnut fits
The hard part of harvesting by hand is simply seeing which of your holdings are currently underwater, across every account, and by how much, before the wash-sale calendar closes the window. That is a question about your real positions, not a generic list, which is where an AI assistant that reads across your accounts helps. Walnut, an AI investing app, lets you connect any major US broker, then chat in plain words through Claude, ChatGPT, or its built-in AI to see which holdings are below what you paid and where each one sits. It can surface that context; it does not execute harvests, place trades on its own, or judge wash-sale risk for you. Walnut is not a registered investment adviser or a tax adviser, it does not calculate your taxes, and it does not tell you what to buy or sell. For the AI angle specifically, see tax-loss harvesting with AI.
Try Walnut on top of your broker
Walnut connects your accounts, then helps you see which holdings are currently below what you paid and where each one sits, by chatting through Claude, ChatGPT, or its built-in AI. Walnut does not execute harvests, is not an investment adviser or a tax adviser, and does not tell you what to buy or sell.
FAQ
What is tax-loss harvesting?
Tax-loss harvesting is selling an investment that has fallen below what you paid for it in order to realize a capital loss, then using that loss to reduce your taxes. The realized loss offsets your capital gains dollar-for-dollar and, up to a yearly limit, offsets ordinary income too. To stay invested, harvesters typically move the proceeds into a similar but not substantially identical fund. It only works in taxable accounts. This is general information, not tax advice.
How much can tax-loss harvesting save on taxes?
There is no single number, because it depends on your gains, your bracket, and how much your positions have fallen. Mechanically, a realized loss first cancels capital gains dollar-for-dollar, then up to 3,000 dollars per year of any remaining net loss can offset ordinary income, with the rest carried forward. Harvesting mainly defers tax by lowering your basis, so the eventual gain is larger. Verify current figures and consult a tax professional.
What is the $3,000 rule?
After your realized capital losses offset all of your realized capital gains for the year, up to 3,000 dollars of any remaining net loss can be deducted against ordinary income (1,500 dollars if married filing separately). Anything beyond that carries forward to future years indefinitely, where it can offset future gains and again up to the yearly ordinary-income limit. This dollar figure can change, so verify current figures with the IRS or a tax professional.
Does tax-loss harvesting work in an IRA or 401k?
No. Tax-loss harvesting only works in a taxable brokerage account. Gains and losses inside a traditional IRA, Roth IRA, or 401k are not taxed as they happen and losses inside those accounts are not deductible, so there is nothing to harvest. Worse, selling at a loss in a taxable account and rebuying the same security in your IRA can trigger the wash-sale rule across accounts. This is educational, not tax advice.
How do I stay invested after harvesting a loss?
The usual approach is to sell the losing position and immediately buy a similar but not substantially identical fund, so your market exposure barely changes while you bank the loss. For example, swapping one broad US stock index fund for another that tracks a different index. The constraint is the wash-sale rule, which disallows the loss if the replacement is substantially identical. What counts is a gray area, so confirm with a tax professional.
What is the wash-sale rule in tax-loss harvesting?
The wash-sale rule disallows a loss if you buy the same or a substantially identical security within 30 days before or after the sale, a 61-day window. It is the main constraint on harvesting, because rebuying too soon or into a substantially identical fund voids the loss you were trying to capture. The disallowed loss is added to the basis of the replacement shares, so it is deferred, not lost. See the dedicated wash-sale-rule guide.
When should I harvest losses?
Many investors think about harvesting near year-end, since losses have to be realized by December 31 to count for that tax year, but opportunities appear any time a position drops below cost, so some harvest during market dips through the year. Choosing which specific tax lots to sell also matters, since selling the highest-cost lots captures the largest loss. Timing depends on your full tax picture, so this is context, not advice.
Does Walnut do tax-loss harvesting for me?
No. Walnut does not execute harvests, place trades on its own, or give tax advice, and it is not a registered investment adviser or a tax adviser. It can read your connected accounts so you can see, in plain words, which of your holdings are currently below what you paid, which is useful context for a conversation with a tax professional. Any actual harvesting decision and its wash-sale implications should be confirmed with a licensed professional.
From here, learn the key constraint in the wash-sale rule, the basis mechanics in cost basis, the full tax menu in how to reduce investment taxes, and the AI angle in tax-loss harvesting with AI.
Walnut is informational and is not a registered investment adviser or a tax adviser. This page explains tax-loss harvesting; it is not a recommendation to buy, sell, or hold any security or fund, and it is not tax advice. Investing involves risk, including the possible loss of principal, and past performance does not indicate future results. Tax rules, dollar limits, and rates change and depend on your individual circumstances; verify current figures with the IRS or a licensed professional before making any decision. Do your own research or consult a licensed financial or tax professional.