# Average share price calculator > How much did your shares cost on average? Add each purchase and see the average price per share with fees, and the price you need to break even. Calculate the average purchase price of shares from several buys with fees, plus the break-even sell price. A weighted average cost for any stock or fund. - Page: https://how.box/average-price/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/average-price/?b={b}&f={f} - `b` (array): Purchases, versioned: ~1:id.shares.price.fee_… (a fee of 0 may be left out). Example: `[object Object],[object Object],[object Object]`. - `f` (number 0 to 1e9): Total fee when selling everything. Example: `0`. Example answer: https://how.box/average-price/?b=%7E1%3Ab1.100.20.5_b2.50.25.5_b3.80.18*5.5&f=0 A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `average_price_calculate`: Average purchase price of shares from several buys (weighted average cost). - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"average_price_calculate","arguments":{"buys":[{"id":"b1","shares":100,"price":20,"fee":5},{"id":"b2","shares":50,"price":25,"fee":5},{"id":"b3","shares":80,"price":18.5,"fee":5}],"sell_fee":0}}}` - GET: https://how.box/mcp/run/average_price_calculate?buys=%5B%7B%22id%22%3A%22b1%22%2C%22shares%22%3A100%2C%22price%22%3A20%2C%22fee%22%3A5%7D%2C%7B%22id%22%3A%22b2%22%2C%22shares%22%3A50%2C%22price%22%3A25%2C%22fee%22%3A5%7D%2C%7B%22id%22%3A%22b3%22%2C%22shares%22%3A80%2C%22price%22%3A18.5%2C%22fee%22%3A5%7D%5D&sell_fee=0 ## How it works If you buy the same share several times at different prices, your average purchase price is what each share cost you on average. It is the number to compare with today's price: sell above it and you have a gain, below it a loss. Fees are part of what you paid, so they belong in the average. The average is the total cost divided by the total shares: (Σ shares × price + Σ fees) ÷ Σ shares. For example, 10 shares at 10 and 10 shares at 20 cost 300 for 20 shares, an average of 15. Buying more shares when the price is low pulls the average down, because shares at each price are weighted by how many you bought. The break-even sell price adds the selling fee: (total cost + selling fee) ÷ shares. Source: Investopedia, "Average cost basis". This is the weighted average cost method. Some countries and brokers use other rules for tax, such as first in, first out, and then the cost of the shares you sell can differ. The tool does not calculate tax or currency changes. ## FAQ **Why is the average price not just the average of the prices?** Because you bought different numbers of shares at each price. A big purchase should count for more than a small one, so the prices are weighted by shares. **Should fees be included?** Yes. Fees are part of what you paid, so including them gives the price at which you really break even. The tool shows the average with and without fees. **What is the break-even sell price?** The price per share at which selling everything returns exactly what you put in, including the fees you paid to buy and the fee to sell. **Does buying more at a lower price help?** It lowers your average price, so you break even sooner if the price recovers. It also means putting more money into the same share, which adds risk. **Can I use it for funds, crypto or fractional shares?** Yes. Enter the number of units, even a fraction, the price per unit and the fee for each purchase. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)