Minimizing Tax Burden Through Specific Share Identification

There is an opportunity for reducing tax burden in taxable investment accounts when you are ready to start selling shares. The goal of this post is to share a method for minimizing the tax burden associated with selling shares in a taxable account. In this exploration, I am going to focus on long term holdings (shares you have owned for longer than 1 year, subject to long term capital gains) that you sell using SSI (Specific Share Identification) not considering other sources of income.

Understanding the Environment

When you have purchased a share in a company or mutual fund, and the price of that share rises you become subject to capital gains tax on the profit, should you decide to sell the share. The IRS establishes guidelines about how you may calculate profit for your investment, this is called cost basis. There is opportunity to minimize your tax burden by calculating the cost basis of your investment using a method called Specific Share Identification.

If you sell shares of a stockbondexchange-traded fund (ETF), or mutual fund in a taxable account, you pay a capital-gains tax on the difference between the basis (what you paid, with adjustments) and the sales price (what you sold it for). These transactions are reported in IRS Form 8949: basis is reported in Column (f), Cost or other basissales price is reported in Column (e), Sales price.
You must choose an accounting method for each fund you hold in order to determine the basis. IRS Publication 550[1] describes the three allowed methods for mutual funds. The methods are of one of two types: cost basis methods and average basis methods. In a cost basis method, every share has its own basis, and the accounting method determines which share you sell. In an average basis method, the basis of a group of shares is averaged over all the shares.

Taken from

The Cost Basis Methods

First In First Out (FIFO)

Using this method, the first share you sell is the first share you bought. The second share you sell is the second share you bought. This method is very simple, but may lead to a very large tax burden when you start selling. You are very likely to have the highest profits on the first shares you bought, as shares tend to rise in value (you hope).

Average Basis

In this method, all of your shares in a mutual fund have the same basis, which is the average cost (or other basis) of all shares at the time they were purchased (adjusted for previous sales followed by subsequent purchases). Shares are still sold in the order purchased. In the example above, you paid $18,000 for 400 shares, so your average basis is $45 a share; when you sell 100 shares at $60, your basis is $4500, your sales price is $6000, and the capital gain is $1,500. It is a long-term gain since you sold the shares you bought ten years ago.
Once you have averaged shares, they remain averaged for future transactions. In the example above, your basis is $45 in all 300 remaining shares; if you change to specific identification in the future, you cannot sell shares with a $30 or $60 basis.

Taken from

Specific Share Identification

Using SSI, you decide specifically which shares you want to sell. Each share must be identifiable and you must keep track of the shares you have sold. This method has the most potential for reducing tax burden, but for the most work.

An Example Scenario

I’ll build up an example scenario to evaluate an optimization methodology for minimizing tax burden. Lets imagine you have invested in a mutual fund by buying a share every day for 600 days. You finished investing several years ago. The fund went gangbusters, has now flat-lined, and you want to sell it over the next four years: not work, take art classes, read, watch movies, attend local events, garden, travel, do yoga, volunteer, whatever.

The first 10 of 600 shares you bought:

The fund is now worth $600 a share. Lets assume for simplicity that it will remain at that price indefinitely. Below is a plot of the price paid over time, along with a line showing the current price.

I can calculate the potential profit from selling each share, and input that as a column along with the total value of each share. See the first 10 shares again:

Your projected yearly spending may look something like the following:
A baseline of $60k a year with a couple large expenses thrown in every other year.

You will have to sell shares to cover all of the costs totaling $320,000. Your taxable account is 600 shares worth $600 each, totaling: $360,000. This means that you most likely have the money to cover your expenses, however you have to remember that you will owe capital gains taxes on all profits. Lets sum up the situation:

  • Money you have: $360,000
    • 40% of which is profit ($143,126.64)
    • 60% of which is basis (216,873.36)
  • Expenses you need to cover: $320,000
    • Year 1: $60,000
    • Year 2: $120,000
    • Year 3: $60,000
    • Year 4: $80,000

Long term capital gains brackets as of 2019 are as follows:

For this analysis, I will use the single filing brackets. The primary goal is to spend as little money on taxes as possible while covering all required expenses. An important secondary goal is to minimize the risk of future tax burden by spending as much profit as possible now.

The Optimization Method

In order to start selecting shares to sell to cover expenses, we need to consider the fact that each share is made up of some basis and some profit. Since capital gains tax is only against profit, we can understand the potential tax burden of each share owned by evaluating the amount of the sell that is profit.

