Each purchase lot, its cost (units × price), and how the lots combine into a weighted average cost per unit, from the values you entered. Lots with zero units are omitted. The average is total cost divided by total units, not a plain average of the prices.
Lot
Units
Price/unit
Lot cost
Lot 1
100
20
2,000
Lot 2
50
30
1,500
Total
150
3,500
Weighted average cost/unit
23.33
Estimates only — not financial, tax, or professional advice.
100% private — every number you enter is calculated in your browser and never sent to our servers.
What it calculates: Average Cost per Unit, Total Units, Total Cost.
Updated 5 June 2026 · Transparent assumptions
The lot sizes decide the answer, not the number of lots
Averaging the three prices treats a ten-unit buy and a thousand-unit buy as equals, which is wrong by a wide margin. The correct figure is the total amount spent divided by the total units held, so each price is weighted by how much you bought at it.
The gap between the two methods is largest exactly where it matters: someone who bought a small position early and added heavily later has a true average close to the later price, while the naive average sits misleadingly between them.
The method is set by the rules, not by preference
Mutual funds in many jurisdictions require average cost. Individual shares are commonly matched first-in-first-out unless you specifically identify the lots being sold, and some systems permit a choice that must then be applied consistently.
It is worth establishing which applies before computing anything, because the methods give materially different gains on the same sale. Choosing the method that suits the outcome, rather than the one the rules specify, is the error to avoid here.
A partial sale leaves the average cost unchanged
Under averaging, selling some units does not change the cost per unit of the ones you keep. The remaining holding carries the same blended basis, and the gain on the sale is measured against that figure.
A later purchase does change it. Adding units at a higher price raises the blended cost, which reduces the gain on future sales — the mechanical reason averaging behaves so differently from first-in-first-out in a rising market.
What this covers and where it stops
The tool takes up to three lots of a single security. A holding built from more purchases can still be handled by consolidating groups of buys into a single lot entry with the combined units and their own blended price, which is arithmetically identical.
Transaction costs are not included here — add them through the cost basis calculator first if you want them in the figure — and corporate actions such as splits and bonus issues must be applied to the unit counts before averaging, not after.
Sources & References
Figures on this page are checked against primary, authoritative sources. Links open in a new tab.
Tax rules vary by country, state, tax year, filing status, income type, deductions, and exemptions. This calculator is educational and uses the values you enter. Always verify final tax treatment with official sources or a qualified tax professional.
Published the calculator with its formula, worked example, assumptions, limitations and a bespoke guide, and added an automated formula test suite covering it.
Tested the unit-weighted average across three purchase lots against a hand-computed total cost over total units.
Tested that the weighted average always falls between the cheapest and dearest lot price, and equals it when only one lot has units.
Add this calculator to your site
Responsive embed — and private: nothing your visitors type leaves their browser.