Tax loss harvesting

Tax loss harvesting takes advantage of the fact that the IRS allows you to deduct up to $3,000 a year of net capital losses against ordinary income (offset first against any realized capital gains) by temporarily selling holdings to book the losses, then either repurchasing the funds after 31 days, or immediately purchasing similar funds. Net losses greater than $3,000 can be carried over to subsequent years to offset first, any realized capital gains, and then offset ordinary income. (The deduction is limited to $1,500 if you are married filing separately.)

This technique is generally used to improve the after-tax return of your taxable investments by taking losses and then investing savings from the reduced tax liability.

How it works
Tax loss harvesting works in several different ways.

Investing a single sum
January 2008: You invest $10,000 in Total Stock Market.

February 2008: The balance drops to $9,000. You sell it.

March 2008: You put $9,000 back into Total Stock Market. (Suppose that the share price is the same as in February, 2008 for simplicity.)

February 2009: You do your 2008 tax return. Since you have lost $1,000, you can reduce your ordinary income by $1,000, assuming you don't have any capital gains. If you are in the 25% bracket for example, you reduce your tax liability by $250. So, you invest the saving, $250, in Total Stock Market.

Suppose Total Stock Market keeps growing 8% year for 10 years after February, 2008.

January 2018: $10,000, which dropped to $9,000 in 2008, becomes $19,430.32 (= $9,000 * 1.08^10). $250 becomes $499.75 (= 250 * 1.08^9). Both of these combined, you have $19,930.07. You sell all shares and pay 15% tax on long-term capital gains. You end up with:

$9,000+($19,430.32-$9,000)*85%+$250+($499.75-$250)*85% = $18,328.05

What if you didn't sell Total Stock Market in February, 2008? Note that you don't get $250 back in your 2008 tax return in 2009, so you end up with:

$10,000+($19,430.32-$10,000)*85% = $18,015.77

Notice the $312.29 difference. This is what you get by investing $250 doing a tax loss harvesting. Obviously, the longer you hold shares you purchased with the $250 refund, the more benefit you get.

In this example, you get both interest-free loan and free money from the IRS. You deducted the $1,000 loss at the 25% rate. When you sold the shares, you had $1,000 more capital gains on the $9,000 investment compared to the case without tax loss harvesting. However, you paid 15% on the capital gains. So, 15% of $1,000, which is $150, is an interest-free loan, and 10% (= 25% - 15%) of $1,000, which is $100, is free money from the IRS.

In reality, things are a bit more complicated. In the above example, we completely ignored dividends from Total Stock Market. Also, the share price may change between February 2008 and March 2008.

Using a loss from one tax lot to offset the capital gains from another
Suppose the following:

January 2008: You invest $1,000,000 in Total Stock Market.

February 2008: You do tax loss harvesting after losing $100,000.

January 2010: You invest additional $50,000 in Total Stock Market.

January 2011: You retire. You sell the shares purchased in January 2010, which has grown to $60,000.

In 2011, you have not used up the loss realized in February 2008 as you can only deduct $3,000/year, so you can use a part of the remaining loss to offset the capital gain realized in January 2011.

If $60,000 is enough for your living expenses, you may have little or no taxable income because the gain is offset by the realized loss carryforward, and the return of capital, $50,000, is tax free. If this is the case, you might consider Post-Retirement Roth Conversion to take advantage of the standard/itemized deduction and low tax brackets.

Donating low basis shares to a charity
Suppose the following:

January 2008: You invest $10,000 in Total Stock Market.

February 2008: You do tax loss harvesting after losing $1,000.

March 2008: You reinvest $9,000 in Total Stock Market.

January 2009 and on: You make many purchases of shares of Total Stock Market.

January 2020: You donate the shares purchased in March 2008 to a charity.

If you donate the shares purchased in March 2008 to a charity, you do not have to pay tax on the capital gains. That is, you fully pocket the tax savings in 2008 and never "pay back" the savings to the IRS. See Donating Appreciated Securities for more details.

Stepped up cost basis upon death
Suppose the following:

January 2008: You invest $10,000 in Total Stock Market.