I have sorted the example dataset shares by descending profit:

Profit Plotted:

So you own some shares with almost $350 profit and some with less than $150. This is a good variety of profits to make specific share identification useful. Why? If all shares had the same profit, they all carry the same tax burden. There is no reason to sell one share over another. They are equal in the eyes of capital gains taxes. A wide variety of profits is better for specific share identification.

Selling Using Average Basis Method

Lets identify how much we stand to gain using SSI, over the method of Average Basis.

Average Basis averages the cost of each share, and the profits are calculated as the share price minus the average cost. Using this method, I can find exactly how much capital gains tax would be owed each year:

Current Share Price : $600

Average Cost is the sum of the prices paid for the shares divided by the total number of shares. $361.46

Average Profit is the Current Price – Average Cost : $238.54 (39.76% of each share sold is profit)

So for each share sold, we will be subject to capital gains tax on $238.54 of the $600 sale. Summing it up for each year:

YearShare Value Sold ($)Profit ($)Tax Owed ($)
202280,00031,808 0

Recall tax owed is calculated using the long term capital gains 2019 brackets above. There is potential to eliminate up to $1,250.55 in taxes using SSI over average basis.

Selling Using Specific Share Identification

To meet the goals (restated here):

  • Spend as little money on taxes as possible while covering all required expenses.
  • Minimize the risk of future tax burden by selling fund shares with most profit now.

I will need to select shares to sell for each year in order to keep profits below the 15% capital gains bracket, while ensuring I sell enough shares to cover my expenses for the year. One way to accomplish this is the following procedure:

Sell the most profitable shares until either of the following conditions is met:

  1. The sum of the sales reaches projected spending for that year.
  2. The sum of sale profit reaches an unacceptable tax level.

If condition 1 is met, you have successfully minimized the risk of future tax burden (by selling highest profit shares) before an unacceptable tax burden has been reached.

If condition 2 is met, you need to begin swapping high profit shares for lower profit shares until you have enough money to cover the years expenses without undue tax burden. If you reach the end of the shares and cannot further reduce tax burden and still meet the projected spending – higher profit shares will have to be sold causing greater tax burden.

I have implemented this algorithm in python and passed the example dataset through said algorithm and checked the results.

Here are the results using SSI:

YearShare Value Sold ($)Profit ($)Tax Owed ($)

Using SSI allowed me to get rid of more profit while removing all tax burden. This is a huge step up from the Average Basis method. The key is to keep track of what shares should be sold in what year.

Below is a visualization of the share profit over share IDs colored by what year they were sold for.

To minimize taxes, the algorithm assigned low profit shares to year 2020. This ensured that basis was used (not profit) to cover the high spending that year. Highest profit shares were selected for 2019 to get rid of them first (minimizing future tax burden potential). Subsequent years followed similar selection criteria.

Lets look at what shares went unsold:

The purple unsold shares generally have low potential tax burden. This shows that SSI was able to meet the two goals:

  • Spend as little money on taxes as possible while covering all required expenses.
  • Minimize the risk of future tax burden by selling fund shares with most profit now.

Closing Thoughts

SSI can be massively beneficial in reducing tax burden over a retirement or anytime you are trying to sell from a taxable account. Some considerations:

  • Inaccuracy in projected spending can affect the results, the algorithm prioritizes minimizing current tax burden over future.
  • There is potential to improve the algorithm to higher tax brackets, or to weight current and future spending, however the variables and system requirements increase dramatically at that point.
  • SSI is easy for shares through a brokerage like Vanguard or Fidelity for shares purchased after 2012, handling SSI traceability before then can be a significant pain and you should be intimately familiar with the requirements before pursuing SSI.
  • You cannot mix Average Basis and SSI on the same funds. (This would provide the opportunity to sell high profit shares at average profits and low profit shares SSI, further minimizing the tax burden). See here page 45.
  • I have ignored ordinary income in this example, but ordinary income does need to be considered as an input before the taxes on long term capital gains can be evaluated. As of 2019, there is such a massive gap between the 15% and 20% brackets, that you are very unlikely to be able to take advantage of this optimization during your working years.

I’ll put the example dataset and algorithm into the woolsocks github at some point.

Leave a Reply

Your email address will not be published. Required fields are marked *