The Definitive Guide to Tax-loss Harvesting and Avoiding Wash Sales

Tax loss harvesting is a strategy for reducing taxes today by selling funds at a loss. While this seems counterintuitive, this allows you to pay less in taxes today and maybe bypass taxes altogether.

Written by Adam on 2018-11-19. Minafi, Blog, Taxes, Investing, Canonical. 6 comments. Find out how I make money.

Tax-loss harvesting sounds like some terribly difficult strategy. In reality, it’s an extremely simple concept, and yet the timing and rules around severely limit your possibility to use this strategy to lower your taxes.

I’ve been investing at Vanguard for about a decade in diversified index funds, and even there I’ve been able to tax-loss harvest a number of times to reduce my taxes.

In this guide, I’m going to lay out what tax-loss harvesting is, how you can perform one, and how to avoid a wash sale while doing it (how’s that for a thesis statement!).

tax harvesting

We’ll also look into something else I strongly believe – that you likely don’t need to worry about tax-loss harvesting after a certain point (when your income is low, or you’re retired on a lower income). 

Before we get started, let’s look at a quick definition of these terms.

Tax-loss harvesting: Selling funds at a short-term or long-term loss in order to bank the “losses” from those funds in order to cancel out “gains” from elsewhere in your portfolio for the current year.

In other words, tax-loss harvesting means selling some funds in your account that are currently in the red and taking that loss. That loss will cancel out a gain somewhere else in your portfolio for the year.

There is one caveat in this though – it’s called the wash sale rule. It

Wash Sale Rule: If you sell a fund for a loss (to tax-loss harvest it) you may not re-buy a substantially identical fund for 30 days.

If you think about this rule, it makes sense. If you had a fund and it currently had lost $1,000 and you sold it, only to rebuy it a second later then the only reason to do that would be to avoid taxes (which the government isn’t a fan of).

We’ll talk more later about wash sales, when I’ve personally been hit by them when tax-loss harvesting at Vanguard, and how to avoid them.

Backup — What About Taxes?

In order for these to make sense, you’ll need to first understand how taxes work for investing. If you’re unfamiliar with how they work, I’d recommend checking out my free course on investing which has two full chapters on how to optimize for taxes (it’s a big topic!). 

As for how taxes work – let’s abbreviate things a little:

  • You’ll pay taxes on dividends you receive from holding stock either at a short-term or a long-term capital gains rate.
  • You’ll pay taxes on funds you sell at either a short-term or a long-term capital gains rate.

The short-term rate will always be higher than the long-term rate. Often, these taxes are unavoidable. You’ll pay them just for the privilege of holding the fund, which is something you can’t get around.

What you do have control over is if you are able to perform some other action (tax-loss harvesting) that cancels out those taxes on dividends.

Tax-Loss Harvesting in a 401k, IRA or Roth IRA

If you’re investing in a tax-advantaged account like a 401k, IRA or Roth IRA you can’t tax-loss harvest. The reason you would need to tax-loss harvest is because your funds are down compared to their cost basis, allowing you to sell them offset gains elsewhere. Within tax advantaged accounts, you can buy or sell whenever you want without paying taxes on the sales.

A Tax Loss Harvesting Example

Let’s look at an example of how this could work in the real world. Look at the following portfolio:

Fund Value Short-term
Capital Gains
Capital Gains
$VTSAX $43,000 +$1,000 +$2,000
$VEMAX $7,000 -$1,200 -$1,000
Totals $51,000 -$200 +$1,000

Looking at these, you can immediately see that since $VTSAX has positive short-term gains and long-term gains there is no option to tax-loss harvest there.

$VEMAX is a different story though. There’s a combined -$2,200 sitting there that you could use to offset taxes elsewhere. So let’s sell $2,200 and so it!

Not so fast! The -$2,200 isn’t sitting on top of that $7,000 in $VEMAX. There are multiple ways to determine your cost basis. Your cost basis is how you determine which funds to sell. Depending on your situation you may have multiple options for this, but probably not. For this post, I’m going to assume you’re using the average cost option. 

What that means is that in order to “harvest” those $2,200 in tax-losses, you’ll need to sell all $7,000 of your $VEMAX. At that point, you’d have $2,200 in capital losses sitting in your capital pool (think mana pool from Magic the Gathering) that you have until the end of the year to use.

And that’s it actually. If you did nothing else, then you’d end the year with -$2,200 in capital gains for the year. This has a different term – capital loss. You can file this on your taxes and use it the following year if you want.

There is no limit on the amount of “carryover capital loss” you can carry over each year. For instance, you could carry over $3k one year, $5k another year, and $10k the year after for a total of $18k in capital gains losses. You can use those over any number of years, but would only be able to use $3,000 in carryover capital losses per year.

In this particular case, I’d say do exactly that! File this capital loss of -$2,200 on your taxes for the year. Then in the following year, you can use that money to offset dividends again.