February 2008: You do tax loss harvesting after losing $1,000.

March 2008: You reinvest $9,000 in Total Stock Market.

January 2009 and on: You make many purchases of shares of Total Stock Market.

January 2020: You retire and start withdrawing from your taxable account, highest cost basis first.

Chances are you do not sell shares purchased in your life time, in which case, the shares purchased in March 2008 receive stepped up cost basis upon your death. That is, you fully pocket the tax savings in 2008 and never "pay back" the savings to the IRS.

What if the tax rates go up in the future?
Some people speculate that the tax rates may go up in the future. Tax loss harvesting still works as long as the increase is reasonable. Specifically, you benefit from tax loss harvesting as long as the tax you pay on the $1,000 extra capital gains ($10,000 - $9,000) in the first example above is less than the after-tax amount that $250 grows to. Suppose the long-term capital gain tax rate goes up to 30%. Then you would pay $300 on the $1,000 extra capital gains. However, $250 grows to $499.75 with the after-tax amount being $424.83, so you are not losing money yet.

Regulatory

 * Wash sale. If you sell Total Stock Market with losses and buy back the same fund within 30 days before or after the sale, that would be called a wash sale, and you cannot claim the losses on your 2008 tax return.  The definition of a wash sale is a bit more complicated than that.  Before you do tax loss harvesting, be sure to familiarize yourself with the wash sale rule.
 * Qualified dividends. If you hold shares less than 61 days and receive qualified dividends from those shares, they are not qualified dividends even though the fund company may claim to be qualified dividends. See Mutual Fund Ordinary Dividends for more details.  Disqualification of qualified dividends may outweigh the benefit of tax loss harvesting in some cases.
 * Short-term capital loss due to tax-exempt interest. If you have short-term capital loss due to tax-exempt interest from a mutual fund held less than 6 months or less, you cannot claim the loss.  You can still claim a part of the loss due to market movements, such a rising interest rate.  See Publication 564 (2007), Mutual Fund Distributions and Short-Term Capital Losses for more details.

Operational

 * Reinvestment of dividends and capital gains. If you automatically reinvest dividends and capital gains, you may accidentally trigger a wash sale.  If you plan to do tax loss harvesting, it's generally safer to take dividends and capital gain distributions in cash.
 * Cost basis accounting. Use Specific Identification of Shares instead of average cost basis to sell shares with losses.
 * Put volatile investments in your taxable account. For example, an international fund has larger ups and downs because of political and currency risks.  This makes it more likely for you to be able to do tax loss harvesting.
 * Commissions and bid-ask spreads. If you are doing tax loss harvesting on ETFs and/or individual stocks, you may have to pay commissions and bid-ask spreads, and they reduce the amount of money you get from tax loss harvesting.  For this reason, you may want to compare the amount of tax you save and the trading costs and do tax loss harvesting only when the trading costs are minimal compared to the savings in the current tax liability.
 * Mutual funds. You don't have a problem with commissions or bid-ask spreads.  However, some mutual funds have redemptions fees for a certain period after the purchase.   Vanguard's Tax-Managed funds are prime examples of the redemption fees.  Another problem is that you could try to realize a small loss in a mutual fund position, but the loss may disappear by the time the redemption is processed.  For this reason, you may want to do tax loss harvesting on a sizable loss that's unlikely to disappear in one day.
 * Frequent-trading restrictions. Vanguard does not allow you to sell most funds and buy back into the same fund electronically within 60 days.  If you plan to buy the fund back in 31 days, one of the two transactions must be done by mail.
 * Volatility of investment. In the real world, a tax loss harvester waiting  31 days to reinvest will see volatility in the investment. If the price of the investment goes up while the investor is on the sidelines she is disadvantaged; if the price goes down, she is advantaged. One might expect that over a long period of tax harvesting these volatility effects might wash out (if random) or perhaps, if there is a short term momentum effect, a slight advantage to the loss harvester over the long haul. This volatility of reinvestment risk can be mitigated if one immediately purchases a similar, but not substantially identical investment, but this comes with a higher degree of complexity especially if one is swapping fractional lots of the original fund.