HakoTools

Average Cost Basis Calculator

Buy the same stock a few times at different prices and the average you paid stops being obvious. Enter each purchase and this works out the weighted average, what you need for break-even, and what a further purchase would do to it.

Published: / Published by the HakoTools team

Results are estimates based on the assumptions stated on this page. Your own figures will differ, so check an authoritative source before acting on them. (Disclaimer)

Purchases (shares × price paid)
shares at
shares at

How it works

What is average cost per share?

Your average cost per share is the total you have spent on a holding divided by the number of shares you own. It is a weighted average, not the average of the prices you paid: a purchase of 300 shares moves it three times as far as a purchase of 100. This tool takes each purchase you made, works out that average, and then answers the two questions that usually follow. What price do I need to break even, and what would buying more do to the average? Everything is calculated in your browser and nothing you enter is sent anywhere.

How to use it

  1. Enter each purchase as a number of shares and the price you paid
  2. Add a commission rate if you want it included in the cost. It is added to each purchase
  3. Press Calculate average cost to get the average, the share count and the total invested
  4. Enter the current price to see unrealised profit and the break-even price
  5. Use the last two sections to test a further purchase, either by size or by the average you want to reach

What is the formula?

Average cost = total spent ÷ total shares, where total spent adds upshares × price for every purchase. Take the example built into the tool: 100 shares at50.00 and 100 shares at 40.00. That is 5,000.00 plus 4,000.00, so9,000.00 spent on 200 shares, and the average cost is 45.00 per share.

With a commission rate the cost of each purchase is multiplied by 1 plus the rate. At 0.5% the same two purchases cost 9,045.00 instead of 9,000.00, and the average becomes 45.22. Small on one trade, and the reason a position built from many small purchases breaks even higher than the arithmetic suggests.

What price do I need to break even?

The break-even price is the average cost itself. Below it the position is down, above it the position is up, and the gap between the current price and the average is the unrealised result. With 200 shares at an average of 45.00 and a current price of 42.50, the position is worth 8,500.00 against 9,000.00 invested, an unrealised loss of 500.00, or -5.6%.

One thing the number does not include is what it costs to sell. Commission on the way out, and tax on any gain, both mean the price at which you actually walk away even is a little above the break-even shown here.

What does averaging down actually do?

Buying more at a lower price pulls the average towards the new price. It never pulls it below the price you just paid, and that limit is the useful thing to know before you commit. Buying 100 more shares at 35.00 takes the example holding from 45.00 to 41.67 across 300 shares.

The effect shrinks as you add more. Each further share has less weight against a total that is already growing, so the curve flattens towards the purchase price and never reaches it.

0.0012.5025.0037.5050.000 sh: Average cost after buying more at 35.00 45.000 sh50 sh: Average cost after buying more at 35.00 43.0050 sh100 sh: Average cost after buying more at 35.00 41.67100 sh200 sh: Average cost after buying more at 35.00 40.00200 sh400 sh: Average cost after buying more at 35.00 38.33400 sh
Average cost after buying more at 35.00

Buying 200 more, which doubles the position to 400 shares, moves the average from 45.00 to 40.00, a fall of 5.00. Buying 200 more again takes it only a further 1.67, to 38.33. What grows in a straight line is the money at risk.

How many shares to reach a target average?

Rearranged for the number of shares, the formula is (total spent − target × shares held) ÷ (target − purchase price), rounded up to a whole share. To bring the example holding from 45.00 down to 42.00 by buying at 35.00, you would need 86 shares, which lands the average at 41.99 and takes the total invested to 12,010.00.

That last figure is worth reading twice. Reaching the target costs 3,010.00 of new money, against a position that had 9,000.00 in it to begin with.

Share counts accept decimals, so a position built from fractional purchases goes in as it stands. The reverse calculation still rounds up to a whole share, which is the conservative direction: buying the rounded figure lands you at or below the target average rather than just short of it.

When is a target average impossible?

Two cases, and the tool refuses both rather than returning a misleading number.

  • The target is at or above your current average. Buying more at a lower price can only bring the average down, so there is nothing to solve for
  • The target is at or below the price you would buy at. The average always stays above the lowest price you paid, so no quantity gets you there. Buying at 45.00 to reach 42.00 fails for this reason, and so does any purchase price of 42.00 or more

