StrategyTax StrategyInvesting & Portfolio17 min readPublished June 3, 2026

How to Sell Stocks, Mutual Funds, and ETFs Tax-Efficiently: SpecID and Tax Lots

Your broker's default cost-basis method silently picks your taxable gain. Learn SpecID, FIFO vs HIFO vs average cost vs MinTax, and how lot selection cuts the tax when you sell or rebalance.

How to Sell Stocks, Mutual Funds, and ETFs Tax-Efficiently: SpecID and Tax Lots

When you sell from a taxable account, your brokerage’s default cost-basis method quietly decides how much gain you realize and how much tax you owe. Tax-efficient selling is about controlling that decision: which lots you sell, what kind of gain you create, and how much you realize, while keeping the portfolio aligned with your plan. Specific identification, usually called SpecID, is the simple, high-leverage setting that puts that choice back in your hands. This is educational, not tax advice.

Cost basis and tax lots

Every purchase creates a tax lot: a batch of shares with its own cost basis and purchase date. Reinvested dividends, repeated buys, dollar-cost averaging, and vested RSU or ESPP shares all create separate lots, often at very different prices. When you sell, the taxable gain on a lot is the sale proceeds minus that lot’s basis. Lots held more than a year get long-term capital gains rates of 0%, 15%, or 20% depending on income; lots held a year or less are short-term and taxed as ordinary income.1 Because lots differ in both basis and holding period, which lots you sell changes the tax.

What SpecID is, and how to use it

Specific identification lets you tell the broker exactly which lots to sell. The IRS requires you to adequately identify the shares: when the broker holds them, you generally specify the particular lots at the time of sale and receive a written confirmation within a reasonable time. If you do not identify the shares, the IRS treats the oldest as sold first (FIFO), except that mutual funds may use average basis.2 Two practical notes: set your account’s default away from plain FIFO, choose lots before or at the trade, and keep the confirmation. And once you use average basis for a mutual fund, switching back to lot-level control is restricted, so do not lock into it casually.

FIFO vs. average cost vs. HIFO vs. MinTax

MethodWhat it doesWatch out for
FIFOSells oldest shares firstIn a long-held, rising position, the oldest lots often have the lowest basis and biggest gains
Average costBlends basis, common for mutual fundsGives up lot-level control and is sticky once used
HIFOSells highest-basis shares firstMay realize a short-term gain unless the broker's version checks holding period
SpecIDYou pick the exact lotsRequires attention and records
MinTax / tax-optimizerBroker orders to minimize tax: losses first, then long-term gains, short-term gains lastStill worth reviewing for large trades

For most DIY investors, a broker’s tax-optimizer is a better default than plain FIFO or plain HIFO because it accounts for holding period. Vanguard offers specific identification and defaults to average cost for funds and FIFO for stocks; Schwab’s Tax Lot Optimizer sells losses first and gains last; Fidelity’s Tax-Sensitive method prioritizes short-term losses, then long-term losses, then lower-tax gains.3 For large trades, concentrated stock, charitable gifts, or harvesting, review the specific lots yourself.

The economics: reduction vs. deferral vs. elimination

Selling a higher-basis lot creates a smaller gain, so the tax saved is roughly the basis difference times your rate. High earners may also owe the 3.8% Net Investment Income Tax, which raises the value of trimming a gain.4 The subtlety is that this is usually deferral, not permanent avoidance: selling high-basis lots now leaves the low-basis lots behind for later. The classic tax-aware result is that because gains are taxed only on realization, investors gain by realizing losses sooner and deferring gains while keeping their market exposure.5 Deferral turns into real savings when the gain is later realized in a low-income year, offset by future losses, donated, or eliminated by the step-up in basis at death.

How much can lot selection save?

