How does the weighted cost calculation work?
This stock average cost calculator adds the acquisition outlay for each purchase lot, including the purchase fee you enter, and divides the total by all shares purchased. You can then enter a hypothetical number of shares sold. The calculator subtracts that quantity and multiplies the remaining quantity by the same weighted average to show an arithmetic inventory estimate.
For each lot, purchase outlay is shares multiplied by price per share, plus the lot's fee. Total shares are the sum of lot quantities. Weighted average acquisition cost per share is total purchase outlay divided by total shares. The remaining-share estimate is total shares minus the hypothetical sold quantity. Estimated remaining inventory value at cost is the weighted average multiplied by those remaining shares.
For example, buying 10 shares at 10 currency units each and 5 shares at 12 each, with no fees, gives a total outlay of 160 for 15 shares. The weighted average is 160 divided by 15, or about 10.6667 per share. If 3 shares are hypothetically removed, 12 remain and the arithmetic inventory estimate is 128. This example illustrates the formula only; it is not a tax-lot calculation.
Important U.S. tax limitation: the IRS says that, except for certain mutual fund shares and certain dividend reinvestment plan shares, you cannot use average price per share to figure gain or loss on a stock sale. The IRS discusses specific share identification and FIFO for stock lots. The calculator's weighted average must not be treated as the basis of a taxable stock sale or used to prepare a tax return. Your actual adjusted basis can also depend on fees, corporate actions, reinvested distributions, transfers, and other records. Keep broker confirmations and consult current IRS guidance or a qualified tax professional for your situation.
Source and date: IRS Publication 550 (2025), Investment Income and Expenses, accessed 2026-11-03. Its section on identifying shares explains the general restriction on average-price calculations for stock and describes exceptions and methods. This tool is a user-input arithmetic aid and does not determine which tax method applies.
The model assumes each line is a completed purchase of identical shares, all amounts use the same currency, and the entered fees are part of acquisition outlay. It does not adjust for stock splits, returns of capital, reinvested dividends, wash sales, gifted or inherited shares, options, partial-lot selection, sale proceeds, sale fees, or foreign exchange. The hypothetical removal uses the weighted average solely to illustrate arithmetic; it does not establish tax consequences.
Frequently asked questions
Can I use this result as my U.S. stock tax basis?
No. For individual stock, the IRS generally does not allow average price per share to determine gain or loss, except for specific exceptions. Consult IRS Publication 550 and your lot records to determine applicable treatment.
How do I enter purchase fees?
Enter one line per purchase in the format shares, price per share, fee. Enter zero when there is no purchase fee. The fee is added to that lot's acquisition outlay in this arithmetic model.
What does “shares sold” do?
It subtracts the quantity from the total shares purchased and shows a remaining-inventory estimate at the same weighted average. It does not select actual lots or calculate taxable gain or loss.
Does it update for splits or dividends?
No. Entered lots are used as-is. Corporate actions and distributions can require basis adjustments that this simplified calculator does not make.