STOCK AVERAGE CALCULATOR

Stock average calculator

Enter your purchases, get the average price.

$

How do I calculate my average cost per share?

Add up what you paid for all purchases and divide by the total shares: 10 shares at $100 and 20 at $80 cost $2,600 for 30 shares — $86.67 each.

What is averaging down?

Buying more shares after the price falls, which lowers your average cost. It also puts more money into the same stock.

How do I enter purchases?

One per line: shares, then price — "10 100" or "20 @ 80". Fractional shares work too.

How is the gain calculated?

Shares × current price minus the total cost. At $90, the 30 shares above are worth $2,700 — a $100 gain (3.85%).

Does it include fees and dividends?

Only if you add them into the prices. The IRS counts commissions and transfer fees as part of a stock’s basis, so add each fee divided by its shares to the price: a made-up $5 commission on each purchase above moves the average from $86.67 to $87.00. The capital gains tax calculator estimates the tax on a sale.

Is my average cost the same as my tax cost basis?

Usually not. The IRS says that if you cannot identify the specific shares you sold, the basis comes from the shares you bought first (first-in first-out), and that, except for certain mutual fund shares and dividend reinvestment plans, you cannot use the average basis per share to figure a gain or loss on stock. If you identify the shares with your broker, the basis is what you paid for those shares plus the costs of purchase. Selling 15 of the shares above by first-in first-out gives a basis of $1,400, which is $93.33 a share, not $86.67. Your broker reports basis on Form 1099-B for covered securities.

How the average is calculated

The average cost per share is a weighted average: each purchase counts in proportion to its number of shares. Multiply shares by price for every purchase, add the results to get the total invested, and divide by the total number of shares. If you add a current price, the calculator multiplies it by the total shares for the present value and subtracts the total invested for the gain or loss, shown in dollars and as a percentage of the cost.

Worked example: 10 shares at $100 and 20 at $80

The first purchase cost $1,000 and the second $1,600, $2,600 for 30 shares, so the average is $2,600 ÷ 30 = $86.67. It is not the simple average of $100 and $80, which would be $90, because more shares were bought at the lower price. At $90 the position is worth $2,700, a gain of $100. Buying 30 more shares at $60 would bring the average to $73.33, and a price of $90 would then show a gain of $1,000.

Common mistakes

Using the simple average of the prices instead of weighting by shares is the first error. Treating the average as your tax basis is the second: the IRS default is first-in first-out unless you identify specific shares, with average basis allowed only for certain mutual fund shares and dividend reinvestment plans. Leaving out commissions is the third, since they belong in the cost. Last, averaging down is not the same as getting back to even: the price still has to rise above your average before the position shows a gain.

Sources: IRS, How do I figure the cost basis when the shares I’m selling were purchased at various times and at different prices? (reviewed September 23, 2026): what the basis of stock includes, specific identification of shares, first-in first-out, and the narrow exception for average basis; see also IRS Topic no. 703, Basis of assets and Publication 550. The average is a weighted average of price by shares, and the $5 commissions in the second example are made up. Estimate the tax in the capital gains tax calculator, see the return in the ROI calculator and spread buying over time with the dollar-cost averaging calculator.

Estimates for planning only — not financial advice. How we check our calculators.