gekro
GitHub LinkedIn
Finance

Tax-Loss Harvest Optimizer

Paste lot-level positions, see which to sell for max harvested losses while the wash-sale rule keeps the deductions valid. Federal-only. Produces a plan - never places trades.

$0 harvestable losses · $0 est. federal tax saved

⚠️ Not advice. This app produces a plan — it never places trades. Wash-sale detection is exact-ticker only; "substantially identical" judgments (ETF equivalents like VOO/IVV/SPY) are listed in the replacement panel for your review. Federal-only — state-tax overlay is a known omission.

Positions (lot-level CSV)

0 lots

Paste a CSV with columns including: ticker, buy_date (YYYY-MM-DD), shares, cost_per_share (or cost_basis total), current_price. Headers are auto-detected (case-insensitive, common synonyms recognized). One row per tax lot.

No positions yet.

Recent transactions (last 60 days) Optional — adds wash-sale awareness

Same CSV shape. Lets the optimizer flag tickers you bought in the last 30 days (buying again within 30 days after a loss-sale triggers wash-sale). Today is the reference date.

Harvest plan

Paste positions above and the plan appears here.

Replacement-security suggestions

If you harvest a loss but want to keep market exposure, you must avoid "substantially identical" securities for 30 days. These are commonly-cited not-substantially-identical pairings — review with your tax advisor; the IRS hasn't published a definitive list.

Replacement candidates appear when you have harvest-eligible lots.

Tax assumptions

$3,000/yr is the federal cap on net capital losses deductible against ordinary income; surplus carries forward.

Plan summary

Lots to sell0
Losses harvested (allowed)$0
Disallowed by wash-sale$0
Short-term losses$0
Long-term losses$0
Est. federal tax saved$0
To carry forward$0
YTD realized (already this year) Optional context

YTD net: $0

As-is, no warranty. These apps are free under their listed license and run entirely in your browser. Use at your own risk — don't blame me if your PC catches fire, your dog runs away, or the math turns out wrong. Verify anything that actually matters. None of this is professional financial, medical, legal, or engineering advice.

© 2026 Rohit Burani · MIT · Built at gekro.com · View source ↗

Guide

What It Does

Paste lot-level positions (one row per purchase), set your tax brackets and harvest target. Get a per-lot plan:

  • HARVEST (green) — sell at a loss, the loss is deductible
  • WASH (yellow) — sell would trigger wash-sale, loss disallowed
  • HOLD (grey) — at a loss but the target has already been met
  • GAIN (blue) — holding avoids realizing a taxable gain

Plus aggregate stats: lots to sell, total losses harvested, ST vs LT split, federal tax saved, carry-forward beyond the $3,000/yr cap.

Input format

CSV with these columns (case-insensitive, synonyms recognized):

RequiredAliases
tickersymbol, sym, stock
buy_datedate, purchase_date, acquired
sharesquantity, qty, units
cost_per_share or cost_basisprice, cost, unit_cost, avg_price (or basis aliases)
current_pricecurrent, market_price, last
ticker,buy_date,shares,cost_per_share,current_price
AAPL,2024-03-15,100,170.50,225.00
TSLA,2024-01-10,40,400.00,180.00
VOO,2024-06-20,80,490.00,560.00

Optionally paste a “recent transactions” CSV for the last 60 days — buys there get cross-checked against the wash-sale window.

Wash-sale rule

IRC §1091: if you sell a security at a loss and you (or your spouse, or any account you control including IRAs) buy a substantially identical security within 30 days before or after the sale, the loss is disallowed. Instead, the disallowed amount is added to the cost basis of the replacement shares — you eventually get the benefit, but the harvest year’s deduction is gone.

This app’s detection scope:

DetectedHow
✅ Same-ticker buy within ±30 d of today (from your positions)Direct match in the lot list
✅ Same-ticker buy in the recent-transactions CSVDirect match in optional input
❌ Spouse / IRA / 401(k) purchasesYou’d have to add them to the recent-tx CSV
❌ ETFs tracking the same index (SPY vs VOO vs IVV)Listed in the replacement panel for your judgment
❌ Options / warrants of the same underlyingOut of scope
❌ Sales placed in the future”Today” is the reference point — set the reference date if you’re planning ahead

The IRS hasn’t published a definitive list of what counts as “substantially identical.” Most tax pros treat SPY/IVV/VOO as not substantially identical (different funds, different sponsors), but two share classes of the same fund clearly are. The replacement panel surfaces commonly-cited pairings — verify with your tax advisor.

Tax assumptions

Short-term rate defaults to 24% (the 2026 federal marginal for ~$100K-$200K MFJ income). Pick yours.

Long-term rate defaults to 15% (the standard bracket for most filers). Choose 20% for high earners or 23.8% if you also pay the 3.8% Net Investment Income Tax.

$3,000 cap: federal rules let you deduct at most $3,000 of net capital losses against ordinary income per year. Excess carries forward indefinitely (still useful for offsetting future gains). The plan shows the carry-forward amount.

Federal-only: state-tax overlay is deliberately out of scope for v1 because state conformity to federal cap-gains treatment varies wildly (CA partial, NJ no LT preference, NH/TN no income tax) and getting it wrong would mislead. Add the state delta manually if you need it.

What’s NOT Included (intentional)

  • Trade execution — never. The app produces a plan; you review and place trades in your brokerage. This is a hard rule.
  • Broker integration — same reason
  • Real-time prices — paste your current prices; if you want live quotes write your own ETL into the CSV
  • State-tax overlay — see above
  • Cross-account aggregation — your spouse’s IRA can trigger wash-sale on your taxable account. Either add those buys to the recent-tx CSV or remember to check manually
  • Options / futures handling — equities only for v1
  • Persistent state — reload starts fresh, by design

For informational purposes only. Not financial, medical, or legal advice. You are solely responsible for how you use these tools.