On a single sale the benefit is mechanical and can be large: the wider the basis spread between lots, the bigger the difference. Over a lifetime it is meaningful but not magical. Atra and Pae found that HIFO accounting added roughly 0.5% to about 1% of terminal wealth in realistic liquidation scenarios, and normally not more than about 2%.6 Earlier work by Berkin and Ye concluded that investors should harvest losses and use HIFO when selling.7 Tax-loss harvesting can add more: Chaudhuri, Burnham, and Lo estimated about 1.10% per year of tax alpha under their assumptions,8 but Khang, Paradise, and Dickson showed that figure assumes plentiful offsetting gains, and real investors with smaller or irregular gains get much less; investor circumstances drove most of the variation.9 The takeaway: lot selection is a low-cost efficiency upgrade, not an investment strategy by itself.

Compare the methods on your own sale

The calculator lets you enter your lots and a sale, then compares the tax under FIFO, average cost, HIFO, and a MinTax ordering, shows the tax saved versus FIFO, the long-versus-short split, and the embedded gain you leave behind.

Tax-loss harvesting and wash sales

Lot selection pairs naturally with harvesting losses to offset gains. The constraint is the wash-sale rule: if you sell at a loss and buy a substantially identical security within 30 days before or after, the loss is disallowed and added to the basis of the replacement shares.2 Harvest only when you can keep market exposure without tripping that rule. The full mechanics are in tax-loss harvesting.

Rebalancing without unnecessary tax

Rebalancing means selling what is overweight, which in a taxable account can trigger gains. A defensible order of operations:

  1. Rebalance with new contributions first.
  2. Redirect dividends and interest to underweight assets.
  3. Rebalance inside tax-advantaged accounts, where trades are tax-free.
  4. Harvest losses in taxable if available.
  5. If you must sell in taxable, use SpecID or MinTax to choose lots.
  6. Donate the most-appreciated long-term shares if you already give.
  7. Sell appreciated lots only when the diversification benefit justifies the tax.

Capital gains taxes are a real friction in rebalancing, and the incentive to re-diversify falls as embedded gains and age rise, but taxes should not freeze a portfolio into a risk level that no longer fits.10 Risk control comes first; lot selection just lowers the toll. See how often to rebalance and concentration risk.

Stocks vs. ETFs vs. mutual funds

SpecID works the same for individual stocks and ETF shares in a taxable account, and stock and ETF lots often have wide basis dispersion that makes it valuable. ETFs add a structural advantage: in-kind creation and redemption let them shed low-basis shares without distributing gains. Moussawi, Shen, and Velthuis estimate that ETF tax efficiency raised long-term investors’ after-tax returns by about 1.05% per year relative to comparable mutual funds in recent years.11 Mutual funds add a second tax issue: capital-gains distributions while you hold, taxable even if reinvested. Broad, low-turnover index ETFs pair well with SpecID because they reduce surprise distributions and preserve lot flexibility. See do you need direct indexing and the bespoke-ETF tax-lock-in guide.

Who this matters for, and who it does not

Lot selection matters most for investors with taxable brokerage accounts, repeated purchases over time, RSU or ESPP shares, large embedded gains, charitable giving plans, or retirement drawdowns ahead. For charitable givers it is especially powerful: long-term appreciated property is generally deductible at fair market value and avoids the gain entirely, so you donate the lowest-basis long-term lots and keep or sell the higher-basis ones.12 See donate stock or use a DAF.

It matters little for investors who hold only in IRAs, 401(k)s, or HSAs (no taxable gain on sales there), those with tiny taxable accounts or a single lot, investors deliberately harvesting gains in the 0% bracket, or anyone whose records are too messy to identify lots reliably. And if your real problem is a dangerously concentrated position, reducing risk can be worth paying the tax.

See the tax cost before you sell

Use Summitward's tax tools to estimate the gain and tax on a position before you place the trade, then choose lots intentionally.

Open tax tools

A checklist before you place the sell order

  • Is this sale better funded by contributions or a tax-advantaged account instead?
  • Have you set the account default to a tax-optimizer rather than FIFO?
  • For a large sale, did you review the actual lots by basis and holding period?
  • Can you pair the sale with a harvested loss, and does any purchase risk a wash sale?
  • Would donating the lowest-basis long-term lots beat selling them?
  • Is realizing the gain actually fine this year (a low-income or 0%-bracket year)?
  • Did you save the broker confirmation of the lots sold?

Frequently asked questions

