Tax

Average Cost Basis Calculator

Buying the same holding at several prices leaves one blended cost per unit, which is what this works out across your lots.

Each purchase lot, in units and price

First and second lot

Number of units in the first purchase.

Price per unit in the first purchase, in your local currency.

Number of units in the second purchase.

Price per unit in the second purchase.

Third lot

Units in a third purchase (leave at 0 if unused).

Price per unit in the third purchase.

Average Cost per Unit

23.33

Total cost divided by total units.

Formula verified 12 September 2026

Total Units

150.00

All units across the lots.

Total Cost

3,500.00

Combined cost of all lots.

Report an issue

Educational estimate only — verify rates with your official tax authority. Read the full disclaimer ↓

Cost contributed by each lot

Add your numbers to see the visual breakdown.

Per-lot cost and weighted average

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.

LotUnitsPrice/unitLot cost
Lot 1100202,000
Lot 250301,500
Total1503,500
Weighted average cost/unit23.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.

Related Calculators

Cost BasisWhat an asset actually cost you: purchase price plus commissions, charges and capital improvements.
Stock Capital Gains TaxGain and tax on a share sale entered per share, with brokerage deducted and the net gain after tax.
Capital Gains TaxFederal capital gains tax with the short-term and long-term treatments side by side, so the holding-period cliff is visible.
Mutual Fund Capital Gains TaxGain and tax on a fund redemption entered in units and NAV, with the exit load taken off the proceeds first.

More in Tax, or browse all calculators.

Tax disclaimer

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.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 12 September 2026

  1. Published the calculator with its formula, worked example, assumptions, limitations and a bespoke guide, and added an automated formula test suite covering it.
  2. Tested the unit-weighted average across three purchase lots against a hand-computed total cost over total units.
  3. 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.