HIFO (highest-in, first-out) is a broker instruction or standing selection rule intended to identify the highest-cost shares for a sale. For ordinary stock, the U.S. tax result depends on adequate specific-share identification and timely broker confirmation; HIFO is not a separate statutory basis method. If shares are not adequately identified, FIFO generally applies. By assigning sales to higher‑cost lots, HIFO raises the cost basis for the shares sold and — all else equal — reduces the realized capital gain on that sale compared with many other methods Fidelity and Charles Schwab. This is a tax‑reporting convention: it changes which lot costs are used to compute gains or losses, not the cash you receive from the sale.
HIFO Cost Basis: Specific-Lot Rules, Examples & Limits
HIFO (highest‑in, first‑out) is a lot‑identification rule that matches shares you sell to the previously purchased lots with the highest per‑share cost first.
Practice trading with Finelo
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
Want to learn more?
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
Explore FineloExplore Finelo's 28-day challenges
Turn learning into a daily habit with guided challenge paths.
Educational note: This article is for educational purposes only and does not constitute financial, investment, legal, or tax advice. Finelo does not recommend any security, strategy, platform, or transaction. Investing involves risk, including possible loss of principal. Verify rules, fees, risks, and suitability with official sources or a qualified professional.
What HIFO Cost Basis Means
HIFO is a deterministic lot‑selection method applied when you hold multiple purchase lots of the same security. For a given sale, you match the shares sold to the lot(s) that have the highest per‑share purchase cost until the sale quantity is satisfied; those matched lot costs become the basis used to compute the taxable gain or loss. The basic concept — that cost basis equals what you paid plus transaction costs and that taxable gain equals sale proceeds minus that basis — is standard tax accounting practice Fidelity.
Scope and core points
- Cost basis should include purchase price and any fees or commissions that can be added to the lot cost; those increase the basis used to compute gain or loss Fidelity.
- The identification method determines which lot costs are assigned to a sale. For ordinary shares this generally means adequate specific identification or, absent identification, FIFO. Average basis is limited to eligible mutual-fund shares and certain covered dividend-reinvestment-plan shares and therefore affects the size and timing of reported gains or losses Charles Schwab.
- HIFO is relevant for taxable brokerage accounts where lots are tracked; tax‑advantaged pooled accounts may follow different rules or make lot selection irrelevant.
Define a couple of terms
- Lot: a group of shares bought in a single transaction with a single per‑share cost.
- Cost basis: the per‑share purchase cost (plus allowable fees) used to compute gain or loss when those shares are sold.
How It Works
Stepwise mechanics
- Record each purchase lot with date, quantity, and per‑share cost (include commissions or fees when they can be added to that lot’s cost) — that recorded amount is the lot’s cost basis Fidelity.
- When you place a sale for N shares, list the unsold lots for that security and their per‑share costs.
- Under HIFO, select the lot(s) with the highest per‑share cost first; continue down the cost ranking until N shares are matched.
- For each matched lot, compute realized gain or loss as (sale price − lot cost) × number of shares taken from that lot.
- Sum the matched‑lot results to get the total realized gain or loss for the sale.
Compact formula - For matched lot i: realized_i = (P_sell − C_i) × Q_i - Total realized = Σ realized_i for all matched lots Where P_sell = sale price per share; C_i = cost per share of lot i; Q_i = shares matched from lot i.
Practical broker and recordkeeping notes
- Brokers commonly let you select a lot‑identification method or use a default if you do not specify one; that selection affects what gets reported to you and to tax authorities Charles Schwab.
- Accurate HIFO accounting requires complete lot history. Many brokers automate lot tracking and can apply HIFO when supported; doing it manually requires careful records to avoid reporting errors Fidelity.
- HIFO is a reporting rule: it changes tax reporting (which lots are considered sold) rather than cash proceeds or the economic return on the investment Fidelity.
Worked Example
Assumptions (hypothetical)
- Holdings in XYZ: three lots, 100 shares each.
- Lot A: 100 shares @ $50.00
- Lot B: 100 shares @ $70.00
- Lot C: 100 shares @ $40.00
- You sell 150 shares at $80.00 per share.
- Commissions and fees are treated as already included in the lot prices for simplicity.
Apply HIFO
- Rank lots by per‑share cost: Lot B ($70), Lot A ($50), Lot C ($40).
- Match 150 shares: 100 from Lot B and 50 from Lot A.
- Compute realized gain per matched lot:
- Lot B: (80 − 70) × 100 = $10 × 100 = $1,000.
- Lot A: (80 − 50) × 50 = $30 × 50 = $1,500.
- Total realized gain under HIFO = $2,500.
Compare to FIFO (for the same sale)
- FIFO would match Lot A (oldest) then Lot B partly:
- Lot A: (80 − 50) × 100 = $3,000.
- Lot B (50 shares): (80 − 70) × 50 = $500.
- Total FIFO realized gain = $3,500.
Interpretation of the numbers
- In this scenario HIFO reduced the immediate realized gain by $1,000 versus FIFO. The sale proceeds are identical; HIFO changed which lot costs are applied and therefore changed taxable gain timing and amount.
- Whether that tax timing is “better” depends on your objectives, holding periods, and future transactions; HIFO does not change the underlying cash flows from the investments Fidelity.
Practice trading with Finelo
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
How to Interpret It
What HIFO does (and does not)
- Timing vs lifetime taxes: HIFO can lower taxable gains now by using higher lot costs, but it typically defers gains into the lower‑cost remaining lots; total lifetime tax depends on future sales and is not guaranteed to be lower overall Fidelity.
- Holding period interaction: Lot selection affects whether recognized gains are short‑term or long‑term because holding period is tied to the matched lot’s purchase date. Matching a high‑cost recent lot can convert what would have been a long‑term gain into a short‑term gain or vice versa, which changes the tax rate applied Charles Schwab.
- Administrative tradeoffs: Specific ID (you name the lots) gives precise control but requires documentation at sale; HIFO automates a high‑cost selection without per‑trade identification but still depends on accurate lot history and broker support Fidelity.
A simple decision framework (four questions)
- Objective: Is minimizing current taxable gain your top priority, or do you prefer simple reporting and consistency?
- Horizon: Do you expect to hold remaining lots long enough to qualify for long‑term rates?
- Administration: Does your broker support HIFO or Specific ID, and are you willing to maintain documentation if you pick Specific ID? Charles Schwab
- Documentation: Can you reconcile broker reports with your records if an audit or discrepancy arises? Fidelity
Two common misreads and why they fail in practice
- Misread 1: “HIFO eliminates taxes.” Reality: HIFO reallocates when gains are recognized; it can reduce taxes now but usually shifts tax to other lots to be realized later.
- Misread 2: “My broker will always use HIFO automatically.” Reality: broker defaults and the methods they support vary. Confirm the method your broker will apply if you do not make an election Charles Schwab.
Practical tip: If you use periodic investing (for example, automatic contributions or reinvested dividends), you will accumulate many lots. Those many lots are precisely why lot‑identification methods such as HIFO matter; see the glossary entry on Dollar Cost Averaging to understand how repeated purchases create multiple lots: Dollar Cost Averaging.
How It Compares With Related Concepts
Short comparisons
- HIFO vs FIFO (first‑in, first‑out): FIFO uses the oldest lots first. In rising markets where older lots are lower cost, FIFO usually yields larger immediate gains than HIFO.
- HIFO vs specific identification: HIFO is implemented through specific identification—either a per-trade instruction or a broker-supported standing instruction—plus written confirmation. It does not bypass the documentation requirements for identifying the shares sold.
- HIFO vs average basis: average basis pools eligible shares, but U.S. federal tax rules generally restrict it to mutual-fund shares and certain covered DRIP shares. It is not a general alternative for ordinary individual-stock lots.
Why these differences matter
- Tax timing and rate: Specific ID and HIFO can be used to manage when gains are taxed and whether gains are short‑ or long‑term; average cost and FIFO offer less control.
- Practicality: Use Specific ID if you need precise per‑sale control and can document it. Use HIFO if your primary goal is to minimize current recognized gains and your broker supports it; otherwise FIFO or average cost might be simpler.
- Broker support: Not every broker supports every method for every security; confirm what options are available in your account settings Charles Schwab.
Limitations and Source Checks
Key limitations
- HIFO changes tax timing, not the underlying economic outcome; tax owed may just be delayed or shifted among lots Fidelity.
- Complete lot history and accurate records are essential; missing or wrong records can produce incorrect reporting and complicate tax filings Fidelity.
- Holding‑period consequences can alter effective tax rates; matching high‑cost lots that are short‑term can increase your short‑term taxable income relative to other methods Charles Schwab.
Checklist — what to verify before relying on HIFO
- Broker support and defaults: Confirm whether your broker offers HIFO or a “highest cost” option and whether you must elect it per trade or make it an account default Charles Schwab.
- Record alignment: Reconcile your trade confirmations and internal lot records with your broker’s cost‑basis reporting to ensure consistency Fidelity.
- Documentation rules: If you sometimes use Specific ID, document lot IDs at the time of sale per your broker’s required procedure; keep confirmations for records Charles Schwab.
- Holding‑period review: Check whether the matched lots are short‑ or long‑term to estimate likely tax treatment of recognized gains Charles Schwab.
Two practical mistakes and fixes
- Mistake: Relying on memory to choose lots. Fix: Export broker lot reports or keep trade confirmations and reconcile them before tax filing Fidelity.
- Mistake: Optimizing a single sale without considering future sales. Fix: Use the decision framework (objective, horizon, admin cost, documentation) to weigh whether minimizing current gains is strategically useful.
Further reading and next step - To see how repeated purchases create many lots — and why lot‑identification methods matter — read Dollar Cost Averaging: https://finelo.com/glossary/dollar-cost-averaging One contextual note: when you include commissions or fees in lot cost, remember that treating transaction costs as part of basis follows the same cost‑basis principle that basis equals what you paid plus allowable costs Fidelity. For a quick refresher on how fixed and variable transaction costs affect per‑share math, our Fixed Vs Variable Costs explainer can help: https://finelo.com/blog/fixed-vs-variable-costs
Frequently asked (brief)
- Does HIFO reduce my lifetime taxes? HIFO can reduce current realized gains but typically reallocates gains to other lots; lifetime taxes depend on future transactions and holding periods Fidelity.
- Will my broker automatically apply HIFO? Broker options and defaults vary. Confirm your broker’s supported methods and default behavior if you do not elect a method Charles Schwab.
All trademarks, logos, and brand names are the property of their respective owners. Use of these does not imply endorsement by or affiliation with Finelo.
Sources and Further Verification
Practice trading with Finelo
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
About the author
Finelo Team
The Finelo Team creates practical investing and trading education designed to help beginners learn faster with structured challenges, simulator practice, and bite-sized lessons.
Keep reading — Related articles
UGMA vs UTMA Accounts: Taxes, Control, and Which Fits Your Child
U.S. scope: This article discusses United States institutions, product conventions, and dollar examples unless stated otherwise. Rules can vary by state and provider and may change. The UK…
Teaching Kids About Money by Age: A Practical Plan from 5 to 18
U.S. scope: This article discusses United States institutions, product conventions, and dollar examples unless stated otherwise. Rules can vary by state and provider and may change. The UK…
Renting vs Buying a Home: The Break‑Even Math for Young Families
Neither renting nor buying is universally better — it’s a math problem plus a life question. Buying trades large up‑front and exit costs plus ongoing ownership expenses for equity,…