Skip to content
Falling stock line turned into tax savings with a December 31 deadline and 30-day wash sale window

INVESTING & TAXES

Tax Loss Harvesting: Rules, the 30-Day Wash Sale Rule and an Example

Selling an investment at a loss can cut the tax on your gains this year, and up to $3,000 of your ordinary income. The catch is the wash sale rule and the December 31 deadline. Here is how US tax loss harvesting works, a worked example and a calculator for your own numbers.

IRS rulesWash sale windowTax savings calculator

THE IDEA

How tax loss harvesting works

01

Find positions trading below your cost

Only unrealized losses in a taxable brokerage account count. Losses inside an IRA or 401(k) don't produce a deduction.

02

Sell them to realize the loss

The realized loss first offsets capital gains you realized during the same year.

03

Deduct up to $3,000 of what's left

If losses exceed gains, up to $3,000 ($1,500 if married filing separately) reduces your ordinary income. The rest carries forward to future years.

04

Stay invested without a wash sale

To keep market exposure, buy something that is not substantially identical, or wait more than 30 days before buying the same security back.

Harvesting usually defers tax rather than erasing it: selling and buying back later gives you a lower cost basis, so a future sale shows a bigger gain. The benefit is paying less now, and sometimes paying at a lower rate later.

WHAT THE IRS SAYS

Tax loss harvesting rules

RuleWhat it means for you
Short-term vs. long-termHeld one year or less = short-term; more than one year = long-term. Short-term gains are taxed at ordinary income rates, long-term gains at 0%, 15% or 20% depending on income.
Netting orderShort-term losses offset short-term gains and long-term losses offset long-term gains first; then the two totals are netted against each other on Schedule D.
$3,000 limitA net capital loss reduces other income by up to $3,000 per year ($1,500 if married filing separately).
CarryoverUnused losses carry forward to later years with no expiry date for individuals.
DeadlineThe sale has to happen in the tax year, so trades must be placed by the last trading day of December.
Account typeOnly taxable accounts. Gains and losses inside IRAs and 401(k)s are not reported this way.

THE BIG TRAP

The 30-day wash sale rule

Wash sale window = 30 days before the sale + the sale date + 30 days after (61 days)

If you buy substantially identical stock or securities in that window, including through an option or a contract to buy, the loss is disallowed for now. IRS Publication 550 also applies the rule when the replacement is bought in your IRA or Roth IRA.

NOT LOST

Added to the new basis

A disallowed loss is added to the cost basis of the replacement shares, so you get it back when you sell them later.

WATCH

Dividend reinvestment

An automatic reinvestment within 30 days of the sale is a purchase, and can turn part of the loss into a wash sale.

WATCH

Other accounts

Purchases in your IRA count. Many advisers also treat a spouse's purchases as risky; plan across all accounts.

GREY ZONE

"Substantially identical"

The IRS gives no precise test. Shares of the same company are identical; two funds tracking the same index may be judged too similar.

WORKED EXAMPLE

Harvesting a $9,000 loss

An investor sold a fund earlier in the year for a $6,000 long-term gain. Another position bought eight months ago shows a $9,000 unrealized short-term loss. Assumed rates: 15% on long-term gains, 22% ordinary income.

Illustrative, federal tax only
Net capital result
βˆ’$3,000
$6,000 gain βˆ’ $9,000 loss
Gain tax avoided
$900
$6,000 Γ— 15%
Income deduction
$3,000
The annual limit
Tax on income saved
$660
$3,000 Γ— 22%
Total saved this year
$1,560
$900 + $660
Carried forward
$0
Loss fully used

If the loss had been $15,000, $6,000 would cancel the gain, $3,000 would reduce income this year, and $6,000 would carry into next year. If the investor repurchased the same fund within 30 days, none of this would apply this year: the loss would move into the new shares' basis.

YOUR NUMBERS

Tax loss harvesting calculator

TRY IT

Estimate this year's tax saving

Enter gains you have already realized this year and the losses you could harvest. A simplified federal estimate; nothing you type is saved or sent anywhere.

