How this calculator works
Before any sale, your average cost is everything you paid, fees included, divided by the shares you bought. Each new buy pulls the average toward its price, weighted by how many shares it adds.
With the rows already in the table, 45.5 shares bought over a year cost 5,365.5 with fees, an average of 117.92. After selling 10 at 130, the average cost of the rest stays at 117.92, while first in, first out (FIFO) puts it at 108.86: the 10 that left first were the ones bought at 150.
Under the average cost method, selling doesn’t change what each share you keep cost. Under FIFO it does, because the oldest shares leave first, so the calculator shows both.
Why your broker shows another number
In the US, the default for taxes on stocks is first in, first out (FIFO), and the average cost is the usual default for mutual funds. Some brokers leave fees out of the average, and a badly logged split, a transfer from another broker or selling everything can reset it. The average cost tells you what you paid per share. FIFO is closer to what the tax form will say.
Averaging down: the math and the trap
Buying more at a lower price brings your average down, and the second tab tells you how many shares it takes. A lower average makes the position feel better, but the business is the same one it was yesterday. If the price fell because the company is getting weaker, every new share makes the bet bigger, so the second tab also shows how big the position gets and what another fall would cost.
What an average doesn’t see
Five things can make your average lie.
- Fees. Leave them out and your average looks lower than what you really paid. The fee to sell matters too: the break-even price here counts both.
- Splits and reverse splits. After a 2-for-1 split you hold twice the shares at half the price. If an app logs it as free shares, the average still looks right, but the new shares get a zero cost and a new date, and FIFO and the holding period come out wrong. Add the split as its own row.
- Reinvested dividends. Each one is a small buy. In a taxable US account, leave them out and you pay tax twice on the same money: once as a dividend, and again when you sell.
- A move to another broker. The new broker may not get your old cost. Keep the old statements and add those rows by hand, with their original dates and prices.
- Another currency. If you buy a US stock with euros or pounds, your real average depends on the exchange rate of each buy. Tick “I bought in another currency” to see both.
The full list of what I correct in my own numbers is on the Method page.
Questions people ask
How do I calculate my average stock price?
Add up what you paid for every buy, fees included, and divide by the shares you bought. In a spreadsheet: =(SUMPRODUCT(shares, prices) + SUM(fees)) / SUM(shares).
Does selling change my average cost?
Not under the average cost method: the shares you keep cost the same per share. Under first in, first out (FIFO) it does, because the oldest shares leave first.
How many shares do I need to buy to lower my average?
Shares needed = (shares you own × (average now − target) + fee) ÷ (target − price you’d pay). The target has to sit between the price and your average now. The second tab does it for you.
What is a break-even price?
The price where selling gives you back exactly what you put in. Here it counts the fees you paid to buy and the fee to sell.
How do splits affect my average?
A split changes the number of shares and leaves what you paid the same. After a 2-for-1 split your average halves; after a 1-for-10 reverse split it’s ten times higher.