HeadroomDESK

Stock average calculator

Type each purchase: the number of shares and the price paid. The page shows your average cost per share and the total. Below, see what one more purchase does to the average, or how many shares at a given price bring it to the figure you type.

1 · Your purchases (example values)

$
$
$

(up to 10; empty rows are skipped)

$

One more purchase (optional)

$
$

Your average cost

–

PurchaseSharesPriceCost

With one more purchase

CaseShares thenAverage thenTotal cost then

A lower average is not a smaller loss: each added share is more money exposed to the next move.

3 · How it is calculated

Runs in your browser. Nothing you type leaves this page.

Average cost = everything paid, fees included, divided by the shares held. Exact to the cent; the average is rounded once, at 4 decimals.

This calculator does not know your broker, account type, tax position or fees.

Cost basis for tax can differ: brokers often match sales to particular purchases (first in, first out, or lots you pick) instead of the average.

What the numbers mean, with a worked example

How to read these numbers: what they mean, the formula in plain words, a worked example, the common mistake and the conventions.

How to read the result

Average cost per share, in five parts

What the numbers mean

Your average cost is the price at which the whole position is at zero: above it the shares are worth more than you paid, below it less. Each new purchase pulls the average toward its own price, more strongly the more shares it adds.

The formula, in plain words

Add up what each purchase cost (shares times price), add the fees, and divide by all the shares. To reach a chosen average with one more purchase, the shares needed are the gap between what you paid and what that average would have cost, divided by how far the new price sits from that average.

average cost = (Σ shares · price + fees) / Σ shares average after n = (total cost + n · new price) / (shares + n) shares to reach A = (total cost − A · shares) / (A − new price)

One worked example

The calculator's starting inputs: 100 shares at 50.00 and 50 at 42.00, no fees.

  1. Total cost100 × 50.00 + 50 × 42.00 = 7,100.00
  2. Average cost7,100.00 / 150 ≈ 47.3333
  3. 25 more at 38.00(7,100.00 + 25 × 38.00) / 175 = 46.00
  4. Shares to average 45.00(7,100.00 − 45.00 × 150) / (45.00 − 38.00) = 50

The common mistake

Reading a lower average as a smaller loss. In the example, adding 50 shares at 38.00 brings the average to 45.00, but the position grows from 150 to 200 shares. A further fall of 4.00 a share then costs 800.00 instead of 600.00.

Conventions

  • Fees: typed fees are added to the cost, so they raise the average. Fees of a further purchase are not included.
  • Shares: whole or fractional, up to 4 decimals. The shares needed to reach an average are whole shares, rounded up.
  • Part of a position closed: closing some shares does not change the average cost of the rest. Your broker's tax lots (first in, first out, or chosen lots) can show a different basis.

The arithmetic

C = Σ shares · price + fees S = Σ shares average = C / S (rounded half away from zero at 4 decimals) after n at price P = (C + n · P) / (S + n) n to reach A = (C − A · S) / (A − P) (only when P and the average sit on opposite sides of A)

Related

Last reviewed (UTC).