Average Cost Calculator
One per line: price quantity, e.g. 10.5 1000
How to Use
What this tool does
You bought the same stock three times at three different prices, and the average cost shown in your broker app leaves out commissions. Working out the break-even price by hand means listing every fill and dividing total cash by total shares. This tool puts each purchase on its own row, with price, quantity and fee, then divides total outlay by total shares.
Here is a set of numbers you can check against a calculator: 1000 shares at 12.00, another 1000 at 10.00, and 500 at 9.60 gives 26800 paid for 2500 shares, or 10.72 per share. Add a commission to each row and the average climbs slightly, and the break-even line moves with it.
The result panel also reports unrealised profit at the current market price, the profit ratio, estimated selling costs and net proceeds. Rows can be added or removed, and every edit recalculates the whole table. Empty rows are ignored rather than treated as zero shares, so a half-filled form cannot quietly skew the average.
The form is deliberately explicit about where each number comes from. Price, share count and fee are separate columns, and the totals line underneath is the sum of price times quantity plus the fees you typed, not a figure fetched from a broker. That matters because many broker apps show an average that excludes commission, stamp duty or a minimum ticket charge, and the gap between the two numbers is exactly what people notice when they try to reconcile a statement. If you want the tool to match a particular statement, enter the same fee amounts that appear on that statement, including any per-order minimum. The break-even line is derived from the same totals: it is the price at which selling every share at that price, after the selling-side charge, returns the cash you put in. It is therefore slightly above the average cost, and the gap widens as the fee rate rises. Current market price is used only for the unrealised profit and profit ratio; changing it never moves the average, which is a useful sanity check when a result looks surprising. All values are rounded to two decimals for display, while the arithmetic keeps full precision until the last step, so copying a result into a spreadsheet will not produce a small unexplained residue. Empty rows are skipped, a zero share count is rejected, and a non-numeric cell produces a prompt rather than a NaN in the result block. Nothing is stored: a refresh gives you a blank table, which is worth remembering before you close the tab on a long list of fills.
Key features
- Unlimited fill rows: Add as many purchases as you need, each with its own price, share count and fee; deleting a row updates every total at once.
- Fees included in basis: Commissions and similar charges are added to total outlay, so the average is total cash divided by total shares rather than a plain average of prices.
- Break-even price: Selling-side charges are worked backwards into the price at which the position is flat, shown beside the current price so the gap is obvious.
- Consistent profit figures: Unrealised profit and profit ratio deduct the same selling charge, so the two numbers always agree with each other.
- Partial-sale estimate: Enter a planned sale quantity and price to see net proceeds from that sale and the cost left in the remaining position.
- Copy in one click: The whole result block goes to the clipboard as plain text, ready to paste into a spreadsheet without reformatting.
How to use it
- Enter the first fill: Type the execution price, share count and any fee into the first row; leave fee blank when there was none.
- Add later purchases: Use the add-row button for each subsequent buy until the whole position is listed.
- Set the current price: Put the latest quote in the current-price field; it drives unrealised profit but does not change average cost.
- Press Calculate: The panel returns average cost, break-even price, unrealised profit, profit ratio and net sale proceeds.
- Review and adjust: Edit any cell and recalculate, or load the example to see a complete worked set of numbers first.
Things to keep in mind
- Fee conventions vary: Minimum commissions and transfer fees differ between brokers; the tool uses only the amounts you enter and assumes no rate of its own.
- No corporate actions: Cash purchases only. Dividends, bonus shares and rights issues change share count and must be reflected in the rows manually.
- Positive numbers only: Zero, negative or non-numeric prices and quantities produce a prompt instead of being averaged as zero.
- Not a quote: Break-even is arithmetic, with no allowance for slippage, price limits or liquidity; leave room for those in real orders.
- Nothing leaves the page: Inputs are neither uploaded nor stored, and a refresh returns an empty form, so keep your own record of important figures.