Stock Average Cost Calculator: Cost Basis and Gain

Use this stock average cost calculator to combine several purchases into one average price per share and see your cost basis and unrealized gain or loss.

Average cost per share–
Total shares–
Total cost basis–
Market value–
Unrealized gain / loss–
Gain / loss %–

Works for stocks, ETFs, crypto and gold. Include commissions in the price for an exact cost basis; leave unused rows at 0.

Average cost formula

Average cost = (Shares₁ × Price₁ + Shares₂ × Price₂ + …) ÷ Total shares

This is a weighted average: larger purchases have more influence on the result.

Stock average example

Buy Shares Price Amount
1 10 $180 $1,800
2 5 $150 $750
3 8 $165 $1,320
Total 23 $3,870
  • Average cost: $3,870 ÷ 23 ≈ $168.26 per share
  • At a current price of $172, the position is worth $3,956, an unrealized gain of $86 (about 2.2%).

Before you average down

  1. Re-check the thesis: has anything fundamental changed? See how to analyze stocks with P/E and P/B ratios.
  2. Limit position size: keep any single stock a modest share of your portfolio — asset allocation and diversification.
  3. Consider dollar-cost averaging: investing a fixed amount on a schedule removes the guesswork.

To see your annualized return on a position, use the ROI calculator. Track markets on our stock market page.

Frequently Asked Questions

How is the average cost per share calculated?

Add up the total amount paid for all purchases and divide by the total number of shares. 10 shares at $180, 5 at $150 and 8 at $165 average about $168.26 per share.

What is averaging down?

Buying more shares after a price drop lowers your average cost. It also increases your exposure to that stock, so it only makes sense if your original thesis still holds.

Does the IRS use average cost?

Average cost is allowed for mutual funds and many dividend reinvestment plans. For individual stocks brokers usually default to FIFO unless you choose specific lots.

This content is for general information only and is not investment advice. Consider your own situation and consult a licensed professional before making financial decisions.