Skip to content
OverCalculator
  1. Home
  2. Financial
  3. Stock Average (Cost Basis) Calculator
Financial

Stock Average (Cost Basis) Calculator

Calculate weighted average stock cost, total shares, total cost basis, market value, unrealized profit or loss, and return from multiple purchase lots.

Published

Average cost
Weighted average cost per share
$88.33
Total shares
30
Total cost basis
$2,650.00
Market value
$2,850.00
Unrealized profit/loss
$200.00
Unrealized return
7.55%
Lot breakdown
Lot 1
10 × $100.00 = $1,000.00
Lot 2
5 × $90.00 = $450.00
Lot 3
15 × $80.00 = $1,200.00

Average cost is total cost basis divided by total shares. At $95.00, this position is $200.00 from cost basis.

Optional market price used to estimate unrealized profit or loss.
$
Purchase lots
Purchase lots 1
$
Purchase lots 2
$
Purchase lots 3
$

Results update as you type.

Stock Average (Cost Basis) Calculator

The stock average calculator finds the weighted average cost per share across multiple purchase lots. Enter each lot’s share count and purchase price, then enter a current stock price if you want an unrealized profit or loss estimate. The result includes total shares, total cost basis, market value, unrealized profit or loss, and unrealized return. It is informational only and is not trading advice or tax advice.

This page is about position arithmetic, not technical signals. If you are studying chart levels, use the RSI calculator, moving average calculator, or pivot point calculator. If a corporate action has changed your shares, use the stock split calculator before comparing per-share values. For a selling scenario, the stock calculator can help with broader stock return inputs.

What the inputs mean

Each purchase lot has two fields: shares bought and price per share. The calculator accepts fractional shares up to the precision supported by the calculator, so it can handle dividend reinvestment or fractional brokerage purchases. It requires each counted lot to have shares greater than zero and a price that is zero or positive. The current stock price is used only for market value and unrealized return. It does not change the average cost.

One calculation detail matters: invalid lot rows are skipped rather than causing the whole result to fail. If one row has zero shares, a negative price, or a non-number, the calculator ignores that row and still uses the remaining valid rows. If all rows are invalid or total shares are zero, it returns an invalid result.

Formula

Scope: The equations below describe arithmetic for this scenario, not a sourced legal, tax, lending, investment-performance, health, payroll, accounting, or policy standard. Inputs are user assumptions; the calculation defines its own conditions and rounding rules.

Total cost basis is the sum of every counted lot’s shares times its price:

total cost basis=(shares in lot×price in lot)\text{total cost basis} = \sum(\text{shares in lot} \times \text{price in lot})

Weighted average cost per share is:

average cost=total cost basistotal shares\text{average cost} = \frac{\text{total cost basis}}{\text{total shares}}

Market value at the current price is:

market value=current price×total shares\text{market value} = \text{current price} \times \text{total shares}

Unrealized profit or loss and return are:

unrealized profit or loss=market valuetotal cost basis\text{unrealized profit or loss} = \text{market value} - \text{total cost basis}

unrealized return=unrealized profit or losstotal cost basis×100%\text{unrealized return} = \frac{\text{unrealized profit or loss}}{\text{total cost basis}} \times 100\%

The calculatorula is weighted because a large purchase should influence average cost more than a small purchase. Buying 100 shares at one price and 1 share at another should not be treated as a simple two-price average.

Checking the primary result

Use the default lots: 10 shares at 100, 5 shares at 90, and 15 shares at 80. The first lot costs 1,000. The second costs 450. The third costs 1,200. Total cost basis is 2,650 and total shares are 30. The weighted average cost is 2,650 divided by 30, or 88.33 per share when displayed as currency.

With the default current price of 95, market value is 95 times 30, or 2,850.00. Unrealized profit or loss is 2,850 minus 2,650, or 200.00. Unrealized return is 200 divided by 2,650, times 100, or about 7.55%. The lot breakdown shows each counted lot in the calculatorat shares times price equals cost, matching the component’s calculation.

Now suppose a fourth row accidentally has zero shares at 70. The calculation method does not add it to total shares or total cost. The average remains 88.33 because zero-share rows are skipped. That behavior is convenient for editing a list, but you should remove bad rows before saving or sharing results so the calculation is easy to audit.

How investors use average cost

Average cost helps answer practical questions: what price would bring the position back to breakeven before taxes and fees, how much exposure has been added by averaging down, and how far the current market price sits above or below the blended entry. It can also help compare planned purchases. Buying more below the current average lowers the average cost, while buying above it raises the average cost.

That does not make additional buying safer. Averaging down can concentrate risk in a declining security. Averaging up can add exposure after a strong move. A lower average cost may feel better psychologically, but the portfolio still depends on future market prices, business fundamentals, liquidity, and your time horizon. Past purchase prices do not predict future returns.

For taxes, treat this calculator as a rough reconciliation tool. Brokerage statements may adjust basis for wash sales, corporate actions, reinvested dividends, commissions, returns of capital, or transfers between accounts. Different tax lots may also have different holding periods. Before filing, compare the result with official broker records and relevant tax guidance.

Common mistakes

  • Averaging the prices themselves instead of weighting each price by shares.
  • Forgetting fees or commissions when they are part of your basis.
  • Mixing different tickers, share classes, or accounts in one calculation.
  • Using split-adjusted prices with unadjusted share counts, or the reverse.
  • Treating unrealized profit as locked in before an actual sale.

Sources

No external document is asserted as authority for this calculator’s arithmetic, branch policy, thresholds, rounding, or result interpretation. Add only sources whose frozen exact passage directly supports a separately mapped bounded claim.

Frequently asked questions

How does this calculator find average stock cost?
It multiplies each valid lot's shares by its purchase price, adds those costs, and divides by total valid shares. Larger purchases therefore carry more weight than smaller purchases. It is a weighted average, not a simple average of the purchase prices.
Does this equal my official tax basis?
Not necessarily. The calculator is a simplified cost-basis estimate from shares and prices you enter. Official tax basis can be affected by commissions, wash sales, reinvested dividends, gifts, inherited shares, returns of capital, splits, broker elections, and other adjustments.
How is unrealized profit or loss calculated?
The calculator multiplies current price by total shares to estimate market value, then subtracts total cost basis. A positive number is an unrealized gain before selling costs and taxes; a negative number is an unrealized loss before any sale occurs.
Does averaging down reduce investment risk?
No. Buying more shares at a lower price can reduce average cost, but it also increases exposure to the same security. If the business or market keeps deteriorating, a lower average price does not prevent further losses.

Related calculators

Stock Average (Cost Basis) Calculator updated at