numfolio

Stock average calculator

Average cost = total spent on buys (including fees) ÷ total shares. A sale removes shares at the average cost, so the average of the shares you keep does not change.

Last updated:

Calculate

Only the unit of the amounts; no currency conversion is made.
Optional, to see the profit or loss on the remaining quantity.
Average cost (break-even price) $44.17

Average cost $44.17

Remaining quantity
150
Cost of the remaining position
$6,625.00
Total fees
$0.00
Realized profit/loss (sales)
$0.00

Buy fees are added to the cost; a sale removes the average cost of the quantity sold. The calculation uses the same rule as the Numfolio transaction ledger.

How to calculate your average cost per share

When you buy the same stock several times at different prices, your average cost is the total amount you spent divided by the total number of shares you own. Buy fees (commissions) are part of what you spent, so they are added to the cost.

Average cost = Σ (shares × price + fee) ÷ total shares

Example: two purchases

Say you first buy 100 shares at 40.00 and later 50 more at 52.50, with no fees:

  • Total cost: 100 × 40.00 + 50 × 52.50 = 4,000.00 + 2,625.00 = 6,625.00
  • Total shares: 150
  • Average cost: 6,625.00 ÷ 150 ≈ 44.17 per share

Whenever the share price is above 44.17, the position is in profit. That price is your break-even price: the point at which you neither gain nor lose before selling costs.

Does selling shares change your average cost?

No. When you sell, the shares you sell are removed at the average cost, and the difference between the sale proceeds and that cost is your realized profit or loss. The average cost of the shares you keep does not change. In the example above, if you sell 60 shares at 55.00, the proceeds are 3,300.00 and the cost of the shares sold is 60 × 44.17 ≈ 2,650.00, so the realized profit is about 650.00. The remaining 90 shares still have an average cost of 44.17. A sell fee is deducted from the proceeds and reduces the realized profit.

Averaging down

Averaging down means buying more of a stock after its price has fallen, which lowers your average cost. Suppose you bought 100 shares at 50.00 and the price drops to 30.00. Buying another 100 shares at 30.00 brings your total cost to 8,000.00 for 200 shares, an average of 40.00. From 30.00, the stock now has to rise about 33% for you to break even instead of about 67%.

The lower average comes at a price: the amount invested in that single stock has grown from 5,000.00 to 8,000.00, and so has your exposure to it. A lower break-even price says nothing about whether the stock will recover. Use the calculator to see the effect of an extra purchase before you make it, and decide based on your plan rather than the average alone.

Using the calculator

On each row, choose the type of trade (buy or sell) and enter the number of shares, the price per share and any fee. Enter the trades in the order they happened; empty rows are ignored. If you add the current price, you will also see the value of the shares you still hold and your unrealized profit or loss. If a sale is larger than the number of shares held at that point, the calculator flags that row.

The calculation follows the same rule as the transaction ledger in the Numfolio app. It works for stocks, ETFs, funds, crypto, gold or currencies alike, as long as all rows belong to the same asset and are entered in the same currency.

Example with buy and sell fees

Buying 100 shares at 20.00 with a 10.00 fee gives a cost basis of 2,010.00 and an average cost of 20.10. If you later sell 40 shares at 25.00 with a 5.00 fee, the net proceeds are 995.00. The cost of the shares sold is 40 × 20.10 = 804.00, so the realized profit is 191.00. The remaining 60 shares have a cost basis of 1,206.00, which is still 20.10 per share. Do not add the sell fee to the cost of the shares you keep as well; it has already reduced the realized profit.

Realized and unrealized profit

Continuing the same example, if you enter a current price of 22.00 for the remaining 60 shares, their value is 1,320.00 and the unrealized profit is 114.00. The 191.00 from the sale is realized: it is locked in. The 114.00 on the shares you still hold can change until you sell them. The two figures measure different things, and changing the current price never changes the realized profit of a past sale. If you leave the current price empty, the calculator still works out costs and past sales but does not value the remaining position.

Why the order of trades matters

The calculator processes rows from top to bottom. Selling before the first purchase, or selling more shares than you held at that time, is not valid. If you buy, then sell, then buy again, the new purchase is combined with the cost of the shares left after the sale. Moving all purchases to the top and all sales to the bottom can change the cost of a past sale, so keep the real order of your trades.

Do not mix different stocks or different currencies in one calculation; convert amounts to a single currency first if you bought the same stock in more than one. Stock splits, bonus shares and other corporate actions are not adjusted automatically. If one of these happened, adjust the share count and cost records accordingly. Some tax systems use other methods, such as matching specific lots, to work out a gain for tax purposes; check the rules that apply to you. The result is a cost calculation of the trades you enter, not investment or tax advice.

Frequently asked questions

How do I calculate my average stock price?

Add up the cost of every purchase (shares × price plus the buy fee) and divide by the total number of shares you bought.

Does selling shares change my average cost?

No. The shares you sell are removed at the average cost and the difference is your realized profit or loss. The average cost of the shares you keep stays the same.

Are trading fees included?

Buy fees are added to the cost. Sell fees are deducted from the sale proceeds, so they reduce the realized profit.

What is the break-even price?

The price at which the remaining position shows neither a profit nor a loss. Before sell fees, it equals the average cost.

How does averaging down work?

Buying more shares at a price below your average cost lowers the average. It also increases the amount you have invested in the same asset, and with it your risk.

The information and calculations on this page are for general information only and are not investment or tax advice. For sources and methods, see Methodology and sources.