Tax-loss harvesting without wash-sale regret
Tax-loss harvesting is the practice of selling an investment that has dropped below what you paid for it, capturing the loss for tax purposes, and immediately reinvesting in something similar so you stay in the market[6]. Done right, it converts a paper loss into a real tax deduction without changing your portfolio. Done carelessly, the wash-sale rule quietly takes the deduction away, sometimes for good.
What a harvested loss is worth
Realized capital losses first offset realized capital gains, dollar-for-dollar and without limit. Losses beyond your gains can then offset up to $3,000 of ordinary income per year ($1,500 for married filing separately), and anything left carries forward indefinitely to future years[3]. The best use of a loss is against income taxed at high rates: short-term gains (taxed as ordinary income) and that $3,000 slice of wages or interest. Losses also shrink net investment income, so a harvest can trim the 3.8% NIIT surtax in a high-MAGI year.
The wash-sale rule
Section 1091 disallows a loss if you buy “substantially identical” stock or securities within 30 days before or after the sale, a 61-day window centered on the sale date[2]. The disallowed loss is not usually destroyed. It is added to the cost basis of the replacement shares, and the old holding period tacks on[1]. You get the loss back when you eventually sell the replacement, so in most cases the rule only delays it. Any purchase inside the window counts[2], so the classic accidental triggers are automatic dividend reinvestment (a DRIP purchase inside the window washes part of the sale) and dollar-cost-averaging purchases you forgot were scheduled[5]. Purchases in your spouse’s accounts count too[1].
The IRA trap: a loss you never get back
One version of the wash sale is truly costly. In Revenue Ruling 2008-5, the IRS held that buying substantially identical securities in your IRA within the window also washes the sale. Because an IRA has no usable cost basis to adjust, the loss is gone permanently[4]. If you harvest a fund in your taxable account, make sure no IRA, Roth IRA, or automated retirement contribution is buying the same thing that month. The usual way around it is to sell one fund and buy a similar but not identical one, for example a total-market index fund in place of an S&P 500 fund. The IRS has no bright-line test: whether two securities are substantially identical depends on all the facts and circumstances[1]. Practitioners generally treat funds tracking different indexes as not substantially identical.
Mostly a deferral
Harvesting resets your basis lower, so the tax you save today is partly a tax you will owe later as a larger gain. The value comes from three places. You deduct against ordinary-rate income now and repay at long-term capital gains rates later. The tax savings compound in the meantime. And the deferred gain may never be taxed at all: basis steps up at death, appreciated shares can be donated, and gains realized in a low-income year can land in the 0% bracket. That last point cuts the other way for many retirees. For 2026, long-term gains are taxed at 0% until taxable income exceeds $49,450 (single) or $98,900 (married filing jointly)[7]. If your retirement income sits under those lines, harvesting gains at 0% (which steps your basis up for free) usually beats harvesting losses whose deduction is worth little. Loss harvesting is chiefly a high-bracket, working-years and early-retirement tool.
A simple routine
Harvest when losses are meaningful, not weekly. Check the 61-day window in every account in the household, pause dividend reinvestment in the affected fund, pick a replacement you would be happy to hold forever (you might: selling it back has its own tax cost), and record the new basis. The loss shows up on Schedule D; carryforwards persist until used.
Try it in Deorbit Plan
The simulator taxes your taxable account using the Cost basis you enter in the Accounts panel. Each withdrawal realizes gains in proportion to the account’s unrealized appreciation. Years of gain harvesting at 0% show up as a higher basis: raise the Cost basis field and watch the tax bars shrink in the Tax & MAGI chart and the taxes slice thin out in the Spending chart. The Year table’s expandable rows break out exactly how much federal tax, NIIT, and realized-gain income each year generates.
This page explains how the rules work. It is not financial, tax or investment advice. Read the disclaimer.
References
- IRS Publication 550: Investment income and expenses (wash sales) ↩
- 26 U.S. Code §1091: Loss from wash sales of stock or securities ↩
- IRS Topic No. 409: Capital gains and losses (the $3,000 limit and carryforward) ↩
- IRS Rev. Rul. 2008-5: Wash sales and IRA purchases ↩
- Investopedia: Wash sale: definition, how it works, and purpose ↩
- Investopedia: Tax-loss harvesting: definition and example ↩
- IRS Rev. Proc. 2025-32: 2026 inflation adjustments (maximum zero rate capital gains amounts) ↩