Nobody likes watching an investment lose value. But there is a silver lining built right into the tax code. If you hold investments in a taxable brokerage account, those losses can be put to work reducing your tax bill through a strategy called tax-loss harvesting.
The catch? A rule called the wash-sale rule that can wipe out your tax benefit if you are not careful. This is the single biggest trap that catches investors who try to harvest losses without understanding the timing requirements.
This tax-loss harvesting walkthrough breaks down everything you need to know. I will explain what tax-loss harvesting is, how the wash-sale rule works, and then walk you through each step with concrete dollar examples. By the end, you will know exactly how to harvest losses without accidentally disqualifying yourself.
Whether you are managing your own portfolio or just trying to understand what your robo-advisor is doing behind the scenes, this guide covers the practical details that most explanations skip. Let us start with the fundamentals.
Table of Contents
What Is Tax-Loss Harvesting?
Tax-loss harvesting is the strategy of selling investments at a loss to offset capital gains taxes, then reinvesting in similar but not identical securities to maintain your market position while reducing your tax liability. When you sell a stock, ETF, or mutual fund for less than you paid for it, you realize a capital loss. That loss becomes a tool you can use against your tax bill.
Here is how the offset works in plain terms. Capital losses first cancel out capital gains dollar for dollar. If you have $10,000 in capital gains for the year and harvest $10,000 in losses, your net taxable gain drops to zero.
If your losses exceed your gains, you can deduct up to $3,000 of the remaining loss against your ordinary income each year. Any leftover loss carries forward to future tax years indefinitely. You never lose the excess, it just waits for future tax years.
That $3,000 ordinary income deduction is one of the most overlooked benefits. For a high-income earner in the 37 percent federal bracket, a $3,000 deduction saves roughly $1,110 in taxes. Add in state taxes, and the savings grow even more.
The loss does not disappear if you cannot use it all in one year. It carries forward, year after year, until you exhaust it against future gains or annual income deductions. This makes even large losses valuable over time.
Not all losses are created equal, though. Short-term capital losses, from assets held one year or less, first offset short-term capital gains, which are taxed at higher ordinary income rates. Long-term capital losses offset long-term gains first.
The IRS requires you to match short-term losses against short-term gains and long-term losses against long-term gains before cross-matching. This ordering matters because short-term gains are taxed more heavily, so using short-term losses against them provides the biggest tax benefit.
The real power of tax-loss harvesting is that you capture the tax benefit without permanently changing your investment strategy. You sell the loser, bank the loss, and immediately reinvest in something similar enough to keep your portfolio allocation intact but different enough to avoid the wash-sale rule. Done correctly, your investment exposure barely changes while your tax bill shrinks.
How the Wash-Sale Rule Works?
The wash-sale rule is the single biggest obstacle to tax-loss harvesting. Under IRS Section 1091, if you sell a security at a loss and then buy the same or a substantially identical security within 61 days, the loss is disallowed. That 61-day window consists of the 30 days before the sale, the day of the sale itself, and the 30 days after the sale.
Let me repeat that because it trips people up constantly. The window is not just 30 days after you sell. It is 30 days before, the sale date, and 30 days after. If you bought shares 15 days before selling at a loss, that earlier purchase can trigger a wash sale.
This is a common trap for investors who dollar-cost average into a position and then decide to harvest a loss. Those regular purchases in the weeks leading up to your sale can invalidate the loss you are trying to claim. Always look backward as well as forward.
When a wash sale is triggered, the disallowed loss does not vanish into thin air. Instead, it gets added to the cost basis of the replacement shares. This means your tax benefit is deferred, not destroyed.
You will eventually recognize the loss when you sell the replacement shares, assuming you do not trigger another wash sale in the process. The holding period of the replacement shares also includes the holding period of the shares you sold. This affects whether future gains are classified as short-term or long-term.
What Counts as “Substantially Identical”?
The wash-sale rule does not apply to just any security you buy. It applies to the same security or a “substantially identical” one. The IRS has never provided a bright-line definition of substantially identical, which creates confusion. But there are practical guidelines that most tax professionals follow.
For individual stocks, substantially identical is straightforward. Selling Apple at a loss and buying Apple back within 61 days is clearly a wash sale. The same goes for buying call options on Apple or exercising warrants. These are the same underlying security.
For mutual funds and ETFs, the analysis gets more nuanced. Two different S&P 500 index funds from different providers are generally not considered substantially identical, even though they track the same index. The reasoning is that they are different legal entities with different management, expense ratios, and tracking methods.
For example, selling Vanguard’s VOO at a loss and buying SPDR’s SPY is widely considered safe by tax professionals. However, two share classes of the same mutual fund would likely be considered substantially identical. If you sell Vanguard Total Stock Market Index Fund Investor Shares and buy Admiral Shares of the same fund, you are probably triggering a wash sale.
When in doubt, look at the CUSIP number. Securities with the same CUSIP are definitely substantially identical. Bonds add another layer of complexity, since two corporate bonds from the same issuer with different maturities may or may not be substantially identical depending on the specific terms.
Cross-Account and Spouse Implications
The wash-sale rule applies across all of your accounts, not just the one where you sold. If you sell a stock at a loss in your taxable brokerage account and your spouse buys the same stock in their IRA within 61 days, you have triggered a wash sale. This is one of the most expensive mistakes investors make.
When a wash sale occurs in an IRA, the disallowed loss is permanently lost. It does not get added to the cost basis of the IRA shares the way it does in a taxable account. The IRS issued this rule in Revenue Ruling 2008-5, and it catches many investors off guard.
If you sell at a loss in your brokerage account and your automatic IRA contribution buys the same fund two weeks later, that loss is gone forever. IRA wash sales are especially punishing because there is no mechanism to recover the deferred loss.
Tax-Loss Harvesting Walkthrough: Step by Step
Now let me walk you through the actual process. This tax-loss harvesting walkthrough covers each step from identifying candidates to filing your taxes correctly.
Step 1: Identify Investments with Unrealized Losses
Open your brokerage account and review your holdings for positions trading below your cost basis. Most brokerages show unrealized gains and losses directly in the portfolio view. Look for losses that are large enough to be worth the effort after accounting for transaction costs and bid-ask spreads.
A good candidate is a position where the loss is significant, you have held it long enough that the sale will not trigger frequent-trader penalties, and you can find a suitable replacement investment. Focus on positions where the loss exceeds your transaction costs by a comfortable margin.
Step 2: Calculate Your Potential Tax Benefit
Before you sell, figure out how much the loss is actually worth. First, tally your capital gains for the year across all accounts. If your harvested losses can offset those gains, multiply the loss by your capital gains tax rate to see the savings.
For most investors, long-term capital gains are taxed at 15 percent, so a $10,000 loss saves $1,500 in taxes. If you do not have capital gains to offset, the loss can still reduce your ordinary income by up to $3,000. At a 24 percent marginal rate, that is $720 in savings.
Any remaining loss carries forward. Also factor in your state income tax rate, which can add meaningful savings in high-tax states like California or New York. The combined federal and state savings can be substantial.
Step 3: Sell the Losing Position
Place the sell order for the full position you want to harvest. Use a market or limit order just like any other trade. Once the order fills, you have realized the capital loss.
Make sure the trade settles before December 31 if you want the loss to count for the current tax year. Settlement for most stocks and ETFs takes one business day as of 2026, so selling on December 30 generally works. Market holidays and weekends can push settlement into the new year, so sell earlier if in doubt.
One important note: if you have multiple lots of the same security bought at different prices, you can choose which lots to sell. Specifying the highest-cost lots maximizes your harvested loss. Just be aware that your brokerage must support lot selection and you must specify the lots at the time of sale, not after the fact.
Step 4: Choose a Replacement Investment
This is the step where the wash-sale rule matters most. You need to stay invested in the market to avoid missing a rebound, but you cannot buy back the same security within 61 days. The replacement must be similar enough to serve the same role in your portfolio but not substantially identical.
For broad market index funds, swapping between providers is usually safe. Sell an S&P 500 fund and buy a total stock market fund, or switch from one provider’s S&P 500 ETF to another’s. For sector funds, move to a different but related sector or a broader fund that includes the sector.
For individual stocks, consider an ETF in the same industry or a direct competitor in the same space. Another option is to simply wait 31 days and buy back the original security. The risk here is being out of the market during a rally.
Many investors underestimate this risk. A strong month can easily wipe out the tax benefit of harvesting. The double-up strategy, which I cover below, is one way to mitigate this concern.
Step 5: Document the Sale and File Correctly
Your brokerage will report the sale on Form 1099-B, which you receive in early 2026 for the prior tax year. You report the sale on Form 8949 and carry the totals to Schedule D on your tax return. Make sure the cost basis, proceeds, and holding period are all correct on the 1099-B.
Brokerages sometimes default to the wrong cost basis method, especially for older positions. Keep records of your trade confirmations, replacement purchases, and your reasoning for why the replacement is not substantially identical. If the IRS ever questions a loss, clear documentation makes all the difference.
For wash sales, your brokerage should flag them on the 1099-B with code W in the adjustment column. But remember that brokerages only track wash sales within their own platform. Cross-brokerage wash sales are your responsibility to identify and report.
How to Avoid the Wash-Sale Rule?
Avoiding the wash-sale rule comes down to following a few proven strategies. Each one keeps you invested while preserving your tax loss.
Strategy 1: Wait the Full 31 Days
The simplest approach is to sell at a loss, wait 31 days, and then buy back the original security. Since the wash-sale window is 30 days after the sale plus the sale day itself, day 31 is the first safe day to repurchase. This strategy keeps your portfolio exactly as it was, but it requires tolerating up to a month of being out of that position.
The risk is obvious. If the security rallies during your 31-day waiting period, you miss the gains. Over a 30-day stretch, the market historically returns about 1 to 2 percent on average. For some investors, the tax savings outweigh the risk of a missed rebound.
Strategy 2: Buy a Similar but Not Identical Security
This is the most popular strategy because it keeps you fully invested. The key is finding a replacement that fills the same portfolio role without being substantially identical.
Sell one S&P 500 ETF and buy a different S&P 500 ETF from another provider. For example, swap VOO for SPY, or IVV for VOO. They track the same index but are issued by different companies with different fund structures.
Sell a total stock market fund and buy an S&P 500 fund plus a small-cap fund. The combined exposure is similar, but the securities are clearly different. This works well when you want to maintain broad market coverage.
Sell a sector-specific ETF and buy a broader market ETF that includes that sector as a major component. Sell an individual stock and buy an ETF focused on that company’s industry. The exposure overlaps but the securities are not substantially identical.
Strategy 3: The Double-Up Strategy
The double-up strategy is a workaround for investors who cannot bear to leave the market for 31 days. Here is how it works. First, buy an equal number of additional shares of the security you want to harvest. This doubles your position.
Then wait at least 31 days. After the 31-day mark, sell your original higher-cost shares at a loss. Because you bought the new shares more than 30 days before the sale, they are outside the wash-sale window and do not trigger the rule.
During the 31-day period, you hold twice your normal position, so you are fully exposed to any market movement. After the sale, you are back to your original position size. The extra capital tied up for a month is the main cost of this strategy.
One caution: the double-up strategy does not work if you bought the additional shares within 30 days before the sale. The pre-sale window is just as important as the post-sale window. Plan the double purchase at least 31 days before you plan to sell the original shares.
Strategy 4: Beware the Dividend Reinvestment Trap
This is the trap that catches the most people off guard. If you have dividend reinvestment enabled, also known as a DRIP, your account automatically buys more shares of the same security every time a dividend is paid. If you sell a position at a loss and a dividend reinvestment occurs within the 61-day window, that small automatic purchase triggers a wash sale.
The wash sale applies to the number of shares purchased by the reinvestment, not the entire position. But even a partial wash sale creates paperwork headaches and reduces your deductible loss. The fix is simple: turn off dividend reinvestment for any security you plan to harvest before you sell.
Leave it off for the full 61-day window, then turn it back on. This trap also applies to automated investing platforms. If you use a robo-advisor or have recurring automatic investments set up, those scheduled purchases can trigger wash sales.
Review your automated settings before harvesting any losses, and pause contributions to the security you are selling. Many investors on Bogleheads and Reddit report discovering wash sales months later because they forgot about a scheduled dividend reinvestment.
Real-World Examples and Calculations
Concrete examples make this much easier to understand. Let me walk through four scenarios with real dollar amounts.
Example 1: Offsetting a Large Gain
Say you sold a rental property earlier this year and have a $15,000 long-term capital gain. In your brokerage account, you hold a tech ETF that is down $10,000 from your purchase price. You sell the ETF, harvest the $10,000 loss, and buy a different but similar tech fund the same day.
Your $10,000 loss offsets $10,000 of your $15,000 gain, leaving you with a net taxable gain of $5,000. At a 15 percent long-term capital gains rate, you save $1,500 in federal taxes. You are still invested in the tech sector through the replacement fund, so your portfolio exposure is essentially unchanged.
Example 2: No Gains to Offset
Suppose you have no capital gains this year, but you have a $7,000 loss in a single stock position. You harvest the full $7,000 loss. You use $3,000 to offset ordinary income this year, saving roughly $720 at a 24 percent marginal rate.
The remaining $4,000 carries forward to next year. Next year, if you have $4,000 in capital gains, the carried-forward loss wipes them out entirely. Over two years, that single $7,000 loss saved you taxes on both ordinary income and capital gains.
Example 3: What a Wash Sale Actually Does
Imagine you sell 100 shares of a stock for a $5,000 loss. Ten days later, you buy 100 shares of the same stock back. You have triggered a wash sale. The $5,000 loss is disallowed for this tax year.
Instead of vanishing, that $5,000 gets added to the cost basis of your new 100 shares. If you originally paid $100 per share and repurchased at $50 per share, your new cost basis becomes $100 per share. That is the $50 purchase price plus $50 per share of disallowed loss.
When you eventually sell those shares for good, the $5,000 loss is built into the calculation. You do not lose the money, but you lose the timing advantage. The tax benefit is pushed into a future year instead of being available now.
Example 4: Crypto Tax-Loss Harvesting
Cryptocurrency has a unique advantage here. As of 2026, the IRS classifies crypto as property, not a security. The wash-sale rule in Section 1091 applies to stocks and securities, not property. This means you can sell Bitcoin at a loss and immediately buy it back without triggering a wash sale under current IRS guidance.
However, this gap may not last. Congress has proposed extending the wash-sale rule to crypto multiple times. If you harvest crypto losses, document the date and be aware that the rules could change. Always verify the current treatment with a tax professional before acting.
Account Considerations: IRAs, Spouses, and Cross-Account Traps
The wash-sale rule does not respect account boundaries. It applies to you as a taxpayer, across every account you control. Understanding how different account types interact with the rule can save you thousands.
Traditional and Roth IRAs create the most dangerous trap. If you sell a security at a loss in your taxable account and the same security is purchased in your IRA within 61 days, the wash sale is triggered. Unlike wash sales between taxable accounts, IRA wash sales result in a permanently disallowed loss.
The cost basis adjustment does not happen inside an IRA because cost basis is irrelevant for tax-deferred or tax-free accounts. The loss simply disappears. This is the one scenario where a wash sale truly costs you money forever.
Spousal accounts add another layer. The IRS treats a married couple filing jointly as a single investor for wash-sale purposes. If you sell at a loss and your spouse buys the same security in their account, that is a wash sale. This includes both taxable accounts and IRAs in your spouse’s name.
Multiple brokerages make tracking harder. Your brokerage only reports wash sales that occur within that single brokerage. If you sell a stock at a loss at Fidelity and buy it back at Schwab, neither brokerage will flag the wash sale on your 1099-B.
You are still responsible for reporting it correctly on your tax return. The IRS may catch discrepancies during an audit, so keep your own records across all accounts. For tax-advantaged accounts like 401(k) plans, the wash-sale rule generally does not apply because gains and losses inside a 401(k) have no tax consequence until withdrawal.
Common Pitfalls to Avoid
Even experienced investors make mistakes with tax-loss harvesting. Here are the most common pitfalls and how to sidestep them.
Automated investing triggers. Robo-advisors like Wealthfront and Betterment handle tax-loss harvesting automatically, but they are not perfect. Users on investing forums report confusion about whether the automated swaps are truly safe from wash-sale violations. If you use a robo-advisor, review their replacement security list and make sure it does not overlap with holdings in your other accounts.
Manual investors should pause all automatic investments and dividend reinvestments before harvesting. A single scheduled purchase during the 61-day window can undo your entire tax benefit. This includes contributions to retirement accounts that may buy the same fund you just sold.
Not tracking across all accounts. The single most common mistake is selling a fund at a loss in one account while a scheduled purchase of the same fund happens in another. This is especially easy to miss with 401(k) target-date funds that rebalance automatically. Before you harvest any loss, check every account including your spouse’s.
Selling too close to year-end. Many investors wait until late December to harvest losses. If your trade does not settle by December 31, the loss counts for the following tax year. With one-day settlement for most equities as of 2026, selling on December 30 usually works.
But settlement delays, market holidays, and slow broker processing can push the settlement into January. Sell by mid-December to be safe. The tax benefit is the same whether you harvest in November or December.
Ignoring transaction costs. If your loss is $200 and your brokerage charges $5 per trade, you are spending $10 in round-trip commissions to save $30 in taxes at a 15 percent capital gains rate. That barely covers the effort. Focus on losses large enough that transaction costs are a rounding error.
Over-harvesting and wash sale cascades. If you trigger a wash sale, then sell the replacement shares at a loss, and buy back again within the window, you create a wash sale cascade. Each disallowed loss adds to the cost basis of the next set of shares, making the accounting increasingly complex. Track every transaction carefully and avoid churning positions.
Frequently Asked Questions
How to not trigger a wash sale when loss harvesting stock?
To avoid triggering a wash sale when loss harvesting, do not buy the same or substantially identical security within 30 days before or 30 days after the sale. Either wait 31 full days before repurchasing the original stock, or buy a similar but not identical replacement security immediately. Turn off dividend reinvestment for the stock you are selling to prevent automatic purchases from triggering the rule.
Do wash sale rules apply to tax gain harvesting?
No, wash sale rules do not apply to tax gain harvesting. The wash-sale rule only disallows losses, not gains. If you sell a security at a gain and repurchase it within 61 days, the gain is still recognized and taxable. Wash sale restrictions exist solely to prevent investors from claiming tax losses while maintaining the same investment position.
How do day traders avoid the wash sale rule?
Day traders avoid wash sales by tracking every purchase and sale across all accounts and ensuring no identical security is bought within 30 days of a loss sale. Many day traders use the mark-to-market accounting election under Section 475, which exempts them from the wash-sale rule entirely. Others trade different securities or use the double-up strategy, but this requires careful record-keeping and significant capital.
What happens if I accidentally trigger a wash sale?
If you trigger a wash sale, your loss is disallowed for the current tax year but added to the cost basis of your replacement shares. You will recognize the loss when you eventually sell those replacement shares. However, if the wash sale occurs in an IRA, the loss is permanently disallowed and cannot be recovered. Your brokerage will flag the wash sale with code W on your Form 1099-B.
How does the wash sale rule affect tax-loss harvesting?
The wash-sale rule is the primary restriction on tax-loss harvesting. It prevents you from claiming a loss if you buy back the same or substantially identical security within 61 days. This forces investors to either wait 31 days before repurchasing or find a similar but not identical replacement investment to maintain market exposure while preserving the tax loss.
How to avoid wash sale penalty?
To avoid the wash sale penalty, follow these steps: sell the security at a loss, wait at least 31 days before buying it back, turn off dividend reinvestment before selling, check all accounts including IRAs and spouse accounts, and either stay out of the market for 31 days or invest in a similar but not identical replacement fund.
Conclusion
Tax-loss harvesting is one of the few strategies that lets you turn investment losses into a tangible tax benefit. By selling losing positions, offsetting your capital gains, and reinvesting in similar securities, you can lower your tax bill without fundamentally changing your portfolio. The key is executing the strategy without tripping the wash-sale rule.
This tax-loss harvesting walkthrough covered the five-step process from identifying losses to documenting your trades. The most important takeaways are simple. Wait 31 days or buy a different but similar security. Turn off dividend reinvestment before you sell. Check every account including your IRA and your spouse’s accounts.
Keep detailed records in case the IRS asks questions. If you are new to this, start small. Harvest one loss this year, document the process, and see the tax savings on your return.
Once you are comfortable, you can make tax-loss harvesting a regular part of your year-end tax planning routine. The savings compound year after year, and carried-forward losses can offset gains for decades to come.