There is no limit to the number of years you can use this carry over either. You could offset gains as long as that carry over lasts (and as long as you keep your taxes organized to reflect it).

Reducing Taxes Even Further

There is another option though – using this $3,000 (-$2,000 ST / -$1,000 LT left) right now. Take a look at your $VTSAX investment:

  • $VTSAX: $43,000 invested, +$1,000 in unrealized short-term capital gains, +$2,000 in unrealized long-term long-term gains
Fund Value Short-term
Capital Gains
Capital Gains
$VTSAX $43,000 +$1,000 +$2,000

It has $3,000 in unrealized capital gains – which just means that the fund had increased in value but you haven’t sold any of it (realized those gains).

Just like with $VEMAX, you can’t just sell $3,000 and have it be all gains. Instead, you’d have to sell all $43,000 of your $VTSAX – assuming you’re using the same cost basis method.

If you did sell all your $VTSAX, you’d realize $3,000 in gains, offset $2,200 of them with your losses from $VEMAX, you would have capital gains of +$800 that you would need to pay taxes on.

On that $800, you’ll pay whatever your short-term capital gains tax rate is – which is quite often 22%. That means you’d pay $176 in taxes one tax season rolls around. This is because when applying capital losses, they are applied to your long-term gains first, then to your short-term gains (unfortunately).

What if instead, you sold exactly enough to not need to pay taxes? In other words, you’d want to sell more than $0 and less than $43,000 of your $VTSAX so that you didn’t need to pay that high ordinary income tax rate for any gains. How much would you have to sell?

Turns out you need to do a little math for this. You want to sell exactly $2,200 of your $3,000 in capital gains. That means that you’d want to sell:

So, since $2,200 is 73.3333% of our total potential gains, we’d need to sell 73.3333% of our total $VTSAX to balance things out.

If you sold $31,533.19 of your $VTSAX, then you’d balance the equation and use all of your tax harvested losses. At the end of that, your $VTSAX holdings would look something like this:

Fund Value Short-term
Capital Gains
Capital Gains
$VTSAX $11,466.82 +$266.66 +$533.33

You’ll notice the unrealized short-term and long-term gains have gone down proportionately. If you do the quick math, you’ll see where things add up, starting with short-term gains.

Offset short-term capital gains

So of the possible $1,000 in short-term gains if we had sold everything, we sold enough to cover $733.33 of it. Next, we can look at long-term gains to see how much of our $2,000 we used on them.

Offset long-term capital gains

After selling $VEMAX we had an extra $2,200. If you add these up, you’ll see we’re right on track, or well, close enough.

Total capital gains offset

In other words, you sold $31,533.19, realized $733.33 in short-term capital gains and realized $1,466.66 in long-term capital gains. Those $2,200 in capital gains were offset by your sale of $VEMAX for -$2,200 during the same year.

Rebuying Funds

So now that you’ve sold your $VTSAX (US Stock market fund) and your $VEMAX (Emerging market fund) what do you do next? If you’re like me you immediately would want to jump back into the exact same fund to bring your asset allocation back to your target zone. Unfortunately, that’s not possible.

Remember the wash rule we talked about earlier? This one?

Wash Sale Rule: If you sell a fund for a loss (to tax-loss harvest it) you may not re-buy a substantially identical fund for 30 days.

Turns out banks actually care about that. Here’s an experience I had where I was stung by it. 

A Wash Sale Story

A few years ago I did something very similar to the above example. I sold some stock in $VEMAX (Emerging markets) and reinvested those gains into $VTIAX (Total International Market). These seemed OK to me from my research. These funds are not “substantially identical”, or so I thought.

I went about the rest of my year thinking I was fine. Around the end of January, I received my tax paperwork from Vanguard. They classified 30% of my sale as a wash sale.

In Vanguards eyes, $VEMAX and $VTIAX are 30% similar. Up until that point I thought it was an all or nothing situation. Turns out you can have a partial wash sale too.

On your taxes, you’ll want to find your 1099-B. This is the document that lists out all of your capital gains for the year.

1099-B example
A look at my 1099-B with a wash sale

Reading this isn’t easy. What does stand out is that I sold some $VEMAX and later on there was a wash sale on part of the amount. In this case it’s not too much – just $42 of the total amount sold – or about 2% of the total losses were classified as a wash sale.

It’s not always easy to identify what caused a wash sale. Sometimes it’s more obvious than others. In this case, I had to track down WHY a wash sale happened. To start, I looked over what I had bought on Vanguard in the month following this.

Wash sale window
A look at my purchases in the month following the transaction marked as a wash sale.

Looking at this I can see I bought $VTIAX 31 days later, which avoided the wash sale (go me! I was on top of things that month!). All of the other purchases that month look very different too – none of them seem to have caused the wash sale. So what did?

