Categories
Stock Average & Cost Basis

How to Calculate Average Stock Price When You Buy at Different Prices

Most investors do not buy a stock all at once and sell it all at once. They buy incrementally — adding shares on dips, investing monthly contributions, or building a position gradually over time. Each purchase happens at a different price. This creates the central question every multi-purchase investor faces: what is my average price, and how do I use it to calculate my true profit or loss?

Calculating average stock price incorrectly is one of the most common accounting errors individual investors make. Using the wrong average leads to inaccurate profit calculations, wrong break-even assessments, and poor exit decisions. This guide gives you the exact formula and walks through real examples including two purchases, three purchases, and complex scenarios where shares have been partially sold between buys.

The Weighted Average Price Formula

The correct method for calculating average stock price across multiple purchases is the weighted average, which accounts for the fact that different purchases involved different numbers of shares:

Average Price = Total Amount Invested / Total Shares Owned

Or equivalently: Average Price = Σ(Price × Shares at that Price) / Total Shares

Do not simply average the prices you paid. A simple arithmetic average of the prices ignores the fact that you may have bought more shares at one price than another, which changes the true average significantly.

Example 1: Two Purchases at Different Prices

You buy 100 shares at $20.00 and later buy 200 more shares at $15.00.

  • Total Invested = (100 × $20) + (200 × $15) = $2,000 + $3,000 = $5,000
  • Total Shares = 100 + 200 = 300
  • Average Price = $5,000 / 300 = $16.67

Simple arithmetic average of $20 and $15 would give $17.50 — which is wrong because you bought twice as many shares at $15. The weighted average of $16.67 correctly reflects the actual cost per share across your full position.

Example 2: Three Purchases — Classic Dollar Cost Averaging

Month 1: 50 shares at $30. Month 2: 50 shares at $25. Month 3: 50 shares at $20.

  • Total Invested = (50 × $30) + (50 × $25) + (50 × $20) = $1,500 + $1,250 + $1,000 = $3,750
  • Total Shares = 150
  • Average Price = $3,750 / 150 = $25.00

Because the share quantities are equal, the weighted average equals the simple average in this specific case. But this is only because all three purchases involved the same number of shares. In practice, when each purchase involves a different dollar amount (as in DCA where you invest a fixed dollar amount rather than fixed share count), the quantities differ and the weighted average diverges from the simple average.

For more on how DCA affects your average cost over time, see our comparison article: Dollar Cost Averaging vs Lump Sum Investing: Which Strategy Wins in 2025.

Including Commissions in Your Average Cost Calculation

For a truly accurate cost basis, buying commissions should be included in each purchase’s total cost. Commissions paid to buy shares are part of your cost basis — they increase your effective average price and therefore your break-even price.

Example with commissions: Buy 1 (100 shares at $20, $10 commission): Cost = $2,010. Buy 2 (200 shares at $15, $10 commission): Cost = $3,010.

  • Total Cost Basis = $2,010 + $3,010 = $5,020
  • Total Shares = 300
  • Average Cost Per Share (Including Commissions) = $5,020 / 300 = $16.73

Compare this to the $16.67 calculated without commissions — the difference is small in this case but matters for accurate profit and break-even calculations. For full context on how commissions affect your cost basis and break-even, see: Buying Commission vs Selling Commission: How Broker Fees Eat Your Stock Profits.

Calculating Profit or Loss Using Your Average Price

Once you have your average price, calculating profit or loss on the full position uses the same formula as any single trade:

Net Profit = (Sell Price × Total Shares) − Selling Commission − Total Cost Basis

Using the example above, if you sell all 300 shares at $19.00 with a $10 commission:

  • Net Proceeds = (300 × $19.00) − $10 = $5,690
  • Net Profit = $5,690 − $5,020 = $670
  • Return % = ($670 / $5,020) × 100 = 13.35%

For the complete profit and loss calculation framework, see our guide: How to Calculate Stock Profit and Loss Like a Pro.

Average Price After Partial Sells

When you sell part of a position and then buy more, the calculation requires care. In the US, IRS cost basis rules (FIFO, LIFO, or specific identification) determine which shares you sold. Under FIFO (first in, first out — the default), your earliest purchases are considered sold first. Under specific identification, you choose which lots you sell. Each method produces a different remaining cost basis.

Tax treatment of your gains connects directly to the capital gains tax calculation. For a step-by-step guide on calculating taxes on stock profits, see: How to Calculate Capital Gains Tax on Stock Profits.

Using an Average Price Calculator

For positions with many purchases, manual calculation becomes tedious. A free average stock price calculator handles multiple purchase entries instantly. StockCalculator.us provides this tool at no cost — enter each purchase date, price, and share count and the calculator outputs your weighted average price, total cost basis, and break-even price automatically.

See all available free tools in our guide: Top 5 Free Stock Calculators Every Trader Needs in 2025. And to understand when averaging down by adding purchases makes strategic sense, read: What Is Stock Averaging and When Should You Average Down Your Position.

 

Leave a Reply

Your email address will not be published. Required fields are marked *