Skip to content
Calculator Tools
Stock Calculators

Cost Basis Calculator

Cost basis and gain for shares sold using FIFO or average cost across several purchase lots.

Enter values

Results update as you type.

Result

Cost basis of shares sold

$5,150.00

Capital gain
$1,100.00
Proceeds
$6,250.00
Basis per share
$103.00

About the Cost Basis Calculator

Cost basis and gain for shares sold using FIFO or average cost across several purchase lots.

Also known as: tax basis, fifo cost basis, average cost basis, capital gain basis.

How to use this calculator

  1. Enter purchase lots: shares, price per share (oldest first), shares sold, sale price per share, method.
  2. The result updates instantly as you type — press Calculate (or Enter) at any time.
  3. Review the breakdown shown under the main result.
  4. Use Copy result or Share to save the answer or send a link with your inputs.

Formula

FIFO: earliest lots are sold first

Worked example

Using the values pre-filled in the calculator above:

  • Purchase lots: shares, price per share (oldest first): 40, 100 30, 115 30, 90
  • Shares sold = 50
  • Sale price per share = 125
  • Method: FIFO

the calculator returns:

  • Cost basis of shares sold: 5,150
  • Capital gain: 1,100
  • Proceeds: 6,250
  • Basis per share: 103