Average Cost Calculator

Enter your purchases at different times and prices to calculate your average cost basis and your unrealized gain or loss.

When should you use this calculator?

When you buy stocks, ETFs or cryptocurrencies across several trades at different prices, your average cost basis (also called "average cost") is the single equivalent price that summarizes all your purchases.

Legal context in Spain

Buying periodically regardless of price is known as "dollar-cost averaging" (DCA), and it aims to reduce the impact of putting all your money in at the worst possible moment.

The average cost is the reference you should use to know whether your investment is up or down, and it's usually also the basis for calculating your taxable gain when you sell part of your holdings (FIFO or other methods, depending on your country's rules).

The result is a mathematical calculation based on the entered data and doesn't include purchase fees or the tax treatment, which varies by country of residence.

Frequently asked questions

What is average cost basis?

It's the single equivalent price that summarizes several purchases made at different prices, calculated as the total amount invested divided by the total number of units bought.

Why does buying at different times change my average cost?

Because each purchase happens at a different price; averaging all purchases weighted by the quantity bought in each one means the result depends on how much you bought and at what price each time.

What is dollar-cost averaging (DCA)?

It's an investment strategy of investing a fixed amount periodically (e.g., every month) instead of investing all your capital at once, aiming to smooth out the effect of purchase-price volatility.

Does this calculator work for both stocks and crypto?

Yes, the average cost calculation is the same regardless of the asset type: stocks, ETFs, funds or cryptocurrencies.

How is unrealized gain or loss calculated?

It's calculated by multiplying your total units by the current price, then subtracting the total amount you invested across all purchases. It's "unrealized" because you haven't sold yet.

Does this calculator account for purchase fees?

Not automatically. For a more precise result, you can add the fee you paid to the per-unit price of each purchase before entering it.