Average Cost Basis Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 12/5/2026
Average cost = (sum of quantity × purchase price + fees) ÷ total quantity. After buying 10 shares at 50, 15 at 42 and 5 at 60, with 12 in fees, the average cost is 1,442 ÷ 30 ≈ 48.07: above that price, the position is in profit.
Explanation
When you buy the same asset several times at different prices, it becomes hard to tell at a glance whether you are up or down. The average cost per share, or cost basis per unit, answers that: it is the average price each share you hold actually cost you. It is not the simple average of purchase prices but an average weighted by quantity: a large purchase counts more than a small one. So you add up the cost of each purchase, quantity times price, add the brokerage fees, then divide by the total number of shares. Including fees makes it your true break-even price: as long as the market price stays above it, the position shows an unrealized gain; below it, an unrealized loss. The calculator also shows the position's current value and its performance as a percentage of the amount invested. Average cost is central to two common strategies. Dollar-cost averaging, investing a fixed amount at regular intervals, automatically buys more shares when the price is low, which pulls the average cost down. Averaging down, buying more of a falling stock to lower your average cost, is riskier: it increases exposure to a company that may be in trouble. Selling part of a position does not change the average cost of the remaining shares. Tax rules for calculating gains vary by country: some use the average cost, others allow specific lots or first in, first out. Amounts are shown in euros by default but the calculation is the same in any currency. Average cost ignores dividends received: to measure that income, use the dividend yield calculator; for the underlying principle, see the weighted average calculator.
Example: three successive purchases
Inputs
10 shares at 50, 15 shares at 42, 5 shares at 60, 12 in total fees. Current price: 55.
Calculation
Cost = 10 × 50 + 15 × 42 + 5 × 60 + 12 = 500 + 630 + 300 + 12 = 1,442. Quantity = 30. Average cost = 1,442 ÷ 30 ≈ 48.07. Current value = 30 × 55 = 1,650. Unrealized gain = 208, or 208 ÷ 1,442 ≈ 14.42%.
Result
The average cost is 48.07, whereas the simple average of the three prices would be 50.67: the 15 shares bought at 42 weigh more.
Frequently asked questions
Should fees be included in the average cost?
It is common practice and the most useful approach: an average cost including fees shows the price at which the position actually breaks even.
Does a partial sale change the average cost?
No. The remaining shares keep the same average cost; only the quantity held goes down. The average changes only with the next purchase.
Do dividends lower the average cost?
Not in the standard calculation. Some investors track a cost basis "net of dividends" to follow overall returns, but brokers and tax authorities do not use it.