Average Cost Calculator for Stocks, Cryptos, or Inventories

This page contains links to our partners. RBD may be compensated when a link is clicked. Read disclosures.

This page and spreadsheet provide a free average cost calculator for a group of stock or crypto purchases. You can also calculate the average cost of items such as sales inventory.

In stock investing, the average cost is essentially the same as a weighted average. The average cost is your cost basis.

Cost basis is important because it is used to calculate your tax burden upon a sale that produces a capital gain.

This article explains the average cost calculator formula and shows examples of calculating the average cost for a set of stock purchases, cryptocurrencies, and product inventory.

There’s a free spreadsheet at the bottom that you can download, giving you four different average cost calculator options (four tabs).

There is no email required to download the spreadsheet. Just click the big green button at the bottom or any spreadsheet screenshot to download for free. 

Average Cost Formula

For stocks, the formula we use for the average cost calculator spreadsheet is as follows: 

Average cost = total cost/number of shares. 

For cryptocurrencies, the calculation is essentially the same, but the terminology is different. 

Average cost = total cost/total coins acquired

For inventories, the average cost formula is the same:

Average cost = total cost/quantity of units produced

Average Cost Calculator for Stocks (Cost Basis Calculator)

The average cost formula is the same if you buy one lot of shares or 20.

But there are two methods to calculate the average cost, and I’ll show both examples here. 

Stocks Example #1

Step 1: To get the average cost, list the number of shares purchased and the cost of those shares for each lot. They may also be referred to as “tax lots.”

A “lot” is one stock trade. Round lots are 100 shares or divisible by 100. But lots can be uneven numbers or fractional shares. 

Step 2: Add the total number of shares.

Step 3: Add the total cost of all trades. 

Step 4: Divide the total cost by the total number of shares to to calculate the average cost. 

Here’s a simple average cost calculation for “XYZ” stock holding with two separate lot purchases. 

Lot #1
60 shares costing $15 per share. 

Lot #2
40 shares costing $18 per share


Number of shares = 60 + 40 = 100
Cost of Lot #1 = 60*15 = $900 
Cost of Lot #2 = 40*18 = $720 

Total cost = $1,620

In this example, there are 100 shares at a total cost of $1,620 (720+900).

Divide the total cost by the total number of shares. 

= 1620/100 = $16.20

The average cost per share is $16.20.

Here’s what it looks like in the spreadsheet:

Average cost calculator spreadsheet, stock method 1.

Stocks Example #2

Another way to calculate the average cost is to weigh each lot’s cost per share, then add the total.

This method can be tedious if you have many lots. However, using a spreadsheet, it’s easy. 

We’ll use the same example as above. 

Lot #1
60 shares costing $15 per share. 

Lot #2
40 shares costing $18 per share

Step 1: Calculate the price weight of the first lot.

To do this, divide the number of shares in the lot (60) by total shares (100) to get a percentage. Then multiply the percentage by the price per share. 

= (60/100) * 15 = 9

Step 2: Calculate the price weight of the second lot.

Same as Step 1. 

= (40/100) * 18 = 7.2

Step 3: Add the weighted price of each lot. 

= 9 + 7.2 = 16.2

We get the same answer as in example #1.

Here’s what it looks like in the average cost calculator spreadsheet:

Average cost calculator spreadsheet, stock method 2.

Crypto Average Calculator

The average cost calculation for cryptos I’ve used in this example is the same as the stock method #1. Using this spreadsheet will give you the average cost, or cost basis, for a series of cryptocurrency purchases, such as Bitcoin, Dogecoin, Ethereum, etc. 

I’ve used approximate Bitcoin numbers dating to about May 2021, when Bitcoin traded between $30,000 and $60,000.

Average cost calculator cryptocurrency spreadsheet example.


Average Cost Calculator for Inventories

The average cost calculation for inventories is the same as stocks and cryptos. In the spreadsheet, I’ve changed the headings. You can call them whatever you like. 

Average cost calculator inventory spreadsheet example

Average Cost Calculator Excel Spreadsheet

The spreadsheet I used to make these screenshots is available for free download. There are no restrictions or locking on the fields, so you may modify the cells as you like.

But you might want to save a copy of the original in case you need to start fresh.  

Here’s a link to the free average cost calculator Excel spreadsheet (the download does not require your email address). The spreadsheet includes the stock average calculator, crypto average calculator, and inventory cost calculator on separate tabs. 

Average Cost Calculator Spreadsheet

Feedback? Contact me.

Favorite tools and investment services right now:

Sure Dividend — Download the free Dividend Kings list, 50+ stocks with 50+ consecutive years of dividend increases. (review)

Fundrise — Simple real estate and venture capital investing for as little as $10. (review)

NewRetirement — Spreadsheets are insufficient. Get serious about planning for retirement. (review)

M1 Finance — A top online broker for long-term investors and dividend reinvestment. (review)