Is this the cost basis my broker reports?

Not necessarily, and the difference matters at tax time. This tool uses the average cost method: one pooled average across every share you hold. Which method actually applies to you depends on where you are and what you hold.

  • United States. Average basis is available for mutual fund shares, and is what many brokers apply to funds unless you say otherwise. It is not available for individual shares: there the default is first-in, first-out, and you can instead identify specific lots at the time of sale, which often produces a very different taxable gain
  • United Kingdom. Shares of the same class are pooled into a section 104 holding, and the pooled average is close to what this tool produces. The same-day and 30-day matching rules can override it for shares bought around a disposal
  • Elsewhere. Average cost, FIFO and other methods are all used somewhere. Check your own rules before treating this number as a tax figure

There is also a set of adjustments no calculator of this kind can see: wash sales in the US and bed-and-breakfasting rules in the UK, return-of-capital distributions, spin-offs, and reinvested dividends that quietly become new purchases. Treat the result as a clear picture of what you have paid, and your broker's statement as the document of record.

What happens to the average after a stock split?

Nothing is gained or lost: your total invested stays the same, your share count multiplies by the split ratio, and your average cost divides by it. After a 2-for-1 split the example holding becomes 400 shares at an average of 22.50, still 9,000.00 invested.

If you are entering purchases made before a split, put in the split-adjusted share counts and prices, or you will be adding shares that no longer exist at prices that no longer apply. A reverse split works the same way in the opposite direction.

Why does my broker show a different average?

Usually one of four reasons. Commission and fees may be included in their figure and not in yours, or the other way round. They may be applying FIFO rather than average cost, so a partial sale changed the basis of what remains. Dividends you reinvested were new purchases and are counted. Or a corporate action has been adjusted for on their side and not on yours.

If the gap does not resolve, your broker's number is the one that counts for tax. This tool is for seeing what a position looks like and testing what another purchase would do to it.

Notes and limits

  • No live prices. You enter the current price yourself. Nothing is fetched, so nothing about your holdings is transmitted
  • One currency, one stock. Figures are unitless, so use whichever currency your purchases are in. Positions in different currencies cannot be pooled here
  • Purchases only. Sales, short positions, options and dividends are not modelled. A partial sale does not change the average under the average cost method, but it will change what your broker reports if a different method applies
  • Commission is a percentage. Flat per-trade fees, common with US brokers, are not modelled. For a flat fee, add it to the price of that purchase yourself
  • Not advice. This is arithmetic. Whether to buy, hold or sell is your decision

Where these figures come from

The rules and figures this page relies on come from the sources below (links checked 22 September 2026).

What can change: Which method applies to you, and the rules around same-day and 30-day matching, are set by tax law and change with it. The calculator itself only ever computes a pooled weighted average, so check the current rules where you live before using the figure for a return.

Related tool

Average cost tells you what one holding cost you. What it cannot tell you is whether that holding has grown into too large a share of everything you own. For that, the portfolio rebalancing calculator takes the value of each holding and shows the drift from your target weights, along with the trades that close it.

Frequently asked questions

How is the average cost per share calculated?
Add up what every purchase cost, then divide by the total number of shares. Buy 100 shares at 50.00 and 100 at 40.00 and you have spent 9,000.00 on 200 shares, so the average cost is 45.00 per share. It is a weighted average, so a larger purchase pulls the average further.
Does this match the cost basis my broker reports for tax?
Only if your holding is taxed on an average-cost basis. In the United States that is the default for mutual funds but not for individual shares, where FIFO or specific identification applies unless you elect otherwise. In the UK, share pooling produces a figure close to this. Use the result to understand your position, not to file a return.
Should I average down?
This tool takes no view. Buying more of a falling position lowers your average cost, and it also increases the amount at risk in a stock that is already going against you. The arithmetic here tells you what the average becomes, not whether the purchase is a good idea.
Are share prices fetched automatically?
No. There is no live price feed. You enter the current price yourself, from your broker or wherever you check it. Nothing you type is sent anywhere, because the calculation runs entirely in your browser.
Share this tool: