Multiple Buy Lots & Cost Basis: FIFO vs. Specific ID
The stock profit calculator’s core formula assumes one buy price and one sell price — accurate for a single lump purchase sold all at once, but many investors buy the same stock repeatedly over time (dollar-cost averaging, dividend reinvestment, or simply adding to a position) and then sell only part of it. This guide covers how to handle that.
Why Cost Basis Gets Complicated With Multiple Lots
Each purchase of the same stock at a different time creates a separate “lot” with its own cost basis. When only some shares are sold, which lot’s cost basis applies determines the reported gain or loss — and the same sale can produce a very different taxable result depending on which lot is treated as sold.
Example setup: Three purchases of the same stock:
Lot 1: 50 shares @ $40 (bought 2 years ago)
Lot 2: 50 shares @ $60 (bought 8 months ago)
Lot 3: 50 shares @ $75 (bought 2 months ago)
Now 50 shares are sold at $80.
Method 1 — FIFO (First In, First Out)
The IRS default when no other method is specified: the oldest lot is treated as sold first.
Lot 1 basis: 50 × $40 = $2,000
Proceeds: 50 × $80 = $4,000
Profit = $4,000 − $2,000 = $2,000
Holding period: 2 years → long-term capital gain
Run this through the stock profit calculator using $40 as the buy price and $80 as the sell price for 50 shares to get this exact result.
Method 2 — Specific Identification (Choosing Lot 3 Instead)
If the investor notifies the broker in advance to sell shares from Lot 3 specifically instead:
Lot 3 basis: 50 × $75 = $3,750
Proceeds: 50 × $80 = $4,000
Profit = $4,000 − $3,750 = $250
Holding period: 2 months → short-term capital gain
Same sale, same sell price — but the reported profit drops from $2,000 to $250, and the holding period category flips from long-term to short-term. Specific identification requires notifying the broker of the exact lot at the time of the trade (per IRS Publication 550); it isn’t something that can be chosen retroactively when filing taxes.
Which Method Actually Matters More: Tax Rate or Dollar Amount
These two methods don’t just change the profit number — they change which tax rate applies. FIFO in the example above realizes a larger gain but at the (typically lower) long-term rate. Specific identification realizes a much smaller gain, but at the (typically higher) short-term rate. Which produces a lower actual tax bill depends on the investor’s tax bracket and how the two rate schedules compare that year — there’s no universal answer, which is why this decision is often made with a tax professional’s input rather than by rule of thumb.
Method 3 — Average Cost Basis (Mutual Funds and Some Brokerage Accounts)
Some account types (particularly mutual funds, and DRIP-enrolled stock positions at certain brokers) default to an average cost basis across all lots instead of FIFO or specific identification:
Average cost = (50×$40 + 50×$60 + 50×$75) ÷ 150 = $8,750 ÷ 150 = $58.33/share
Selling 50 shares at $80 under this method:
Profit = (50 × $80) − (50 × $58.33) = $4,000 − $2,916.50 = $1,083.50
Average cost basis isn’t available for individual stock positions at most brokers (it’s mainly a mutual fund and DRIP feature) — check the specific account type before assuming it applies.
Practical Steps
- Pull the 1099-B or brokerage lot detail for the position before selling — it lists each purchase lot’s date, share count, and price.
- Decide which method fits the goal — minimize this year’s tax bill (often specific identification of high-basis or long-held lots) versus simplicity (FIFO, the default with no broker notification needed).
- Notify the broker before the trade settles if using specific identification — this cannot be applied retroactively.
- Run the chosen lot’s numbers through the stock profit calculator using that lot’s specific buy price, shares, and holding period.
Bottom Line
A partial sale of a multi-lot position isn’t one calculation — it’s a choice between FIFO, specific identification, or (in limited account types) average cost, each producing a different profit figure and holding-period category from the identical sale. Identify which lot (or average) applies before entering numbers into the stock profit calculator, and see common stock profit calculation mistakes for what happens when the wrong lot’s basis gets used by accident. For the cost basis, wash sale, and NIIT terms these lot-selection rules depend on, see the stock trading terms glossary.
References & Sources
- [1]
- [2]