What is SpecID and why does it matter?

Specific identification lets you choose exactly which tax lots you sell, which sets the basis and holding period of the sale. It matters because the default method, usually FIFO, often sells your oldest, lowest-basis shares and realizes the largest gain.

Is HIFO always best?

Not always. HIFO sells the highest-basis shares, which usually minimizes the current gain, but a plain HIFO can realize a short-term gain that is taxed at higher ordinary rates. A MinTax or tax-sensitive method that also considers holding period is usually a better default.

Does choosing lots actually save money, or just delay tax?

Often it defers rather than eliminates, because the low-basis lots you skip remain to be taxed later. Deferral still has value, and it becomes permanent savings if the remaining gain is realized in a low-income year, offset by losses, donated, or stepped up at death.

Should I use average cost for my index funds?

Average cost is simpler but gives up lot-level control and is hard to reverse once used. If you might want to harvest losses or choose lots later, specific identification preserves more flexibility.

Key takeaways

  • The default method picks your gain. SpecID lets you choose the lots instead of accepting FIFO.
  • A tax-optimizer beats plain FIFO or HIFO. It considers holding period, selling losses first and short-term gains last.
  • Mostly deferral, not avoidance. Real savings come when the remaining gain is realized cheaply, donated, offset, or stepped up.
  • Modest but free. HIFO adds roughly 0.5% to 1% of lifetime wealth; harvesting can add more but is highly investor-specific.
  • Risk control first. Use lot selection to lower the toll on rebalancing, not to justify holding a fragile allocation.

Related guides

Sources

  1. Internal Revenue Service. Topic No. 409, Capital Gains and Losses. Long-term rates of 0%, 15%, 20%; short-term taxed as ordinary income.
  2. Internal Revenue Service. Publication 550, Investment Income and Expenses. Adequate identification of shares (SpecID), FIFO default, average basis for mutual fund shares, and the wash-sale rule.
  3. Cost-basis method documentation: Vanguard, Schwab Tax Lot Optimizer, and Fidelity Tax-Sensitive.
  4. Internal Revenue Service. Questions and Answers on the Net Investment Income Tax. 3.8% on net investment income above MAGI thresholds.
  5. Constantinides, George M. “Capital Market Equilibrium with Personal Tax,” Econometrica (1983). Realize losses early, defer gains.
  6. Atra, Robert J. and Peter Pae. “Likely Benefits from HIFO Accounting,” Journal of Financial Planning (2014). HIFO added ~0.5%-1% of terminal wealth, normally not more than ~2%.
  7. Berkin, Andrew L. and Jia Ye. “Tax Management, Loss Harvesting, and HIFO Accounting,” Financial Analysts Journal (2003).
  8. Chaudhuri, Burnham, and Lo. “An Empirical Evaluation of Tax-Loss-Harvesting Alpha,” Financial Analysts Journal (2020). ~1.10%/yr tax alpha under their assumptions.
  9. Khang, Paradise, and Dickson. “Tax-Loss Harvesting: An Individual Investor’s Perspective,” Financial Analysts Journal (2021). Benefit depends heavily on investor-specific offsetting gains.
  10. Dammon, Spatt, and Zhang, via the TIAA Institute. Capital Gains Taxes and Portfolio Rebalancing. Taxes are a major rebalancing friction that rises with embedded gains and age.
  11. Moussawi, Shen, and Velthuis. “The Role of Taxes in the Rise of ETFs,” Review of Financial Studies. ETF tax efficiency worth roughly 1.05%/yr after-tax for long-term investors.
  12. Internal Revenue Service. Publication 526, Charitable Contributions. Long-term appreciated capital-gain property generally deductible at fair market value.

More in Tax Strategy

Browse all tax strategy guides
Share

Get new guides by email

Evidence-based, no jargon. At most two emails a month. Unsubscribe any time.

Try it in Summitward

See tax-loss harvesting calculator in action with your own financial data. Free to start, no credit card required.

Disclaimer: This tool is for educational and informational purposes only and does not constitute financial, tax, or investment advice. Consult a qualified professional before making financial decisions. Past performance does not guarantee future results.