Stock Calculator

Stock Average Calculator

Add your buy lots to see the average cost live, or find how many shares it takes to reach a target average.

Type a ticker or a company name. The search runs in your browser.
Settings
Buy fee
Sell fee
Decimal places
Percent
Amounts
Shares

Enter your trades to see live results:

shares at each
shares at each

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

How to read this chart
  • Each column is one trade, in order from left to right. ▲ is a buy and ▼ is a sell, drawn at the price of that trade. On a computer, point at a column to see its details.
  • The solid line is your average cost per share after each trade. A buy pulls it up if its cost per share, including fees, is above the line, and down if that cost is below it. The price you sell at does not move it.
  • At each sell, a bar runs from what the sold shares cost you, fees included, to the sell price. That gap times the shares sold is the profit or loss you locked in, printed next to the bar in green for a gain and red for a loss.
  • Enter “Share price now” to add a dashed line at that price. The shaded band between it and your average cost is the unrealized profit or loss on the shares you still hold. If the price is far from your trades, the line sits at the edge with an arrow so the trades stay readable.
  • The bars at the bottom show how many shares you hold after each trade. The bright part is what a buy added, and a red outline is what a sell took away.
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 190.

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, HIFO) can shift the remaining average; brokers differ, and the cost basis calculator shows the same trades under each of them.

How to read your trades

Video tutorial · English with captions · 4:37

The player loads from youtube-nocookie.com only when you open it. Watch on YouTube ↗