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 25 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.

Calculated in your browser — the numbers you enter are never sent to our servers.

What it calculates: Average Cost per Unit, Total Units, Total Cost.

Updated 25 September 2026 · 6,730 automated cases pass

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.

average cost = total cost / total units

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.

Frequently Asked Questions

How do I calculate average cost basis?

Multiply the units by the price in each lot, add those costs for the total cost, add the units for the total units, then divide total cost by total units. Lots of 100 at 20 and 50 at 30 average to 3,500 over 150, or 23.33 per unit.

Why not just average the prices?

A simple average of the prices ignores how many units you bought at each price. The correct figure is a weighted average that gives more influence to larger lots, which is what this calculator computes.

When is average cost used?

It is a common method for shares, mutual fund units, and sometimes crypto, especially where many purchases occur over time. Some jurisdictions require or default to it, while others let you choose, so confirm the rule.

How does it differ from FIFO?

FIFO assumes the earliest units are sold first, using their original prices, while averaging blends all purchases into one cost. The two can produce different gains, particularly when prices have moved a lot.

Can I include buying fees in the price?

Yes, if you fold the acquisition costs into each lot’s price per unit, the average basis will reflect them. Alternatively, track fees separately, but be consistent across lots.

What if I have more than three lots?

Combine some lots before entering them, or compute the total cost and total units yourself and divide. The method is the same regardless of how many purchases you have.

Sources & References

Figures on this page are checked against primary, authoritative sources. Links open in a new tab.

What the calculation assumes

  • The averaging method is permitted for this asset in your jurisdiction.
  • All lots are the same asset and the prices include acquisition costs you wish to capture.
  • Up to three lots are supported; combine additional purchases before entering them.
  • Figures are an estimate in one local currency for general reference, not a tax determination.

Where it stops

  • It supports three lots only; larger portfolios need lots combined first.
  • Averaging can give a different gain from FIFO or specific identification, which some systems require.
  • It does not adjust for splits, bonuses, returns of capital, or partial sales.
  • Results are not tax advice; confirm the allowable basis method with the tax authority or a professional.

Related Calculators

Capital Gains TaxFederal capital gains tax with the short-term and long-term treatments side by side, so the holding-period cliff is visible.
Dividend TaxTax on dividend income at the rate that applies to it, with the net actually received.
IndexationIndexed cost from the two years' cost inflation index, the gain that survives it, and the tax on that gain.
India GSTGST added or extracted, split into CGST and SGST or charged as IGST, with input tax credit applied.
UK VATVAT at the standard, reduced or zero rate, added to a net price or extracted from a gross one.
Canada GST HST PSTFederal GST with a provincial layer on top, covering GST-only, GST plus PST and harmonised HST provinces.
Salary TDSMonthly salary TDS from your estimated annual tax, adjusted for what has already been deducted.
Contractor TDSTDS on contract payments at the individual or company rate, tested against the threshold.

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

Built and maintained by .

How this calculator is tested

6,730 automated cases pass, run against the engine this calculator shares with 5 related calculators; last run 30 September 2026.

Test cases by kind
Independent cross-check68expected values published elsewhere, or reached by a second method
Golden19worked by hand, the arithmetic written into the test
Boundary18zero, negative, extreme and invalid inputs
Property6,600rules that must hold for any input
Structural25every output present and finite

Full verification report for this calculator

What's changed (5 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.
  4. Frequently Asked Questions now show on the page: 6 answers, checked in a page-by-page audit.
  5. What the calculation assumes and where it stops now show on the page.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.