Stock Average Calculator
Calculate the average cost per share across multiple stock purchases. Enter each buy as shares and price (optional fee) to get your weighted average price, total cost, and profit or loss at a current price.
Input
Each line is shares, price and an optional fee for that trade.
Optional. Add today's price to see unrealized profit or loss.
Output
| Metric | Value |
|---|---|
| No data yet | |
More ways to use this tool
REST API
curl -X POST https://api.iotools.cloud/v1/tool/stock-average-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"purchases": "100, 50\n100, 40\n50, 30",
"currentPrice": ""
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `stock-average-calculator` tool (Stock Average Calculator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.
Embed widget
<iframe
src="https://iotools.cloud/embed/stock-average-calculator/"
width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
title="Stock Average Calculator — iotools.cloud"
sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
allow="clipboard-write"
style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>Drop this into your own page — free, no key required, just a link back.
| Cost per API/MCP call | From 5 credits |
|---|---|
| Need more credits? | View pricing |
Also available with
Guides
The Stock Average Calculator works out your average cost per share when you've bought the same stock more than once — whether you're averaging down after a drop, averaging up, or building a position with regular purchases.
How to use it
- Enter one purchase per line as
shares, price. Add a third value for the trade's commission or fee:shares, price, fee. - Optionally enter the current price to see your unrealized profit or loss.
- Read your weighted average cost, total shares and total cost.
The formula
Average cost = (Σ shares × price + Σ fees) ÷ total sharesFees are included, so the average is your true break-even price — sell above it and you're in profit.
Example
Buying 100 shares at $50, 100 at $40 and 50 at $30 costs $10,500 for 250 shares, an average of $42.00 per share. Notice it is not the simple mean of the prices ($40), because larger purchases weigh more.
Everything is calculated in your browser; nothing is uploaded.