CalcDuck

Stock Average Calculator

Stock Average Calculator

Average cost per share
$77.00
Total shares
50
Total invested
$3,850.00
Purchase history
Purchase #SharesPrice per shareCost
110$100.00$1,000.00
215$90.00$1,350.00
325$60.00$1,500.00

Buying 10 shares at $100, 15 at $90, and 25 at $60 costs $3,850 total for 50 shares, an average cost of $77.00 per share. Average cost per share is the total amount invested divided by the total shares owned across all purchases.

Tip: “Copy with settings” shares a link that opens this calculator with your numbers already filled in.

How this calculator works

When you buy shares of the same stock at different prices over time, your true cost basis is the weighted average cost per share, not the simple average of the purchase prices. This calculator takes a list of share counts and a matching list of prices, one entry per purchase, and computes the total shares, total amount invested, and the average cost per share.

This is the same math behind dollar-cost averaging: because each purchase can involve a different number of shares, the weighted average cost is generally different from — and often lower than — the plain average of the prices you paid, since more shares get bought when the price is lower.

The formula

Total shares = sum of shares across all purchasesTotal invested = sum of (shares × price) across all purchasesAverage cost per share = Total invested ÷ Total shares

Enter share counts and prices as comma-separated lists in the same order; the two lists must be the same length.

Worked example: three purchases

  1. Purchase 1: 10 shares at $100 = $1,000.
  2. Purchase 2: 15 shares at $90 = $1,350.
  3. Purchase 3: 25 shares at $60 = $1,500.
  4. Total invested is $1,000 + $1,350 + $1,500 = $3,850 across 10 + 15 + 25 = 50 shares, so the average cost is $3,850 ÷ 50 = $77.00 per share.

Frequently asked questions

Why is my average cost different from the average of the prices I paid?

The average of the prices treats every purchase equally regardless of size. The average cost per share is weighted by how many shares each purchase involved, so buying more shares at a lower price pulls the average down more than a simple price average would show.

Does this include trading fees or commissions?

Not unless you add them into the price you enter for each purchase. To include a fee, add it to the effective price paid for that purchase before entering it.

Can I use this for selling shares too?

This calculator computes the average cost basis of shares bought, which is what many brokers use to calculate gains or losses on shares sold, but it does not model partial sales or track a running balance after sales.

What if I only have one purchase?

With a single share count and a single price, the average cost per share is simply that price, since there is nothing else to average.

How do I find my unrealized gain or loss once I know my average cost per share?

Multiply your average cost per share by your total share count to get your total amount invested, the same total invested this calculator already computes. Then multiply your total shares by the current market price per share to get the current value, and subtract total invested from that to get your unrealized gain or loss. This calculator only computes the average cost and total invested; you'll need to supply the current share price yourself since it changes constantly.

Sources

Related calculators