Skip to content
LunaCalc

Finance

Stock Average Calculator

Calculate quantity-weighted stock cost basis and optional unrealized return.

Calculator
%

About this calculator

This stock-basis calculator computes quantity-weighted average purchase price, total cost basis, and optional unrealized return at a current price.

Formula notes

average price = total cost basis / total shares; unrealized P/L = current price x total shares - total cost basis.

Worked examples

  1. Example: buying 100 at 10 and 50 at 20 gives an average price of 13.33 and total cost basis of 2000.
  2. Buying 200 shares at 25 and 100 at 40 gives an average price of 30 and a cost basis of 9000.

How to use it

  1. Enter purchase prices and share quantities as matched lists.
  2. Optionally enter the current price.
  3. Read the average price, cost basis, current value, and unrealized return.

Frequently asked questions

Do the price and quantity lists need the same length?

Yes. Each price is paired with its quantity, so the lists must match in length.

Is the current price required?

No. Leave it empty to see only the average price and cost basis.

Limits and interpretation

  • The average is quantity-weighted across all entered lots; fees and commissions are not included unless you add them to a price.
  • Unrealized return is based only on the entered current price and does not include dividends or taxes.

References