Finance Calculator

Cost Basis Calculator

Combine several purchase lots to find total shares, total cost, and average cost per share.

Enter purchase lots

One lot per line or comma-separated as shares@price (example: 50@40, 25@48).

Clear

About this calculator

How to use Cost Basis Calculator, plus the formulas and logic behind the results.

Tool description

Average cost basis divides total dollars invested by total shares acquired across lots. Tax methods (FIFO, specific ID) may differ from average cost.

How to use

  1. List each lot as shares@price.
  2. Separate lots with commas, spaces, or new lines.
  3. Select Calculate to view totals and average cost.
  4. Use the average for educational tracking—not as tax advice.

Formulas & reference

  • Lot cost = Shares × Price
  • Total cost = Σ lot costs
  • Total shares = Σ shares
  • Average cost = Total cost ÷ Total shares

Lot format

  • Example: 100@25.50
  • Multiple lots: 40@10, 60@12
  • Shares and price must be positive
  • Average cost ≠ always tax basis method

Calculation logic

Each shares@price pair is parsed; costs and shares are summed; average equals total cost divided by total shares.

Brokerage tax lots may use FIFO or specific identification instead of average cost.

Cost Basis Calculator FAQ

Common questions about the calculation and how to interpret the estimate.

How do I enter lots?

Use shares@price for each purchase, separated by commas or line breaks.

What is average cost basis?

Total amount paid divided by total shares owned.

Does this include fees?

Not automatically—raise the price slightly or add fee dollars into a lot if needed.

Is average cost used for taxes?

Some accounts allow average cost; others require FIFO or specific lots—check your broker/tax rules.

Can I mix fractional shares?

Yes, if shares and prices are valid positive numbers.

What if a lot fails to parse?

Invalid tokens are skipped; at least one valid lot is required.