By Stephen Milner · UtilityForge · Last reviewed: May 2026
Tax-loss harvesting is the practice of selling investments at a loss to offset capital gains realized elsewhere in the same tax year. The IRS allows you to subtract capital losses from capital gains before tax rates apply, reducing the amount of gain subject to tax. This calculator applies the IRS netting rules automatically and shows you the federal tax savings from harvesting your positions.
The IRS requires a three-step netting process before you apply tax rates to your net capital position.
Step 1: Net within each category. Sum all short-term gains and losses together to get a net short-term figure. Do the same for all long-term positions independently.
Step 2: Cross-category offset. If one category produces a net gain and the other a net loss, the loss offsets the gain. A net short-term loss can offset a net long-term gain, and a net long-term loss can offset a net short-term gain. After this step, at most one category will have a remaining non-zero amount.
Step 3: Net capital loss deduction. If your total net capital position is still negative after both steps, you can deduct up to $3,000 from ordinary income per year. Any remaining loss carries forward to future tax years, keeping its short-term or long-term character.
| Netting step | Rule |
|---|---|
| Short-term netting | Short-term losses offset short-term gains first |
| Long-term netting | Long-term losses offset long-term gains first |
| Cross-category offset | Remaining losses from one category offset gains in the other |
| Ordinary income deduction | Net capital loss reduces ordinary income by up to $3,000 per year |
| Carryforward | Unused capital loss carries forward indefinitely, retaining its character |
Source: IRS Publication 550, Investment Income and Expenses; IRS Schedule D instructions.
Suppose you have realized a $12,000 short-term gain on a stock sale and hold a position with a $9,000 unrealized long-term loss.
Without harvesting: the $12,000 short-term gain is taxed at ordinary income rates. For a single filer in the 22% bracket, that is approximately $2,640 in federal tax (ignoring NIIT).
After harvesting the $9,000 long-term loss: the IRS applies Step 1 (net within type), giving $12,000 net short-term gain and -$9,000 net long-term loss. In Step 2 (cross-category offset), the $9,000 long-term loss reduces the $12,000 short-term gain to $3,000. The remaining $3,000 short-term gain is taxed at 22%, giving approximately $660 in federal tax. Tax saved: $2,640 - $660 = $1,980.
The order in which losses offset gains affects how much tax you save. Short-term gains are taxed at ordinary income rates, which can reach 37%. Long-term gains are taxed at preferential rates of 0%, 15%, or 20%. If you have a net short-term loss and a net long-term gain, the IRS applies the short-term loss to the long-term gain (cross-category offset). That saves you at the long-term rate rather than at the higher short-term rate. Recognizing how each loss interacts with your specific gain mix helps you prioritize which positions to harvest.
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 under Section 1091. The disallowed loss is not gone permanently; it is added to the cost basis of the replacement shares and deferred to the future sale.
The 30-day window applies on both sides of the sale, creating a 61-day blackout period in total. To harvest a loss cleanly, either wait 31 days before buying back the same security, or immediately buy a similar but not identical position (such as a fund tracking a different index in the same asset class) to maintain market exposure while restarting the clock.
If your net capital loss exceeds your capital gains, up to $3,000 of the remaining loss can reduce ordinary income for the year. Married couples filing separately are each limited to $1,500. This deduction saves you your marginal ordinary income tax rate multiplied by the deducted amount. Any loss beyond $3,000 carries forward and can be applied in future years with no expiration.
You can harvest losses at any point during the tax year. Many investors review their portfolios in October and November to identify candidates before the December 31 year-end closing. Harvesting early in the year leaves time to reinvest in a non-wash-sale substitute before the 30-day window expires. Tax-loss harvesting is most beneficial when your marginal rate is high and when you have realized gains in the same year to offset.
Selling one index fund at a loss and buying a fund tracking a different index in the same asset class lets you realize the tax loss while maintaining similar market exposure. For example, selling an S&P 500 ETF and buying a total market ETF (which tracks a different index) is a common approach. The IRS has not issued comprehensive guidance on all ETF pairs, and a fund that holds nearly identical securities might still be treated as substantially identical. Consult a tax professional if you are unsure whether your specific substitution qualifies.
Tax-loss harvesting is the practice of selling securities at a loss to offset capital gains realized in the same tax year. The IRS allows capital losses to reduce capital gains before tax rates apply. If losses exceed gains, up to $3,000 of the remaining net capital loss can be deducted from ordinary income per year. Any amount beyond that carries forward to future years. Source: IRS Publication 550.
Under IRS Section 1091, 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 tax purposes. The disallowed loss is not permanently gone; it is added to the cost basis of the replacement shares, deferring the loss to the future sale of those shares. The 30-day window applies on each side of the sale date, creating a 61-day blackout period in total. To harvest the loss cleanly, wait 31 days before buying back the identical security, or immediately buy a similar but not identical replacement to maintain market exposure.
The IRS requires netting within each category first, then cross-category offsetting. Short-term gains and losses are netted together. Long-term gains and losses are netted separately. If one category produces a net gain and the other a net loss after this step, the loss offsets the gain across categories. For example, a $5,000 net long-term loss offsets $5,000 of a net short-term gain. The remaining short-term gain is then taxed at ordinary income rates. Source: IRS Publication 550 and Schedule D instructions.
If your total net capital loss exceeds your capital gains, you can deduct up to $3,000 of the remaining loss from ordinary income for the year. Married couples filing separately are each capped at $1,500. This deduction reduces your taxable income by the deducted amount, saving you your marginal ordinary income tax rate times that amount. For a taxpayer in the 22% bracket, a $3,000 deduction saves $660 in federal income tax.
Yes. Capital losses that exceed the $3,000 annual deduction cap carry forward to subsequent tax years with no expiration. The losses retain their character: short-term losses carry forward as short-term, and long-term losses carry forward as long-term. You report carryforward losses on Schedule D each year. The carried-forward losses offset gains in future years under the same netting rules. Source: IRS Publication 550.
You can harvest losses at any time during the year; the IRS only requires that the loss be realized before December 31 to count in that tax year. Many investors review their taxable portfolios in October or November to identify harvest candidates while there is still time to reinvest before year-end. Harvesting earlier in the year gives you more time to find a non-wash-sale substitute and potentially benefit from recovery gains in the replacement position.
Generally yes, if the two funds are not substantially identical. The IRS has not published a definitive list of substantially identical fund pairs, but the standard approach is to substitute a fund tracking a different index. Selling a Vanguard S&P 500 ETF and buying a Schwab total market ETF tracking the Dow Jones US Total Stock Market Index is a common example, as they track different indexes and hold different security sets. The closer the two funds are in composition, the greater the risk of a wash-sale determination. When in doubt, consult a tax professional before assuming the loss is deductible.
In most states that tax capital gains, yes. States that conform to federal capital gains treatment allow the same netting of losses against gains. Some states, including California, tax all capital gains as ordinary income but still permit capital losses to offset them. A few states do not allow capital loss deductions against ordinary income or have different carryforward rules. Check your state's specific tax code, particularly if your state treats short-term and long-term gains differently from the federal system.