Tax-Loss Harvesting Calculator
Tax-loss harvesting is the practice of selling investments that have declined in value to realise a capital loss, which can then be used to offset capital gains and, up to a limit, ordinary income. The IRS netting rules require you to offset short-term losses against short-term gains first and long-term losses against long-term gains first, with any net loss in one category then available to offset gains in the other. If total capital losses still exceed total capital gains after all netting, you can deduct up to $3,000 of net capital losses against ordinary income per year ($1,500 if married filing separately), saving you tax at your ordinary marginal rate. Net capital losses exceeding $3,000 carry forward indefinitely to future tax years, where they again offset gains dollar for dollar before potentially reaching the ordinary income deduction limit. The wash-sale rule prevents claiming a loss if you purchase substantially identical securities within 30 days before or after the sale, so reinvestment timing matters. This calculator applies the IRS capital loss netting rules, computes the ordinary income deduction, shows the tax saving from harvesting at your short-term and long-term rates, and tracks carryforward losses for future years so you can evaluate whether selling a losing position now is worth the transaction cost.
With short-term gains of $8,000, long-term gains of $15,000, and losses available of $15,000, you can harvest losses to save $0.00 in federal tax this year, with $0.00 in losses available next year.
How tax-loss harvesting is calculated
Tax-loss harvesting uses the IRS netting rules to calculate your net capital gain or loss for the year. The calculation follows a strict order: short-term losses first offset short-term gains, then long-term losses offset long-term gains. If one category has a net loss and the other a net gain, they can cross-net. The resulting net capital loss (if any) can offset up to 3,000 of ordinary income, with the remainder carrying forward indefinitely.
net ST gain = ST gains - ST losses
net LT gain = LT gains - LT losses
combined = net ST gain + net LT gain
net position = combined - prior-year carryforward
if net position is 0 or positive:
taxable capital gain = net position
if net position is negative:
ordinary income offset = min(limit, abs(net position))
carryforward next year = abs(net position) - ordinary income offset
limit = 3,000 (1,500 if married filing separately)
tax savings = ordinary income offset x (marginal rate / 100)
Worked example
ST gains $8,000, LT gains $15,000, ST losses $5,000, LT losses $10,000, federal rate 24%:
- Net ST gain = 8,000 - 5,000 = $3,000
- Net LT gain = 15,000 - 10,000 = $5,000
- Combined = 3,000 + 5,000 = $8,000 net gain
- No loss to offset ordinary income. All $8,000 is taxable capital gain.
- Tax on $8,000 capital gain at 24% = $1,920
Worked example with net loss
Same as above but with $25,000 LT losses instead of $10,000:
- Net ST gain = 8,000 - 5,000 = $3,000
- Net LT gain = 15,000 - 25,000 = -$10,000
- Combined = 3,000 - 10,000 = -$7,000 net loss
- Ordinary income offset = min(3,000, 7,000) = $3,000
- Carryforward to next year = 7,000 - 3,000 = $4,000
- Tax savings = 3,000 x 0.24 = $720
Key rules and timing considerations
Tax-loss harvesting is most effective when you have capital gains in the same year. If you have no gains, you can still use losses to reduce ordinary income by up to 3,000, but this is a slower process if you have large losses. The strategy works best for investors with diversified portfolios, because some holdings will often be down while others are up, allowing you to harvest losses without dismantling your asset allocation.
Timing is critical because capital losses are per-calendar-year. December harvesting decisions are final once the year ends. If you think you will have more gains later in the year, it may be worth waiting to harvest in December when you know your full picture. Conversely, if you have a quiet market, do not forget to harvest losses before December 31st.
The wash-sale rule is enforced by the IRS. If you sell a security at a loss on December 15 and buy it back on December 20, the loss is disallowed. The 30-day window covers 30 days before the sale and 30 days after (61 days total). To avoid triggering the rule, use a similar but substantially different security (e.g., a different fund in the same asset class or a different issuer). Your tax professional can advise on what qualifies as substantially identical.
The tax saving is bigger than the $3,000 line suggests
Most people meet tax-loss harvesting through the $3,000 figure, the net capital loss you can write off against ordinary income each year ($1,500 if married filing separately). That cap has stood at $3,000 since the late 1970s and has never been indexed to inflation, which is why it feels smaller every year. But the $3,000 deduction is the least valuable part of the strategy. The real work happens above it: realized losses offset realized gains dollar for dollar with no ceiling, so a $40,000 loss can wipe out a $40,000 gain in full before the $3,000 rule ever comes into play.
The netting order matters. Short-term losses attack short-term gains first, and those gains are taxed at your ordinary rate of up to 37%, while long-term losses meet long-term gains taxed at 0%, 15% or 20%. Only the leftovers cross over. Steering short-term losses against short-term gains is where the highest-rate dollars are saved.
The trap is the wash-sale rule. Buy the same or a substantially identical security inside the 61-day window (30 days before through 30 days after the sale) and the loss is disallowed for now, folded into the cost basis of the replacement shares instead. Nothing is permanently lost, but the timing benefit is. Anything not used this year carries forward indefinitely, so a bad market year quietly builds a reserve of deductions you can spend against gains in the years ahead.
Tax-loss harvesting: frequently asked questions
What is tax-loss harvesting?
Tax-loss harvesting is the deliberate sale of an investment at a loss to realize the loss for tax purposes. The loss is then used to offset capital gains from other investments or (if losses exceed gains) up to 3,000 of ordinary income in a tax year. Any excess loss carries forward indefinitely to future years. The goal is to reduce your total tax bill while maintaining your desired portfolio allocation.
Why can I only deduct 3,000 in net capital losses against ordinary income?
IRC Section 1211(b) limits net capital losses to 3,000 per tax year when offsetting ordinary income. This limitation was intended to prevent high-income taxpayers from using large investment losses to wipe out all their wages. Any losses beyond the 3,000 cap carry forward indefinitely to the next year, where they can be used again (subject to the same 3,000 limit). This carry-forward right means no loss is ever truly wasted.
What is the wash-sale rule?
The wash-sale rule (IRC Section 1091) disallows a loss on a security if you buy the same or substantially identical security within 30 days before or after the loss sale. The 30-day window is 30 days before the sale and 30 days after (a 61-day window total). The disallowed loss is not lost; instead, it is added to the cost basis of the replacement shares, so you recover the tax benefit when those shares are eventually sold. To cleanly harvest a loss, wait at least 31 days after selling before repurchasing.
How does the netting order work?
The IRS uses a specific order: short-term losses offset short-term gains first, then long-term losses offset long-term gains. If one category has a net loss and the other a net gain, they net together. The combined result is your net capital gain or loss for the year. If the result is a net loss, you can deduct up to 3,000 against ordinary income, and the remainder carries forward.
What investments can I harvest losses from?
You can harvest losses from any investment you own: stocks, ETFs, mutual funds, bonds, or any other security. The capital asset must be a capital asset held in an investment account. You cannot harvest losses from a personal residence, vehicles or property held for personal use (those are not capital assets). Losses from inherited investments are treated the same way as any other capital loss.
Should I reinvest the proceeds from a loss harvest?
Yes, most investors who use tax-loss harvesting do reinvest the proceeds to maintain their target asset allocation. The tax savings effectively become a gift to the portfolio. For example, if you sell 10,000 of a security at an 8,000 loss and reinvest the 10,000 proceeds in a similar (but not substantially identical) security, you harvest the 8,000 loss tax-free while staying fully invested. Some investors use that savings to rebalance into an underweight position.
Official sources
- IRS Publication 550 (Investment Income and Expenses): irs.gov/publications/p550.
- IRS Schedule D (Capital Gains and Losses): irs.gov/pub/irs-pdf/f1040sd.pdf.
- IRS Topic 409 (Capital Gains and Losses): irs.gov/taxtopics/tc409.
- IRC Section 1091 (Wash sales): govinfo.gov.
Reviewed by the CalculatorHub team, edited by James Graham, 13 June 2026. See our methodology. General information, not financial or tax advice.