Stock Average Calculator
Calculate your weighted average purchase price, total position cost, and unrealized gain or loss across multiple stock buys.
Position inputs
Live results
Purchase breakdown
| Buy | Shares | Price per share | Purchase cost | Share of position | Running average |
|---|---|---|---|---|---|
| Buy 1 | 10 | $50.00 | $500.00 | 33.33% | $50.00 |
| Buy 2 | 8 | $45.00 | $360.00 | 26.67% | $47.78 |
| Buy 3 | 12 | $40.00 | $480.00 | 40.00% | $44.67 |
How to use the stock average calculator
What this calculator does
This calculator finds the weighted average price paid for shares purchased in separate transactions. It combines each purchase price with the number of shares bought, so larger purchases have more influence than smaller ones. The result is an estimated per-share cost basis before brokerage fees, taxes, wash-sale adjustments, reinvested dividends, splits, transfers, or partial sales. It is useful for position tracking and scenario planning, but it is not a substitute for the tax-lot records maintained by your broker.
When to use it
Use it when you average down or average up, compare a planned purchase with your existing position, reconcile several fills from an order, or estimate the unrealized gain or loss at a current market price. The underlying calculation is a weighted mean; the NIST explanation of weighted means provides useful mathematical background.
How to calculate
- The calculator opens with three demonstration buys and a current price. Review the live results and the immediately available example workbook.
- Replace each Shares and Price value with your own transaction data. Use a period as the decimal separator and do not enter currency symbols.
- Select Add another buy for additional purchases, or remove a row you do not need. At least two complete buys are required.
- Optionally enter Current stock price to calculate current value, unrealized gain or loss, and return on cost.
- Read the average purchase price and supporting metrics, then use Download Excel to save the current validated model. Reset clears the demonstration and all entered rows; Excel export remains unavailable until at least two valid buys are entered again.
Input guide
Current stock price is optional, accepts a nonnegative decimal in USD, and may be left blank. For example, 55.00 values the whole position at $55 per share. A higher current price increases current value, gain, and return; a lower price can produce a loss. Do not paste a dollar sign or scientific notation. Shares is required for every retained buy row and must be greater than zero; fractional shares such as 2.5 are accepted. Increasing shares gives that row more weight in the average. Price is also required and must be zero or greater; 45.00 means $45 per share. A higher purchase price raises the average in proportion to that row's share count. Blank half-completed rows, commas used as decimal separators, negative values, and mixed text are rejected.
Output guide
Average purchase price and Break-even price are the weighted price per share before omitted costs. Total shares is the sum of share quantities, and Total invested is the sum of shares multiplied by price for every buy. Current value equals total shares times current price. Unrealized gain/loss is current value minus total invested; a negative value indicates an unrealized loss. Return on cost expresses that gain or loss as a percentage of total invested. The summary pills show the number of buys, total shares, and position status. In the table, Purchase cost is each row's dollar contribution, Share of position is its percentage of total shares, and Running average shows the weighted average after that transaction.
Worked example
The startup example buys 10 shares at $50, 8 at $45, and 12 at $40. Total invested is (10 × 50) + (8 × 45) + (12 × 40) = $1,340, and total shares are 30. Dividing $1,340 by 30 gives an average purchase price of $44.67. At a current price of $55, the position is worth $1,650 and has an unrealized gain of $310, equal to 23.13% of the amount invested.
How the calculation works
Average price = Σ(shares × purchase price) ÷ Σ(shares)
This is an exact weighted-average identity for the entered purchases. It does not choose tax lots or determine taxable basis after sales. For U.S. tax reporting, review the IRS discussion of investment income and cost basis in Publication 550 and the SEC's investor information on how stock markets and orders work. Broker statements remain the authoritative source for executed quantities, prices, fees, corporate actions, and reportable basis.
Practical interpretation
- Buying below the existing average generally lowers the average; buying above it generally raises the average.
- A low average price is not automatically a good investment outcome. Business quality, valuation, concentration, liquidity, and risk still matter.
- For precise planning, add commissions and fees to purchase cost outside this simplified model, and account for any shares sold or transferred.