Estimated tax saved this yearβ€”
Tax without harvestingβ€”
Tax with harvesting (minus = less income tax)β€”
Net capital resultβ€”
Deducted from incomeβ€”
Carried to next yearβ€”

Enter your numbers.

BEFORE DECEMBER

Find harvestable losses in a spreadsheet

Brokers show losses per account; a portfolio spreadsheet shows them across every account at once, by tax lot, with the holding period and any recent purchase that could trigger a wash sale. These columns work in Excel and Google Sheets.

ColumnFormula or entry
Ticker / buy date / sharesOne row per purchase lot, not per ticker
Cost basis=Shares*BuyPrice+Fees
Current price=GOOGLEFINANCE(Ticker) in Google Sheets, or the Stocks data type in Excel
Unrealized gain/loss=Shares*Price-CostBasis
Holding period=IF(TODAY()-BuyDate>365,"Long","Short")
Bought in last 30 days?=COUNTIFS(Ticker,A2,BuyDate,">="&TODAY()-30)>0
Losses available=SUMIFS(UnrealizedGL,UnrealizedGL,"<0",Holding,"Short") and the same for "Long"

The "bought in last 30 days" flag catches the most common accident: selling a lot at a loss while a recent buy of the same ticker sits in the window. For live prices see GOOGLEFINANCE in Google Sheets; for the full layout, how to track your investment portfolio in Excel.

AVOID THESE

Tax loss harvesting mistakes

  • !
    Buying back too soonA repurchase within 30 days, in any of your accounts, delays the loss.
  • !
    Forgetting reinvested dividendsTurn off automatic reinvestment on a position you plan to sell at a loss.
  • !
    Selling the wrong lotIf you bought at several prices, choose the high-cost lots; check your broker's lot method before selling.
  • !
    Letting tax drive the portfolioDon't sell a holding you'd otherwise keep only for a small saving; costs and spreads count too.
  • !
    Waiting until December 31Late-December prices may recover, and broker cutoffs vary. Review losses in November.
  • !
    Losing track of the carryoverRecord unused losses each year so you remember to apply them on next year's return.

READY-MADE TRACKER

Prefer a portfolio tracker that shows gains and losses for you?

The columns above are enough for a DIY sheet. If you'd rather start with realized and unrealized profit and loss already calculated, there is a ready-made tracker for Excel and Google Sheets; check the product page for current features and requirements.

Stock Portfolio Tracker for Google Sheets & Excel
EXCEL + GOOGLE SHEETS

Stock Portfolio Tracker for Google Sheets & Excel

The current listing describes tracking purchases and sales with ticker, sector, quantity, price and fees; automatic unrealized and realized P&L and ROI; price updates; a watchlist; historical performance; multi-currency support; and dividend and tax tracking.

  • Unrealized and realized P&L
  • Purchases and sales with fees
  • Dividend and tax tracking
View the Stock Portfolio Tracker

Holding ETFs, crypto and property too? The Ultimate Investment Tracker covers more asset types. Product features and compatibility are listed on each product page and may change.

Compare investment portfolio trackers

FAQ

Tax loss harvesting questions

What is tax loss harvesting?

Selling investments in a taxable account at a loss to offset capital gains, and up to $3,000 of ordinary income per year, with any remainder carried forward to future years.

What is the 30-day rule?

The wash sale rule disallows the loss if you buy substantially identical securities within 30 days before or after the sale. The disallowed loss is added to the cost basis of the new shares.

How much can I deduct from capital losses?

Losses first offset capital gains without limit. A net loss beyond that reduces other income by up to $3,000 a year, or $1,500 if married filing separately.

When is the deadline for tax loss harvesting?

The sale must happen within the tax year, so place trades by the last trading day of December. Many investors review losses in November to avoid the rush.

Can I buy the same stock back?

Yes, after the 30-day window. Buying it back sooner, in any of your accounts including an IRA, makes it a wash sale.

Does tax loss harvesting work in an IRA or 401(k)?

No. Gains and losses inside tax-advantaged retirement accounts don't create deductible capital losses.

Sources and further reading

Rules checked October 2026 against current IRS publications. This article is general information, not tax or investment advice.

Back to top