Stock Calculator

Stock Average Calculator

Stack up your buy lots and read the average cost live — then flip the question with the target-average solver: exactly how many shares does it take to reach the average you want?

Enter your trades to see live results:

Settings
Buy fee
Sell fee
Decimal places
Percent
Amounts
Shares
shares at each
shares at each

One trade per line — shares@price, a leading minus means sell. Example: 100@50 or -40@65.

$98.4$110$122#1 BUY 10 @ $100.00 · avg $100.00#2 BUY 10 @ $120.00 · avg $110.00#1 BUY 10 @ $100.00 · avg $100.00#2 BUY 10 @ $120.00 · avg $110.00#1#2
Total P/L
Open position (shares)
Average cost basis
Total invested
Realized P/L
Unrealized P/L
Return on investment
Break-even price
After-tax P/L (illustrative)
Keyboard shortcuts
b / s Set the focused trade to buy / sell
Tab / Shift+Tab Next / previous field
↑ / ↓ Step a value by 1 (Shift: 10, Alt: 0.1)
Enter Copy the primary result
[ / ] Fewer / more decimal places (percent)
Esc Clear the field

Target-average solver

the reverse question
To reach the target

The average cost formula — both directions

Forward: average = total cost ÷ total shares. It's a weighted average — a big cheap lot pulls harder than a small dear one. Ten shares at $100 plus ten at $120 average $110; make the second lot thirty shares and the average lands at $115, three-quarters of the way toward the bigger purchase.

Reverse (the solver): fix the average you want and solve for the purchase. From a = (S·c + n·p) ÷ (S + n), rearranging gives n = S·(a − c) ÷ (p − a). The denominator is the point: as your target average approaches the market price, the required purchase explodes toward infinity — halving your average is cheap when the price has fallen far, and nearly impossible when it hasn't. The golden example: 10 shares at $100, price $80 — reaching $90 takes exactly 10 shares, but reaching $81 would take 90.

Two honesty notes. Commissions raise the true average slightly (the full calculator includes them). And a lower average is not a better investment by itself — it's the same money spread across more shares of the same risk. Whether that's conviction or the disposition effect wearing conviction's clothes is the question worth two minutes of reading.

Stock average FAQ

How do I calculate my average stock price?

Divide total cost by total shares. Buying 10 shares at $100 and 10 more at $120 costs $2,200 for 20 shares — an average of $110. Include commissions in the cost for the true figure: $5 per trade moves this example to $110.50. Every extra lot is one more row above.

How many shares do I need to buy to reach a target average?

The solver inverts the average formula: to move S shares at average c to target a with the price at p, buy n = (a·S − S·c) ÷ (p − a). Holding 10 shares at $100 with the price at $80, reaching a $90 average takes exactly 10 more shares ($800). The target must sit between the current price and your current average — no purchase can drag an average past the price you pay.

Does averaging down improve my position?

It lowers the price at which you break even — and raises the amount you have at risk in the same stock. Both effects are mechanical; neither says anything about whether the price will recover. The math and the behavioral trap are separated carefully in Averaging down: the math, and when it's just the disposition effect.

Do sells change my average cost?

Under the average-cost method this calculator uses, no — a sell removes shares at the running average, leaving the average of the remainder unchanged. What a sell does change is realized P/L and position size. Methods that pick specific lots (FIFO, LIFO) can shift the remaining average; brokers differ, and this tool states its method rather than guessing yours.