Stock Average Calculator – Calculate Cost Basis

Calculate the average price paid for multiple stock purchases. You can average down up to 25 purchases at once and calculate the total purchase price.

# of Shares Price per Share


Average Share Price:
Total Shares:
Total Cost:
Learn how we calculated this below

scroll down

On this page:

How to Calculate Cost Basis for Stocks

The cost basis of stocks is the amount that was initially invested. It is used to calculate the profit on that investment as well as how much taxes are owed once the investment is sold.

As an investment grows over time, its cost basis remains the same. The only change would occur if additional shares of the investment are purchased.

The reason the cost basis is used for tax purposes is that you only pay taxes on the capital gains (the increase in the stocks’ value at the time it is sold) and not on the entire investment value.

For example, if you purchase 100 shares of a stock at $10 each, the cost basis would be $1,000. Let’s say the shares then increase to $15 and your investment becomes $1,500.

Your capital gain is $500 ($1,500 – $1,000) so you would only pay taxes on the $500 and not the $1,500.

Cost Basis Formula

The stock average calculator will automatically calculate the cost basis for you. The cost basis formula uses the average price bought per stock.

Put another way, it takes the total cost initially paid for the stocks and divides it by the total number of shares bought.

average cost per share = (p1 × s1) + (p2 × s2) + … + (pn × sn) / s1 + s2 + … + sn

p = price per share
s = number of shares

This is essentially just a weighted average and uses the same formula that our weighted average calculator uses. Our mean calculator uses the same method but requires you to list out the numbers.

Let’s use an example to see how it works.

Let’s say you purchased stocks over the next four months as outlined in the table below. We can use this to calculate the total cost basis, total shares, and then average share price.

Month # of Shares Price per Share
1 10 $105.00
2 6 $112.00
3 16 $107.00
4 12 $117.00

To calculate cost basis, multiply the number of shares by the price per share each month. Then add up the amount for each month to arrive at the total.

month 1 = 10 × $105 = $1,050
month 2 = 6 × $112 = $672
month 3 = 16 × $107 = $1,712
month 4 = 12 × $117 = $1,404
cost basis = $1,050 + $672 + $1,712 + $1,404 = $4,838

You can find the total number of shares by adding up the amounts in the middle column of the table.

total shares = 10 + 6 + 16 + 12 = 44

The average share price is then found by dividing the total cost by the total shares.

average share price = $4,838 ÷ 44 = $109.95

How to Use Cost Basis When Trading Stocks

The average share price calculation above shows that when the share price is trading above $109.95, your investment has increased. If it is trading below $109.95, you have lost money on your investment.

If you make no more trades and then sell all stocks two years later for $130 per share, you would only owe taxes on the profit. We know you would make a profit because you sold above the average share price of $109.95.

In this scenario, you would receive $5,720 from selling the 44 shares.

Since your cost basis is $4,838, the profit is $882. The profit can also be found by taking the difference between the selling price and average share price and multiplying by the number of shares.

44 × ($130 – $109.95)
44 × $20.05

You can use our stock profit/loss calculator to calculate the profit of an investment purchase with commissions and how to account for capital gains taxes.

Why Average Down?

The benefit of averaging down is that you are buying a stock at a lower price than it normally would be, which allows a lower break-even price.

If you have bought the stock at a low price, and the stock price increases to where it initially was, you have made money even though the stock value has increased to its original level.

Let’s use another example to show this using the below table.

Month # of Shares Price per Share
1 10 $100.00
2 10 $90.00
3 10 $80.00
4 10 $90.00
5 10 $100.00

Each month you buy 10 shares even though the price is initially falling and then rising the last few months. You can use the stock average calculator above to find that the cost basis is $4,600 and the average share price is $92.

Since the stock is currently trading at $100, we know that you have made a profit even though the stock price began and ended at $100. If you had just purchased the stock at the outset and didn’t average down, then your average share price would be $100, and you would have broken even.

Instead, you now have a profit of $400.

The flip side is that if the stock continues falling and never comes back up, you will have a lower average share price, but you will have lost money. You benefit when the share price increases to its original value.

This is not financial advice or a guarantee of success, so be sure to consult with a financial professional and understand the risk associated with stocks before investing.

You might also be interested in our bond price calculator.

Frequently Asked Questions

How do you calculate the cost basis of old stock?

Calculating the cost basis of older stock is the same as any stock you would purchase now. However, if you are unsure of the stock price at the time of purchase, you can call your brokerage to find out.

If your brokerage does not have the pricing, you can always check a stock market website, such as, to look at historical stock prices.

Is cost basis the same as capital gains?

The cost basis is the amount that was initially invested in stocks, which is not the same as capital gains. Cost basis is used to calculate capital gains, however, capital gains are the total profit made on stocks.

This means that your capital gains would be your total stock value at the time of sale less the cost basis, which equals the total profit.

Do you pay taxes on cost basis?

You do not pay taxes on cost basis. Instead you pay taxes on capital gains which is the total value of the stock at the time of sale less the cost basis, which is the same as the total profit made.

Is it better to have a lower cost basis?

If the price of a stock owned has increased significantly over time, a lower cost basis means that the investor is profiting more at the time of the sale. However, this also means that the investors’ capital gains are higher and they will be paying more in taxes, since taxes are paid on capital gains and not the stock basis.