Stock Average Calculator (Cost Basis)

Created by Arturo Barrantes
Reviewed by Anna Szczepanek, PhD and Steven Wooding
Based on research by
Brigham, E.F.; Ehrhardt, M.C. β€œFinancial Management: Theory and Practiceβ€œ (2016)
Last updated: Apr 06, 2022

The fantastic stock average calculator allows you to know the average price at which you bought your stocks. Imagine you just bought the dip, but the dip keeps going, then you buy more: How much did you paid per share in the end? In other words, what is the cost basis of your stocks?

This stock average calculator will tell you the exact value per share, regardless of how many prices you bought at. In this article, we will cover how to calculate the average stock price, how to calculate the stock profit, and we will share real examples while using this excellent stock calculator.

What is the cost basis of a stock?

We will explain it very simply: Cost basis is the average stock price you get after buying shares of one company at different prices. Why is it important? Let's continue reading.

It is an entirely different scenario when you buy ten shares of a stock at a single price. Then you can calculate the stock profit by taking the market value and subtracting it from what you've invested. Also, there is a calculator that gets it done for you: stock calculator.

However, what happens if you want to calculate your stock profit and have the following situation:

Nvidia 5yr revenue growth graph

What happens if AMD stock rises to 100, how much profit have you earned? For answering such a question, first, we need to know the average stock price.

How to calculate average stock price?

For getting the stock average price, we need to know exactly how many shares we bought at their respective share price. Then the formulas required will be:

Cost basis = (p1 * q1 + p2 * q2 + ... + pi * qi) / n


  • n = q1 + q2 + ... + qi β€” Total number of shares bought;

  • q1 β€” Number of shares 1st buy;

  • p1 β€” Shares purchase price 1st buy;

  • q2 β€” Number of shares 2nd buy;

  • p2 β€” Shares purchase price 2nd buy;

  • qi β€” Number of shares last buy; and

  • pi β€” Shares purchase price last buy.

If you're familiar with the notion of weighted average, you've most probably noticed that the cost basis is precisely the weighted average of consecutive prices, with the weights given by the number of shares bought at each step.

Now, we will take the previous example and determine the average stock price.

  • p1 = 85 USD

  • q1 = 1

  • p2 = 84 USD

  • q2 = 1

  • p3 = 83 USD

  • q3 = 1

  • p4 = 75 USD

  • q4 = 1

  • p5 = 77 USD

  • q5 = 1

  • p6 = 75.5 USD

  • q6 = 1

Then, the total number of shares is:

  • n = 6

Consequently, the average stock price, or the stock cost basis, is:

  • Cost basis = 79.92 USD

If you want to verify this result quickly, go and run this stunning stock average calculator with the same presented values.

How to calculate stock profit or loss?

Once we've obtained the cost basis of our stock, we have to perform one more calculation to get the stock profit. Here is the formula:

Stock profit = (Current stock price - Cost basis) * n

Let's suppose today, AMD stock climbed to $100 USD per share. Then,

Stock profit = ($100 USD - $79.92 USD) * 6

Stock profit = $120.50 USD

Suppose you want a more in-depth calculator which includes brokerage fees. In that case, you have to go to our famous stock calculator, already mentioned above.

But Arturo, what about stock profit in percentage? We thought you would need it too, so you only have to include the current stock price in the average stock price calculator. We hope when you do this calculation, you get 100% profit or more. 🀞

Profit percentage = ((Current stock price- Cost basis)/Cost basis)*100%

Profit percentage = ((100 USD- 79.92 USD)/79.92 USD)*100%

Profit percentage = 25.13%

Besides, because we have already mentioned profits, we can't end our calculator without mentioning the dividends and its performance. So, how to calculate the stock profit, including dividends? You have to go to our dividend calculator and, in the share price section, put the cost basis value.

Finally, we highly recommend you visit our set of financial tools. There you will be able to understand what drives a stock price increase with our insightful revenue growth calculator, operating cash flow calculator, among others.


How important is to know how to calculate the average stock price?

To know how to calculate the average stock price is a key ability for investors that can be used when you have bought shares of a company at different prices. This is also known as cost basis. Imagine you manage to average down your initial stock purchase, then you reduce your risk by having an asset purchased at a lower price.

How to use cost basis for investing?

  1. First calculate the cost basis also known as stock average price at which you have already purchased your shares.
  2. If you are convinced about the company excellence, build up the position by buying more shares at lower prices, if possible.
  3. Define your new cost basis, including the effect of the new shares.
  4. Obtain your new upside or downside or unrealized capital gain.
  5. Calculate your new dividend yield, if any.

What is a good stock cost basis?

A great stock cost basis is the one that is lower than the current price of the asset. Here, the recommendation is to use market volatility for getting your shares at lower prices, building a position by layers. Do not forget that markets work in cycles, so there usually will be another opportunity for reducing your cost basis.

How to calculate average stock price/cost basis?

  1. First, get all the times you bought shares of a company. Separate them by their respective price and amount.
  2. Second, obtain the total cost of each of your investments in that company. Here you have to multiply each price and its respective number of shares. Then sum it up.
  3. After completion of step two, you have total investment cost in that company. Now, divide it between the total number of shares you have.
  4. The result of such math operation is your stock average or cost basis.
Arturo Barrantes
Number of shares bought and their prices
Number of shares 1st buy
Shares purchase price 1st buy
Number of shares 2nd buy
Shares purchase price 2nd buy
Current stock price
Enter at least 2 price values and shares quantity.
Check out 145 similar investment calculators πŸ“ˆ
401kAfter-tax cost of debtAltman Z-Score… 142 more
People also viewed…

Black Hole Collision Calculator

The Black Hole Collision Calculator lets you see the effects of a black hole collision, as well as revealing some of the mysteries of black holes, come on in and enjoy!

Flat vs. round Earth

Omni's not-flat Earth calculator helps you perform three experiments that prove the world is round.

Lemonade Stand

The lemonade stand calculator is your best tool for when you want to start a lemonade stand business. It helps you determine the right price for your lemonade based on the costs you have incurred and your target profit.

Refinance break even

Apply the refinance break even calculator to find the date when savings resulting from loan refinancing pays off its costs.
Omni Calculator
Copyright by Omni Calculator sp. z o.o.
Privacy policy & cookies
main background