That’s when I realized what it must be – reinvestment of dividends. Whenever you receive a dividend from a fund, you have 3 options – keep the dividends as cash, reinvest them in the same fund, or reinvest them in a different fund. Did I have a dividend that was reinvesting a substantially identical fund?

Wash sale culprits
Dividends were reinvesting in a substantially identical fund

Eek, yeah this is it. Turns out I didn’t sell all shares of my $VEMAX. What was left still provided a dividend. I also had a dividend in another very similar stock – $VTIAX

Here’s my take on what happened. I sold ~$15,000 of $VEMAX at a loss with a cost basis of $17,561. That means that about 15% of my transaction was a loss. Later on, I purchased $247 of $VEMAX max. $37 of that (15%) was marked as a wash sale. I’m guessing the other $8 is because part of the $VTIAX transaction was also classified as a wash sale.

Sadly the exact details remain a mystery to me. The similarity of funds is constantly changing, and Vanguard offers no tool to easily compare to see. There is one good takeaway here though:

If you’re tax-loss harvesting, don’t reinvest dividends in funds you shouldn’t be buying!

I know I’ll remember that one for next time.

What if you bought shares at a different brokerage?

If I had bought them at a different brokerage, there would have been no automatic flag as a wash sale. There could still have been an wash sale though, if the funds I bought tracked the same index.

For example, if you sell an S&P 500 fund at Vanguard, then buy an S&P 500 fund at Fidelity – you’re still on the hook for those taxes. The only difference is that you’re now responsible for pointing it out to the IRS (don’t worry, they’ll point it out to you if you don’t).

Wait, So You Can’t Do This If Your Stocks Are Up?

Exactly! I’ve been investing for a decade now and every fund in my Vanguard portfolio is positive. That means that there is no option for me to ever do this again (unless stocks drop significantly or I tax-gain harvest, reinvest and the funds go down – but that’s another story).

If you’ve been investing for a while and all of your funds are in the green, you’ll have very few options to tax-loss harvest. Sorry, but hey at least your investments are all up!

Tax-Loss Harvesting with Robo-advisors

One of the parts that Betterment and Wealthfront touches on many times in the marketing is their tax-loss harvesting capabilities. Are these all their cracked up to be?

The short answer is that it’s extremely hard to know. Most people don’t put money into them and let them sit around for a while to see how they compare… but I have! I put $10k in a Betterment and Wealthfront account on January 1, 2018. 

Both of these accounts have had “tax-loss harvesting” kick in many times. Betterment is much more chatty about it and emails me every time it happens.

Brokerage Initial Deposit Current Value
(November 16, 2018)
Tax-Loss Harvested # of TLAs
Betterment $10,000 $9,620.55 $552.65 9
Wealthfront $10,000 $9,501.79 $738.77 19

It’d been crazy how similar these two have matched each other’s performance. It’s also important to remember that 2018 was an ideal year for tax-loss harvesting. The markets have fluctuated up and down (tending down) which has meant many more occasions to tax loss harvest.

Betterment has done about $100 better in value, but Wealthfront has tax-loss harvested almost an extra $200. The combined $1,300 in harvested from these robo advisors will save me roughly $300 in taxes this year (at a 24% tax rate), or as I’d like to call it one Nintendo Switch.

Betterment Tax Loss Harvesting

Betterment’s tax-loss harvesting looks something like this:

Betterment tax loss harvesting
Selling IEMG and buying VWO.

Betterment sold some shares of Vanguard Emerging Markets Stock Index Fd and immediately bought ISHARES INC/CORE MSCI EMERGING Markets. My portfolio stayed about the same, but because they funds track different indexes it’s not a wash sale. 

VWO (ETF) tracks the same index as $VEMAX (Mutual fund). That means that if I had this mutual fund in my separate Vanguard account that I could be hit with a wash sale if I were to buy it in there. Luckily I don’t hold any $VEMAX in my brokerage anymore, so it’s not a concern.

Remember, wash sales are across all of your different accounts – not just per account. If Betterment had sold something I had bought manually in my other account (or something that tracks the same industry) that would have triggered a wash sale

Wealthfront tax-loss harvesting

Wealthfront was able to tax loss harvest about $100 more in 2018. This is surprising to me because Wealthfront only trades in full-shares (not partial shares like Betterment) but also because they invest in a smaller number of funds.

The larger the number of funds you’re invested in, the more opportunities you should have for tax-loss harvesting.

Weathfront tax loss harvesting
Wealthfront tax loss harvesting of the same VWO two months earlier.

Luckily these accounts knew of each other and didn’t sell shares that the other was in. From the look of the accounts and dates there haven’t been overlaps where a wash sale might occur. I guess I’ll know for sure when I do my taxes this year.

