Quick answer
What is the weighted average stock price formula?
Add the purchase value of every lot and divide by Total shares. This produces Weighted average buy price before commissions. Add all Buy commissions before dividing when you need Average cost basis per share.

- 1
Enter each purchase separately. Purchase 1 records 40 shares at $80 instead of averaging prices by hand.
- 2
Keep commissions with their lots. Each buy fee is included in Total cost basis but remains separate from Weighted average buy price.
- 3
Add every share quantity and price. Purchase 2 contributes 60 shares at $100, so the price average is weighted by share count.
- 4
Read the combined summary. The calculator reports 100 shares, a $92 weighted price, $10 in fees, and $9,210 Total cost basis.
Three-purchase example
Average three purchases without averaging the prices directly
Buy 50 shares at $80, 30 shares at $100, and 20 shares at $120. Each purchase has a $5 commission.
Calculate purchase value
50 x $80 = $4,000.
Calculate purchase value
30 x $100 = $3,000.
Calculate purchase value
20 x $120 = $2,400.
Add values and shares
$9,400 purchase value across 100 shares.
Divide value by shares
$9,400 / 100 = $94.00.
Include commissions
($9,400 + $15) / 100 = $94.15.
Position summary
Weighted price is $94; basis is $94.15 per share
The simple average of $80, $100, and $120 is $100, but it overstates the purchase price because half the shares were bought at $80.
- Total shares
- 100
- Purchase value
- $9,400.00
- Buy commissions
- $15.00
- Weighted average buy price
- $94.00
- Average basis per share
- $94.15
Full-position sale
Sell the combined position at $110 per share
Selling all 100 shares at $110 with a $10 Sell commission produces $10,990 in Net proceeds.
Net profit is $10,990 - $9,415 = $1,575. ROI is $1,575 / $9,415 x 100 = 16.73%. The calculator keeps the $94 Weighted average buy price separate from the $94.15 average basis per share so the commission is not hidden.
For the complete workflow, see How to Calculate Stock Profit with Multiple Purchases.
Partial-sale distinction
Position averages do not replace lot allocation
The weighted average describes the combined position, but a partial sale may use a specific subset of purchase lots.
Full-position sale
Every remaining lot is sold, so all remaining basis enters the realized result.
FIFO partial sale
The oldest remaining shares and their proportional commissions are assigned first.
LIFO partial sale
The newest remaining shares and their proportional commissions are assigned first.
Specific lots
Only the explicitly entered quantity from each eligible lot supplies the sale.
Compare the methods in FIFO vs LIFO Stock Sale Profit.
Accuracy checks
Avoid these average-cost mistakes
Averaging prices
Do not add the quoted prices and divide by the number of purchases unless every lot contains the same number of shares.
Dropping commissions
Weighted average buy price excludes commissions; total and per-share cost basis include them.
Rounding each lot
Keep every purchase value and commission unrounded until the final displayed result.
Using average basis as tax advice
The calculator's average is a mathematical position summary. Brokerage and tax-lot reporting rules may require separate lot records.
Methodology and references
Preserve the separate purchase-lot records
A combined average is useful for understanding the position, but it should not erase acquisition dates, individual costs, commissions, or the shares remaining in each lot.
Ready to calculate your weighted stock cost?
Use the Stock Profit Calculator