Investing basics · Accounts and taxes
Tax-loss harvesting: how it works, the wash-sale rule and its limits
How tax-loss harvesting offsets gains and up to $3,000 of income under 2026 US federal rules, with worked examples, the wash-sale limit and the trade-offs.
On this page
Every portfolio that holds more than a few positions ends up with some that are worth less than you paid. Tax-loss harvesting is the practice of selling those positions in a taxable account to realize the loss, using it to offset taxable gains and, within a limit, ordinary income, and usually reinvesting the money so your market exposure stays roughly the same.
Done carefully, it can cut a year's tax bill by hundreds or thousands of dollars. It is also widely misunderstood. A harvested loss mostly defers tax rather than erasing it, it is constrained by the wash-sale rule, and it has real costs that make it pointless for some investors. This guide explains the mechanics under US federal law for tax year 2026, works through the numbers, summarizes the wash-sale constraint, and sets out where harvesting helps and where it doesn't.
It assumes you know how gains are classified and taxed; the Capital gains tax on stocks: 2026 rates, holding periods and basis page covers holding periods, 2026 rates, cost basis and the loss-netting order. State tax treatment of capital losses varies. This is education, not tax advice, and the examples are illustrative, not a recommendation to buy or sell anything.
How tax-loss harvesting works
A loss on paper does nothing for your taxes. The tax code only counts losses you realize by selling or otherwise disposing of the asset. Harvesting is deciding to realize a loss now rather than waiting.
The basic sequence:
- Find a position below its cost basis in a taxable account. With several lots of the same security, look at lot level: a recent high-priced lot can be at a loss while older lots are at a gain. Selling only that lot through specific identification realizes just the loss.
- Sell it. The loss is realized on the trade date, so a sale has to execute by December 31 to count for that tax year.
- Reinvest the proceeds, if you want to stay invested, in something that keeps a similar role in the portfolio but is not substantially identical, or wait 31 days and buy the original back.
- Report the sale on Form 8949 and Schedule D. The loss nets against your gains in the order the IRS sets: short-term against short-term, long-term against long-term, then across classes, with up to $3,000 of any net loss deducted from ordinary income.
Why the saving is mostly a deferral
The $1,920 in the example is real money this year, but the story doesn't end there. The new fund's cost basis is $19,000, not $30,000. If both funds recover to $30,000 and she sells the replacement, she realizes an $11,000 gain that she wouldn't have had if she had held the original. In effect, she moved $11,000 of taxable gain from this year into the future.
Harvesting produces a permanent saving in a few situations:
- Rate arbitrage. A loss offsets income taxed at a high rate (short-term gains or the $3,000 against ordinary income) while the later gain is taxed at a lower long-term rate, or at 0% if your income is lower when you sell.
- Step-up at death. Assets held until death generally get a new basis equal to their market value, so the deferred gain may never be taxed.
- Charitable giving. Donating appreciated shares held more than a year to a qualified charity generally avoids tax on the gain.
When none of those applies, the main benefit is the time value of the deferred tax: the money you didn't pay this year stays invested and compounds.
The wash-sale constraint, briefly
The wash-sale rule in Internal Revenue Code §1091 stops you from claiming a loss when you haven't really changed your position. A loss is disallowed if, within 30 days before or after the sale (a 61-day window including the sale date), you:
- buy substantially identical stock or securities,
- acquire them in a fully taxable trade,
- acquire a contract or option to buy them, such as a call option, or
- acquire substantially identical stock in your IRA or Roth IRA (IRS Rev. Rul. 2008-5).
A purchase by your spouse or by a corporation you control counts too.
In an ordinary wash sale the loss isn't lost forever: it is added to the basis of the replacement shares, and the holding period of the sold shares carries over. The IRA case is different. When your IRA makes the replacement purchase, Rev. Rul. 2008-5 says the loss is disallowed and your basis in the IRA is not increased, so the loss is gone for good.
Two practical traps catch harvesters most often. Automatic dividend reinvestment in the same security, in any of your accounts, can buy a few shares inside the window and turn part of the loss into a wash sale. And buying first, selling later, such as adding to a losing position and then selling the older lot within 30 days, triggers the rule just as surely as buying back after the sale.
What counts as "substantially identical"
The IRS has not published a bright-line test, and Publication 550 leaves the question to the facts of each case. Shares of the same company are substantially identical. Shares of a different company in the same industry generally are not. The gray area is funds: two index funds from different sponsors that track the same index have a closer resemblance than two funds that track different indexes, such as an S&P 500 fund and a total-market fund. Many investors who harvest use replacements that track a different index for this reason. Whether two specific funds are substantially identical is a judgment that IRS guidance does not settle.
Limits and costs of harvesting
The $3,000 ceiling. Net capital losses beyond your gains offset only $3,000 of ordinary income a year ($1,500 married filing separately). A large harvested loss can take years to use up through carryforwards, though it never expires during your lifetime.
Lower future basis. Each harvest lowers the basis of what you hold. Later sales realize larger gains. If your future tax rate is higher than today's, harvesting can cost more later than it saves now.
Taxable accounts only. IRAs, 401(k)s and HSAs don't recognize gains or losses on trades inside them, so there is nothing to harvest there.
The 0% bracket. For 2026, long-term gains are taxed at 0% for single filers with taxable income up to $49,450 ($98,900 joint). Using a loss to offset a gain that would have been taxed at 0% saves nothing. Investors in that range sometimes do the reverse, tax-gain harvesting: selling winners to realize gains at 0% and buying back immediately to reset a higher basis. Wash-sale rules apply to losses, not gains, so an immediate repurchase is allowed.
Tracking error. The replacement fund won't move exactly like the original. In the weeks you hold it, it can gain or lose more than the position you sold.
Costs and complexity. Bid-ask spreads, any commissions or fund transaction fees, and the record-keeping of more lots all reduce the benefit, especially for small losses.
State taxes. Most states follow the federal treatment of capital losses, but not all do, and some limit or disallow the deduction against ordinary income.
Harvesting compared with the alternatives
| Approach (US federal, 2026) | Tax effect this year | Later effect | Main constraint |
|---|---|---|---|
| Hold the losing position | None | Gain or loss measured from the original basis | None |
| Harvest and buy a similar fund | Loss offsets gains and up to $3,000 of income | Lower basis; larger gain when you sell | Wash-sale rule; tracking error |
| Harvest and wait 31 days to rebuy | Same as above | Same as above | Out of the market for 31 days |
| Sell and rebuy within 30 days | Loss disallowed, added to the new basis | Loss recognized when the new shares are sold | It is a wash sale |
| Tax-gain harvesting (0% bracket) | Gain realized at 0% | Higher basis; smaller future gain | Only below the 0% threshold |
How Finabase helps
Finabase is a research app, not a broker or a tax tool: it doesn't place trades, flag wash sales, or produce tax lots for your return. It helps with the analysis around a harvesting decision. In a portfolio, each position you record shows its cost, market value and unrealized gain or loss, so positions trading below cost are easy to spot, and sells you enter are matched against your open buy lots first in, first out. The comparison page plots a fund and a candidate replacement on one rebased chart, which shows how closely they have tracked each other, and each fund's symbol page shows its quote, chart and profile, which usually names the index it follows. Index investing: passive vs. active funds and what the data shows explains how index funds differ, and How dividends and interest are taxed: qualified, ordinary, muni covers the yearly tax on income those funds pay.
Frequently asked questions
How much can I save with tax-loss harvesting?
It depends on your gains and your tax rates. A harvested loss offsets capital gains dollar for dollar, then up to $3,000 of ordinary income a year; the saving is that amount times the rate it would have been taxed at, minus the extra tax later on the replacement's lower basis.
Can I buy the same stock back after selling it at a loss?
Yes, but wait at least 31 days after the sale, and avoid buying it in the 30 days before. A repurchase inside that 61-day window, including one in your IRA or by your spouse, is a wash sale and the loss is disallowed.
Does tax-loss harvesting work in an IRA or 401(k)?
No. Gains and losses inside tax-advantaged accounts aren't reported or deductible, so there is no loss to harvest. And buying a stock in your IRA within 30 days of selling it at a loss in a taxable account permanently forfeits that loss.
When is the deadline for tax-loss harvesting?
The sale must have a trade date on or before December 31 of the tax year. Settlement can fall in January.
What happens to losses I can't use this year?
They carry forward to later years with no expiration during your lifetime. Each year they offset that year's gains first, then up to $3,000 of ordinary income.
Summary
Tax-loss harvesting turns paper losses into realized losses in a taxable account so they can offset capital gains and, under 2026 US federal rules, up to $3,000 of ordinary income a year, with the rest carried forward. Because the replacement investment starts from a lower basis, the benefit is mostly a deferral; it becomes a lasting saving when the rates differ in your favor, when gains are never realized, or through the time value of money. The wash-sale rule disallows the loss when substantially identical securities are bought within 30 days before or after the sale, in any of your accounts, your IRA or your spouse's, and an IRA repurchase forfeits the loss permanently. Harvesting does little for investors in the 0% long-term bracket, and costs, tracking error and state rules all chip away at what it is worth.
Sources and further reading
- Internal Revenue Service — Publication 550, Investment Income and Expenses (Capital losses; Wash sales)
- Internal Revenue Service — Topic no. 409, Capital gains and losses
- Internal Revenue Service — Rev. Rul. 2008-5 (Internal Revenue Bulletin 2008-3)
- 26 U.S. Code §1091, Loss from wash sales of stock or securities (Cornell Law School LII)
- Internal Revenue Service — Rev. Proc. 2025-32 (2026 rate tables and capital gains thresholds)
- Internal Revenue Service — Instructions for Form 8949 and Schedule D