Once you have $100,000 invested at Wealthfront, they’ll also start doing something called “Stock-Level Tax Loss Harvesting”. Rather than investing only in a handful of ETFS, Wealthfront invests in the underlying funds – Apple, Amazon, AT&T (and other companies that don’t begin with A). 

This means that when Apple is down, but AT&T is up, Wealthfront can sell some of both, then put the money into a similar fund (maybe other tech & communications funds). I haven’t tried this service from Wealthfront since I don’t meet the $100k minimum for it, but I do have to say I’ve been impressed by their service so far.

Betterment or Wealthfront for Tax Loss Harvesting?

I only have 1 year worth of data on this, but if I was going got Tax-loss harvesting I would choose Wealthfront. They have harvested 25% more losses in the same period. They also offer a higher tier that could increase their TLAs even more. 

This has a big caveat by it though: I haven’t done my taxes for 2018 yet. Once I do those I’ll update this post if things change and I end up owing more money on one than the other.

Is Tax-Loss Harvesting Worth It?

That’s the big question. A lot of this depends on how you’ll pay your taxes. The reason for tax-loss harvesting now is to defer taxes. That is the most important part of tax-loss harvesting today. Instead of paying that $1,000 (for example) in taxes today, you put that $1,000 back into the market and watch it grow. After 30 years that might have grown to more than $15,000!

For us, we can’t tax-loss harvest anymore, since all of our funds are up. We could sell them (and pay taxes on those gains) or put new money into new funds hoping that they’ll go down, but that doesn’t help.

Instead, we’re aiming to pay nearly $0 in taxes when we start taking our money out due to being in a lower tax bracket. This strategy bypasses some of the reason for tax-loss harvesting (lowering your cost basis). Instead, we’ll focus on tax-gain harvesting after retirement. If you’re curious about this side of the equation, check out that post.

Have you used tax loss harvesting? Have you been hit with a wash sale? Would you recommend tax loss harvesting for someone else?


Hi, I'm Adam! I help millennials invest to reach financial independence sooner than they ever thought possible. Want to see what you could do to reach FI sooner? You're in the right place!


Why not add to the conversation below? Your voice is welcome!

From what I understand, Betterment can’t look at your external portfolio in order to avoid wash sales. They recommend you invest everything with them to avoid wash sales. I’m guessing the same goes for Wealthfront.

Just checked on this and you’re right! I was sure I saw that somewhere in their docs, but checking both sites now I don’t see anything about it. I’m updating the post to make sure it mentions that approach. Thanks!

Really interesting post. I use Wealthfront for a portion of my portfolio so some of this is stuff I’ll look out for. I have liked Wealthfront’s full-share purchasing because I also track manually (at your suggestion) and it’s so much easier. I used a couple of different services that purchased in partial shares and it’s super annoying. I am in the process of closing most of these now and transitioning to a simpler portfolio now that I’m more educated.

Thanks for the great information and tools you make!

P.S. tiny typo in this sentence “A lot of this depends on you’ll pay your taxes”. Is it missing “how”?

Aww, thanks! And thanks for the typo – fixed.

I’m curious about what the downsides were to the partial-share purchasing – other than the difficulty of tracking it? I have a feeling one is potentially that there are many more transactions, which makes trying to determine tax-liability extremely difficult in an after-tax account. Any others that have been annoying with that setup?

The other frustration I experienced with these services is that they purchased a much larger array of funds than Wealthfront in the name of diversification. My Wealthfront portfolio has about 5-6 different funds while the other one had at least 12. The fees weren’t as terrible as some that I’ve seen but they were noticeably higher than Vanguard Index funds and the funds chosen by Wealthfront.

Diversification is clearly important but I didn’t see a good reason to stay in funds that had these higher fees. As I started educating myself I really wanted to know why the funds in my portfolio were chosen, and I didn’t get great justification from the roboadvisor. I noticed that there were 3 different funds in the Large Cap category, 3 in the Foreign Large Cap, and it got worse from there. I didn’t understand why there were so many different holdings. I’d like to research these funds in the future when I have the time and then do the purchasing and allocation myself if I decide they worthwhile.

That sounds exactly the same as my experience with Roboadvisors! I opened a Wealthfront and a Betterment account and the Betterment one used a BUNCH more funds. Their approach to diversification may payoff during some years, but it seems needlessly complicated to achieve roughly equivalent returns.

The biggest advantage of a roboadvisor to me would be if they somehow are able to maintain a tax-neutral portfolio over time while matching a diversified portfolio of stocks and bonds. I’ve yet to see that happen myself just yet though.

Minafi - The intersection of FI, minimalism & mindfulness.

Don't miss out on new posts, courses, interactive articles and more!

Join & Get Your First Course Free

© 2024   Adam Fortuna

Site Map
Triangle Graduation Cap Angle Down Book regular Phone laptop regular fire regular fire regular search regular Acorn duotone Seedling duotone