Say you’ve used a taxable brokerage account to buy shares in a particular stock in installments at various prices. The Senate GOP tax reform bill has potentially bad news for you — if you’re considering unloading part of your stake in the relatively near future to raise cash or invest in something else. If the price of the shares stair-stepped higher as you bought them, I’m guessing you would rather pay a smaller tax bill than a larger one when you sell some of those shares. Here’s what you need to know to dodge a possible tax reform bullet by selling shares before year-end instead of waiting until next year.

Stock basis rules may be changed — and not in a good way

Starting next year, the Senate bill would force you to use the first-in, first-out (FIFO) method to calculate the tax basis of shares that you sell. If the price of the shares stair-stepped higher as you bought them, having to use the FIFO method means that your taxable gain would be figured by treating the oldest and cheapest shares as being sold first. That would maximize your gain but also maximize the resulting tax hit.

In contrast, the current tax rules that will remain in effect for the rest of this year allow you to use the tax-saving specific ID method to choose the particular batch of shares that you are deemed to sell from. So you can treat the most expensive shares as being sold first, which will minimize your taxable gain. You are treated as still holding the older, cheaper shares in your portfolio. At some point, there will be a tax day of reckoning when you sell those shares, but the tax planning strategy is to postpone that day for as long as possible. The specific ID method allows you to do that.

Example: Say you bought 100 shares of Amazon for $100 a share back in 2012. Then you bought another 100 shares for $500 a share in 2015. Ever optimistic, you went back to the well for 100 more shares in 2016 at $800 a pop. As this was written, Amazon AMZN, -4.12% was trading for a whopping $1,162 a share. Now, you find that you need to raise $100,000 in cash pretty soon, which you could net (and a little bit more) by selling 87 shares at the current price.

If you sell 87 shares right now at $1,162, the sales proceeds would be $101,094 (ignoring any sales commission). If you treat those 87 shares as coming from the batch you bought in 2016 for $800 a share, your taxable gain is a relatively manageable $31,494 (sales proceeds of $101,094 – $69,600 stock basis at $800 per share). The maximum federal income tax hit on that gain would be $7,496 ($31,494 gain x 23.8% tax rate, based on the 20% maximum capital-gains rate plus another 3.8% for the net investment income tax). Depending on where you live, you might owe state income tax too.

But if you sell for the same price early next year and are forced to use the FIFO method to calculate the basis of the shares you sell, your taxable gain will be a much-less-manageable $92,394 ($101,094 – $8,700 stock basis at $100 per share). The maximum federal income tax hit on that gain could be $21,990 ($92,394 gain x 23.8% tax rate, based on the 20% maximum capital-gains tax rate plus the 3.8% net investment income tax). Ouch! You may owe state income tax too.

So would you rather pay $7,496 to the Feds this year or $21,990 next year? If you want to lock in the lower tax bill, make your sale before year-end. Of course, it could turn out that the mandatory FIFO rule isn’t included in any upcoming tax reform legislation. You can wait until the last minute to find out and then pull the trigger before year-end if necessary. Just be poised to act quickly.

How to use the specific ID method

If you want to use the specific ID method for a sale before year-end, what do you have to do? Good question. This isn’t something that you can arrange at tax return time. You have to be proactive at the time of the sale. Here’s the drill.

If you place your sell order by phone, tell your broker from which batch of shares you wish to sell (“from the block of shares I bought in 2012 for $100 each,” for example).

If you’re making an online transaction, ask your brokerage firm what you need to do. At Schwab, for example, you can see the cost basis of your share batches on the order entry screen. If you choose the Specified Lots method, you can pick the batch (or batches) of shares from which you wish to sell.

Your brokerage firm should then issue you a confirmation (email is OK for this) that shows from which batch of shares you sold. Keep that confirmation with your tax records, because it proves that you were allowed to use and did use the specific ID method.

What about mutual fund shares?

Under current tax law, you can also use the specific ID method to identify from which batch mutual funds shares are sold. The Senate tax reform bill would leave the specific ID method in place for mutual fund shares. So you need not sell mutual fund shares before year-end just to take advantage of the specific ID method.

When does none of this matter?

If you are selling shares held in an IRA or qualified retirement plan account, the ability to use the specific ID method (or not) is irrelevant. Gains and losses from shares held in these accounts affect your account balance, but they don’t trigger any current tax liability. You won’t owe any taxes until you take withdrawals.

The bottom line

You now understand the potentially negative impact of tax reform legislation that would make the FIFO method mandatory for determining the tax basis of stock that is sold in taxable brokerage firm accounts. So you might want to be poised to sell shares before year-end to avoid this problem if it becomes reality. Meanwhile, please stay tuned for the latest news on tax reform developments.