b2KIT

Tax-Loss Harvesting Analyzer

Identify tax-loss harvesting opportunities in a portfolio by comparing unrealized gains/losses with wash sale rule checks.

Tested tool guide Tested browser tools Checked August 16, 2026

What Tax-Loss Harvesting Analyzer does, with a checked example

A losing position only pays off once you sell it: a realized loss offsets capital gains dollar for dollar, plus up to $3,000 of ordinary income per year. This tool takes your positions (ticker, shares, cost basis, current price), computes each position's unrealized gain or loss, nets losses against gains, and shows how much loss you could use this year. It also runs the wash sale check, the usual surprise: buy a substantially identical security within 30 days before or after the sale and the loss is disallowed, added to the replacement shares' cost basis instead.

Worked example

A concrete input and expected output from the current implementation.

Input

Ticker  Shares  Cost/share  Current/share  Recent buys
VTI     100     $250.00     $220.00        bought 20 shares 12 days ago
MSFT    50      $200.00     $250.00
AAPL    40      $180.00     $150.00

Expected output

VTI:  100 shares x ($220.00 - $250.00) = -$3,000
MSFT:  50 shares x ($250.00 - $200.00) = +$2,500
AAPL:  40 shares x ($150.00 - $180.00) = -$1,200

Wash sale check: 20 of VTI's 100 shares were bought 12 days ago, inside the 61-day window, so $600 (20 x $30) of the VTI loss is flagged as disallowed if sold now.

Harvest summary: total loss $4,200, minus $600 at wash-sale risk = $3,600 usable. That offsets the $2,500 gain and leaves $1,100 of net loss, under the $3,000 ordinary-income cap: fully usable this year.

Selling all three positions realizes $4,200 of loss, but the 20 VTI shares bought 12 days ago fall inside the 61-day wash sale window, so $600 of that loss would be disallowed and added to those shares' basis. The remaining $3,600 cancels the $2,500 gain and leaves $1,100, under the $3,000 cap on offsetting ordinary income.

How the result is produced

1

Gain and loss computation

For each position the tool multiplies (current price minus cost basis) by shares held to get an unrealized gain or loss. It totals losing positions and gaining positions separately, then nets them dollar for dollar: losses cancel gains first, and any remaining net loss is measured against the $3,000-per-year limit on offsetting ordinary income, with the excess carried forward to future years.

2

Wash sale check

Each loss position is checked against purchases of the same security inside the 61-day window running from 30 days before the sale through 30 days after it. For shares bought inside that window, the matching portion of the loss is flagged as disallowed under IRC Section 1091 and reported separately, since it would be added to the replacement shares' cost basis rather than deducted in the current year.

Good uses

  • Year-end review: you realized gains earlier in the year and want to see which losing positions, sold now, would cancel those gains before the tax year closes.
  • You recently sold a stock at a loss and need to know whether a rebuy, or an automatic dividend reinvestment, already landed inside the 30-day window and disqualified the loss.
  • Choosing between candidates: comparing positions by unrealized loss and checking whether the harvest is meaningfully larger than the $3,000 ordinary-income cap before you bother selling anything.

Limits and checks

  • Same-ticker flagging only: the wash sale check looks at purchases of the same security, but 'substantially identical' under IRC Section 1091 is a facts-and-circumstances test. Options on the same stock, a fund and its near-identical clone, or preferred and common shares of one company are judgment calls the tool cannot make for you.
  • Garbage in, garbage out: the wash sale flag is only as complete as the buy data you enter. Miss a purchase inside the window, including a reinvested dividend, and the disallowed amount is understated. Your brokerage's records, not this tool, are authoritative for your tax return.
  • Harvesting defers, it does not eliminate: stay invested and you either rebuy after day 31 at a lower basis or trip the wash sale, and either way the loss you claim now shows up later as a smaller loss or larger gain. The $3,000-per-year cap also means losses beyond what you can use this year just carry forward.

Common questions

If I sell at a loss and buy the same stock back 31 days later, is the loss safe?

Yes. The wash sale window runs from 30 days before through 30 days after the sale, so a purchase on day 31 falls outside it and the loss is allowed. Inside the window, the disallowed loss is added to the replacement shares' cost basis, deferring rather than cancelling the benefit. Confirm the exact trade dates with your brokerage before relying on this.

Is harvesting worth it if I have no capital gains this year?

Usually, up to a point: a net capital loss still offsets up to $3,000 of ordinary income per year ($1,500 if married filing separately), and any remainder carries forward indefinitely. But losses are only used at $3,000 a year and each harvest lowers your cost basis, so weigh transaction costs and expected future gains before selling purely for the deduction.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools