Stock Average Cost Calculator

Stock average cost calculator: compute weighted average share price, total shares, cost basis, and unrealized gain from your buys. Free, private, no signup.

Updates automatically as you type.

Calculated in your browser; your inputs are not sent to us. Privacy

Results will appear here.
Calculation details
Every figure above is calculated locally in your browser from the assumptions shown. No inputs are sent anywhere. See the methodology section below for the formulas used.
Use this resultShare the current inputs, or ask ChatGPT to explain the calculation in context.
Ask an AI to explain this result
Share this result

Planning estimate only, not financial, tax, or legal advice. Verify assumptions and current rules before making decisions.

This tool runs in your browser. Your calculator inputs and results are never transmitted to us or to ad/affiliate partners. Ads and sponsored links may set third-party cookies to serve and measure them, but they never receive your calculation values. If you explicitly save a scenario, its permitted fields stay in local browser storage until you clear them. See our Privacy Policy.

Use this result

Share the current inputs or ask ChatGPT to explain the calculation in context.

More options
Report a calculation issue
Direct answer

What does this calculator estimate?

Buying 100 shares at $20 and 50 more at $30 gives a $3,500 cost basis across 150 shares: an average cost of $23.33 per share. At a $28 current price the position is worth $4,200, an unrealized gain of $700. Enter each buy in the BoringToolsKit stock average cost calculator to see your true break-even price.

  • Average cost is total dollars invested divided by total shares, not the average of your entry prices. (Source: BoringToolsKit calculation methodology)
  • The IRS allows the average cost basis method for mutual fund shares; single-stock sales default to specific identification or FIFO. (Source: IRS)
  • Unrealized gains are paper gains: tax is only owed when shares are sold. (Source: IRS)
Two stock lots pooling to one average cost per share
150 shares pool to a $24.67 average cost per share

Averaging the prices instead of the dollars is the classic error

The most common mistake with lots bought at different prices is averaging the entry prices. Two buys, 100 shares at $20 and 50 shares at $30, produce an entry-price average of (20 plus 30) divided by 2, which is $25. The calculator returns $23.33, and the gap between those numbers is the whole point: average cost is total dollars divided by total shares, or (2,000 plus 1,500) divided by 150. The $20 lot contains twice as many shares, so it pulls the weighted average below the midpoint.

Getting this wrong by $1.67 per share sounds small until it is multiplied by everything you own. On 150 shares it is a $250 error in your own mental break-even. Worse, the simple price average always sits at the midpoint, so it hides the fact that your position is skewed toward whichever lot you bought more of. If you DCA'd more money at the bottom, your real average is meaningfully lower than the midpoint suggests, and only the weighted calculation shows it. Enter the share counts for every buy and let the division do the weighting.

What selling part of a position does to the average

Under the average cost method, every share sold carries the same basis: the current average. From the 150-share example at a $23.33 average, selling 50 shares at $28 realizes a gain of (28 minus 23.33) times 50, or about $233, and leaves 100 shares still carried at $23.33. The average of what remains does not change because each dollar of basis is spread evenly across every share.

That evenness is also a limitation. Specific identification or FIFO would let you choose which lot the 50 shares came from, and the realized gain changes with that choice: selling from the 100-share $20 lot first realizes a $400 gain, roughly $167 more than the average basis produces. Which figure actually appears on your tax filing depends on the method in place at your broker, not on the arithmetic on this page. Use the calculator to know your break-even and position size with precision, then check the lot-level detail in your brokerage account before you assume you know what a partial sale realizes. Run the page for the break-even and the shares, then read the lot detail before you book the gain.

Averaging down in dollars, not in feelings

Run the position you already hold: 100 shares at $40 for a $4,000 basis, price now $30. Buying 100 more shares costs $3,000 and moves the average to (4,000 plus 3,000) divided by 200, or $35. Your break-even falls from $40 to $35, which shrinks the required rise to get back to even from 33.3% to about 16.7%. That manipulation of the break-even is exactly why averaging down is popular.

What the same numbers say about risk is less flattering. Your dollar exposure has gone from $4,000 to $7,000, and if the price falls again from $30 to $25 the unrealized loss is $2,000 instead of the $1,500 you would have carried without adding. The calculator describes neither future; it prices the position as you enter it. The honest frame is that averaging down is a decision to put more money at risk in exchange for a lower break-even, and the two numbers above are the actual size of that trade. If the extra $3,000 would change how you feel about a further decline, that is the thing to settle before the buy, not after.

Taxes on sales are outside this calculation

The average cost this page computes is a bookkeeping number. It says what each share has cost you in total dollars, and nothing else. When shares are sold, what matters for money actually received is proceeds minus basis minus tax, and tax treatment depends on facts the calculator never sees: the lot method on file with your broker, how long shares were held, and the account they sit in.

Two specifics worth knowing. First, the IRS accepts average cost for mutual fund shares, while positions in individual stocks generally default to FIFO or specific identification unless another method is elected, so an average-cost figure on a stock may not match your brokerage's realized-gain report. Second, holding period runs lot by lot, which average basis deliberately ignores: a buy made 15 months ago and one made 3 months ago share an average but not a holding period. This page is the right tool for break-even and for sizing a partial sale in shares; the tax figure belongs to your broker's lot detail or a tax professional. Treat this page and the brokerage lot report as two different questions about the same position, and keep both open when a sale is in the picture.

How average cost per share is computed across multiple buys
Two buys, one average: the $23.33 break-even example.
Transparent methodology

How this calculator works

Formula

Average cost = (shares1 x price1 + shares2 x price2) / total shares.

Frequently asked questions

What is a stock average calculator and how does it work?

A stock average calculator helps you compute the average cost per share of a stock you have purchased multiple times at different prices. You simply enter each buy transaction's share count and price, and the tool instantly calculates your weighted average cost basis.

Do I need to create an account or sign up to use this tool?

No. This is a fully no-signup, browser-based tool. All calculations are performed locally on your device, your data never leaves your browser and is never stored on any server.

Is the stock average calculator free and accurate?

Yes, the tool is completely free to use and calculates your average cost using a precise weighted-average formula based on the number of shares and purchase prices you enter. It is designed to be a reliable reference for personal investment tracking.

Cite this tool

BoringToolsKit. “Stock Average Cost Calculator.” boringtoolskit.com/stock-average-cost-calculator/. Free to reference in articles, syllabi, and answer posts with a link.

Privacy: Inputs and results stay in this browser. Any future sponsored recommendation or advertisement will be clearly labeled and kept separate from the calculation.

A worked example: two lots, one average

Say you bought 100 shares at $22 in January (cost $2,200) and 50 shares at $30 in April (cost $1,500). Total cost basis is $2,200 + $1,500 = $3,700 across 150 shares, so the average cost per share is $3,700 / 150 = $24.666..., which rounds to $24.67. Notice the average sits closer to the first lot's price because that lot has twice the shares: weight, not recency, decides where it lands.

If the stock now trades at $27, the calculator values the position at 150 x $27 = $4,050. Unrealized gain is $4,050 - $3,700 = $350. You can sanity-check that: the January lot is up $5 per share ($500) while the April lot is down $3 per share (-$150), and $500 - $150 = $350, matching the pooled figure exactly. The single average hides that split, which is fine for tracking but not for deciding which lot to sell.

Where the pooled average diverges from reality

Tax lots do not collapse the way this average does. Sell 30 shares from a position averaged at $24.67 and the calculator implies a basis of 30 x $24.67 = $740.10. But your broker defaults to specific lots: 30 shares from the April lot alone means a basis of 30 x $30 = $900, which cuts the reported gain from $70 to zero. Same trade, $160 different taxable outcome, purely from lot selection.

The average also drifts from your actual outlay whenever corporate actions intervene. A 2-for-1 split halves the average to about $12.33 while your total cost stays $3,700, so nothing is lost, but any comparison against an old screenshot of this tool will look wrong. Dividend reinvestment adds tiny lots (a $12.50 dividend at $25 buys 0.5 shares) that this two-lot input cannot capture, and broker commissions of $5 to $10 per trade belong in the cost basis for taxes even though most brokers now charge zero. For a single uncomplicated position the pooled number is close enough; for anything with reinvestment or planned sales, keep the lot-level statement from your broker as the source of truth.