Stock profit calculator guide

FIFO vs LIFO Stock Sale Profit

FIFO and LIFO can produce different realized profit when a partial sale draws shares from purchase lots with different costs. The sale price is unchanged; the cost basis assigned to Shares sold is what differs.

Quick answer

What is the difference between FIFO and LIFO stock profit?

FIFO assigns the oldest remaining purchase shares to the sale first. LIFO assigns the newest remaining purchase shares first. The calculator allocates both purchase value and Buy commission proportionally from the selected lots.

Realized profit=Net proceeds-Cost basis of the shares selected by FIFO or LIFO
Annotated stock profit calculator showing LIFO lot allocation, shares sold, assigned cost basis, and remaining cost basis
The arrows connect the selected LIFO method with the partial-sale quantity and the cost basis assigned to sold and remaining shares.
  1. 1

    Select the allocation method. LIFO assigns shares from the most recently entered purchase first.

  2. 2

    Set the partial sale. This scenario sells 50 of the 100 shares owned.

  3. 3

    Verify basis conservation. LIFO assigns $5,004.17 to Shares sold and leaves $4,205.83 with the remaining shares.

Two-lot partial sale

The same sale produces $2,490 with FIFO and $490 with LIFO

Buy 50 shares at $80 and later buy 50 shares at $120. Sell 50 shares at $130 and pay a $10 Sell commission. No Buy commissions or dividends are included.

1. NET PROCEEDS

Calculate the sale

50 x $130 - $10 = $6,490.

2. FIFO BASIS

Use the oldest lot

50 x $80 = $4,000.

3. FIFO PROFIT

Subtract oldest basis

$6,490 - $4,000 = $2,490.

4. LIFO BASIS

Use the newest lot

50 x $120 = $6,000.

5. LIFO PROFIT

Subtract newest basis

$6,490 - $6,000 = $490.

6. CONSERVE BASIS

Keep the unsold lot

The unused $4,000 or $6,000 basis remains with the 50 unsold shares.

Allocation comparison

A $2,000 profit difference comes from cost basis

FIFO assigns the $80 shares and reports 62.25% ROI. LIFO assigns the $120 shares and reports 8.17% ROI. Net proceeds are $6,490 in both cases.

Net proceeds
$6,490.00
FIFO basis
$4,000.00
FIFO profit
$2,490.00
LIFO basis
$6,000.00
LIFO profit
$490.00

Conservation

The unselected cost basis stays with the unsold shares

A partial sale does not apply the full position cost to the realized result.

After the FIFO sale, the newer 50-share lot remains with $6,000 of basis. After the LIFO sale, the older lot remains with $4,000 of basis. In both cases, Shares sold plus Shares remaining still equal the original 100 shares.

The partial stock sale guide explains this conservation rule for commissions and more than two lots.

Explicit selection

Specific lots are entered, not inferred

Specific-lot mode is useful when the modeled sale should draw a stated number of shares from particular purchase entries.

Manual quantities

Enter the allowed share quantity for each lot instead of asking the calculator to choose a preference.

Purchase order

For shares-to-sell planning, the displayed purchase order defines the sequence within the entered limits.

No tax recommendation

The calculator reports mathematical outcomes and does not decide which identification method should be used for tax reporting.

Record check

Compare the modeled lots with brokerage confirmations and basis records before relying on a completed-sale result.

Inverse planning

FIFO and LIFO can change the shares needed for a profit target

When a target is Net profit or loss, the solver must account for the basis of each incremental share.

At the same selling price, lower-basis shares contribute more profit per share than higher-basis shares. FIFO and LIFO may therefore reach the same profit target with different quantities.

Use How Many Shares to Sell for a Profit Target for exact, whole-share, and unreachable-target behavior.

Methodology and references

Separate calculator allocation from tax-lot reporting

This page explains the calculator's mathematical FIFO, LIFO, and Specific-lot models. It does not determine the permitted tax treatment of a brokerage transaction.

Related calculator guides

Connect lot allocation with partial sales and position cost

These guides show how the lots are entered, summarized, and consumed by a modeled sale.

Ready to compare FIFO and LIFO sale results?

Use the Stock Profit Calculator