- Home
- Learn
- Tax planning
- Tax-loss harvesting
Tax-loss harvesting: how selling at a loss can lower your tax bill
Reviewed by a licensed financial advisor
Tax-loss harvesting means selling an investment that has fallen in value so the loss can offset gains and some ordinary income, then reinvesting so your portfolio stays on course. It works only in taxable accounts and it has one rule that trips up many investors, the wash sale rule. This guide explains how it works, what it is worth and when to skip it.

In this guide
When you sell an investment in a taxable account for less than you paid, you realize a capital loss. Losses first offset capital gains. If losses exceed gains, up to $3,000 of the excess can reduce ordinary income each year, and anything left carries forward indefinitely. To keep your portfolio invested you buy a similar, but not substantially identical, investment. If you buy the same or a substantially identical security within 30 days before or after the sale, the wash sale rule disallows the loss. Harvesting does not apply inside IRAs or 401(k)s.
What tax-loss harvesting is
Investments in a taxable brokerage account are taxed only when you sell. A position that is down has an unrealized loss, which has no tax value until you sell and realize it. Harvesting is the deliberate decision to realize that loss, use it on your tax return and reinvest the proceeds in something similar so that your overall mix of stocks and bonds does not change.
The goal is not to get out of a falling market. You stay invested. You simply turn a paper loss into a deduction.
How losses offset gains
Losses are applied in a set order on Schedule D.
- Short-term losses offset short-term gains, which are otherwise taxed at ordinary rates.
- Long-term losses offset long-term gains, taxed at 0%, 15% or 20%.
- Any net loss in one category offsets the net gain in the other.
- If you still have a net loss, up to $3,000 ($1,500 if married filing separately) reduces ordinary income such as wages.
- Any remaining loss carries forward to future years with no expiration, keeping its short-term or long-term character.
Losses are most valuable when they offset short-term gains or ordinary income, because those are taxed at the highest rates. High earners may also save the 3.8% net investment income tax on gains that are offset.
A worked example
An investor in the 24% bracket, with a 15% long-term capital gains rate, has the following year.
| Item | Without harvesting | With harvesting |
|---|---|---|
| Long-term gain from selling a fund | $12,000 | $12,000 |
| Loss harvested from another fund | $0 | −$18,000 |
| Net capital gain or loss | $12,000 gain | $6,000 loss |
| Tax on the gain at 15% | $1,800 | $0 |
| Deduction against ordinary income | $0 | $3,000, saving $720 at 24% |
| Loss carried to next year | $0 | $3,000 |
| Tax saved this year | $2,520 |
The investor immediately reinvested the sale proceeds in a similar fund, so the portfolio is still fully invested.
The wash sale rule
You cannot claim a loss if you buy the same or a substantially identical security within 30 days before or 30 days after the sale. That is a 61-day window in total. The rule applies broadly.
- All your accounts count, including IRAs and Roth IRAs. Selling a fund at a loss in a taxable account and buying it in your IRA within the window is a wash sale, and that loss is permanently lost.
- Your spouse’s accounts count.
- Automatic purchases count. Reinvested dividends and scheduled contributions into the same fund within the window can trigger it for the shares bought.
- Options and contracts to acquire the security count too.
When a wash sale occurs in a taxable account, the loss is not gone. It is added to the cost basis of the replacement shares and recovered when those are eventually sold. The exception is a repurchase inside a retirement account, where the loss disappears. Brokers report wash sales within a single account on Form 1099-B, but tracking across accounts and across spouses is your responsibility.
Talk to an advisor about managing gains, losses and withdrawals.
Choosing a replacement
The tax code does not define substantially identical precisely, so investors use judgment and stay on the cautious side.
| You sell | Replacement | General view |
|---|---|---|
| An individual stock | A different company in the same industry, or a sector fund | Not substantially identical |
| An S&P 500 index fund | A total US market fund or a large-cap fund tracking a different index | Widely treated as acceptable |
| An S&P 500 fund | Another provider’s S&P 500 fund | Risky. Same index, likely substantially identical. |
| A mutual fund | The ETF share class of the same fund | Likely substantially identical |
| A total international fund | A developed-markets fund plus an emerging-markets fund | Widely treated as acceptable |
The replacement should behave closely enough to the original that you are comfortable holding it for at least 31 days, and possibly for good. Many investors simply keep the replacement, which avoids a second set of transactions. See ETF vs mutual fund and index funds for how these funds differ.
How to do it, step by step
- Review your taxable accounts for positions trading below their cost basis. Set your cost basis method to specific lot identification so you can sell only the highest-cost shares.
- Check the last 30 days for purchases of the same security in any account, including reinvested dividends.
- Pick the replacement before you sell.
- Sell the losing lots and buy the replacement the same day, so you are out of the market for as little time as possible.
- Turn off automatic reinvestment for the sold security for 31 days, and avoid buying it in retirement accounts.
- Keep records. Your broker’s Form 1099-B flows to Form 8949 and Schedule D.
- Track your carryforward from year to year.
Harvesting can be done at any time of year, not only in December. Opportunities appear whenever markets fall.
What it is really worth
Harvesting usually defers tax. It does not eliminate it. The replacement investment has a lower cost basis, so when you eventually sell it your gain is larger by roughly the amount of the loss you claimed. The benefit comes from three sources.
- Time. Tax saved today stays invested and can grow for years.
- Rate differences. Deducting $3,000 against income taxed at 24% and later paying 15% on the matching gain is a real saving.
- Gains that are never taxed. If you hold the replacement until death, your heirs receive a step-up in basis. If you donate appreciated shares to charity, the gain is never taxed. If you later sell in a year when you are in the 0% capital gains bracket, the deferred gain costs nothing.
It is a useful habit, not a strategy that makes losses desirable. A loss is still a loss.
When not to harvest
- You are in the 0% long-term capital gains bracket. For 2027 that is taxable income up to $51,050 for single filers and $102,100 for joint filers. There is no gain tax to offset, and you would lower your basis for nothing beyond the $3,000 ordinary deduction.
- The loss is small relative to trading costs and the effort of tracking.
- The account is an IRA or 401(k). Losses there are not deductible.
- You expect to be in a much higher bracket later and would be deferring a gain into it.
- No suitable replacement exists and you would be out of the market.
Tax-gain harvesting
The reverse can also pay. In a year when your taxable income is within the 0% long-term capital gains bracket, you can sell appreciated investments, pay no federal tax on the gain and buy them back immediately at a higher basis. The wash sale rule applies only to losses, so there is no waiting period. Watch for side effects: realized gains raise adjusted gross income, which can increase the taxable share of Social Security, reduce health insurance subsidies and affect Medicare premiums. See capital gains tax and IRMAA.
Common mistakes
- Buying the same fund in an IRA or a spouse’s account within the window
- Leaving dividend reinvestment switched on
- Choosing a replacement that tracks the same index
- Letting the tax decision change your investment mix
- Harvesting short-term positions without noticing that selling the replacement within a year creates a short-term gain
- Forgetting state income tax, which often treats gains as ordinary income
- Losing track of the loss carryforward
Tax rules change and depend on your full return. This guide is general information, not tax or investment advice. If you want help building a tax-aware plan for your investments and retirement income, talk to an advisor. Request a free call with the form on this page and a licensed advisor will reach out by phone or video, with no obligation.
Local advisor pages near you
State tax rules, local costs and county services all shape how this works in practice. Browse advisor pages by state, or start with North Carolina financial advisors, District of Columbia financial advisors, Alaska financial advisors and Vermont financial advisors. City pages include Financial advisors in Tampa, Financial advisors in Orlando and Financial advisors in Atlanta, and county pages include Advisors in Harris County and Advisors in Dallas County. Ready to talk it through? Talk to an advisor: a licensed advisor will reach out by phone or video, free and with no obligation.
Related reading
- Capital gains tax
- Tax planning guide
- Index funds
- Brokerage accounts
- ETF vs mutual fund
- Standard deduction
Frequently asked questions
What is tax-loss harvesting?
It is selling an investment at a loss in a taxable account to offset capital gains and up to $3,000 of ordinary income, then reinvesting in a similar investment.
How much can I deduct in capital losses?
Losses offset gains without limit. Beyond that, up to $3,000 a year reduces ordinary income and the rest carries forward.
What is the wash sale rule?
A loss is disallowed if you buy the same or a substantially identical security within 30 days before or after the sale, in any of your accounts or your spouse’s.
Can I harvest losses in an IRA?
No. Gains and losses inside IRAs and 401(k)s are not reported on your return.
Is tax-loss harvesting worth it?
It is most useful for people with taxable accounts in the 15% or 20% capital gains brackets. It mainly defers tax, and it has little value in the 0% bracket.
Sources and further reading
- IRS Topic 409: capital gains and losses
- IRS Publication 550: investment income and expenses
- Investor.gov: wash sales
See our editorial standards for how we research and review our guides.
Want help with a tax-aware investment plan?
Talk to an advisor by phone or video call. Free and with no obligation.
Latest money guides and ideas
- States With Inheritance Tax: Rates and Who Pays in 2026Five states with inheritance tax remain: Kentucky, Maryland, Nebraska, New Jersey and Pennsylvania. See each state’s rates, who is exempt and worked examples.
- Treasury Bills: How to Buy T-Bills and How They Are TaxedTreasury bills are short-term U.S. government debt sold at a discount. Learn how T-bills pay interest, two ways to buy them, and how the interest is taxed.
- Is Long-Term Care Insurance Worth It? Cost and CoverageIs long-term care insurance worth it? See what a policy covers, what drives the premium, when to buy, who should skip it and the 2027 tax limits.
- Mega Backdoor Roth: How It Works and 2027 LimitsA mega backdoor Roth moves after-tax 401(k) contributions into a Roth account. See the 2027 limits, what your plan has to allow, worked examples and the steps.
- Saver’s Match 2027: Who Qualifies and How to Claim ItThe Saver’s Match starts with 2027 contributions: a federal deposit of up to $1,000 a year into your retirement account. See the income limits, what counts and how to claim it.
- How to Avoid Capital Gains Tax on Real Estate: 7 WaysSeven legal ways to reduce or avoid capital gains tax on real estate, from the $250,000 and $500,000 home sale exclusion to 1031 exchanges, with worked examples for a home and a rental.
- Medicare Supplement Plans Comparison Chart for 2027Compare all 10 Medicare supplement plans side by side for 2027: what Plans A through N cover, the new deductibles and out-of-pocket limits, and a worked example of what each would leave you to pay.
- FERS Supplement: Who Gets It, How Much, When It StopsThe FERS supplement pays eligible federal retirees an extra monthly amount until age 62. See who qualifies, how it is calculated and how the earnings test can reduce it.
- 403(b) vs 401(k): Key Differences and 2027 LimitsA 403(b) and a 401(k) share the same 2027 contribution limits, but they differ in who offers them, what you can invest in and one extra catch-up for long-serving employees.











