Stock Average Calculator
Enter every purchase and get your weighted average price per share — your cost basis — along with break-even and where the position stands today. Then set a target average and the calculator works backwards to the number of shares you would have to buy to get there.
Average price per share
$0.00
Across 0 shares, a cost basis of $0.00
- Cost before fees
- $0.00
- Average before fees
- $0.00
- Purchases counted
- 0
- Plain average of the prices
- $0.00
The two differ whenever your purchases are different sizes. The weighted figure is the correct one — the plain average of the prices is shown only so you can see how far off it is.
Where the position stands
Enter a current market price to fill this in. Break-even is your average price including fees, before tax.
- Value today
- —
- Unrealized gain or loss
- —
- Return on cost
- —
- Move needed to break even
- —
Shares needed to reach your target average
The calculation every other stock average calculator leaves out. Set a target average and a price you would buy at, and this solves for the share count exactly rather than making you guess and re-check.
- Shares to buy
- —
- That would cost
- —
- New average
- —
Now that you know what you paid
An average price is a starting point, not a decision. The question it usually raises is whether to keep buying — and on what schedule.
You now know what your position cost. The next question is usually whether to keep buying, and on what schedule — which is a different calculation with a genuinely surprising answer about lump sums. The DCA calculator picks up from here with your average already set as the starting price.
Continue in the DCA calculatorHow to use it
Enter every purchase
Shares and the price you paid, one row per buy. Rows appear as you need them. The page starts with a worked example already filled in so you can see what a correct answer looks like before typing anything.
Add fees if you paid any
Commissions belong in your cost basis. On a small position they move the break-even more than people expect, and they are the difference between the number you calculated and the one your broker shows.
Put in today's price
That turns an average into a position: what it is worth, what it has gained or lost, and how far the price has to travel to get you back to even.
Work backwards to a target
If you are thinking about buying more, set the average you want and the price you would pay. The calculator returns the exact share count — or tells you plainly that the target cannot be reached at that price.
How the average is calculated
It is a weighted average, not the average of the prices you paid. Each purchase counts in proportion to its size, which is why a large order moves your average much more than a small one at the same price.
Average price = ( Σ shares × price + fees ) ÷ Σ shares
Sum the cost of every purchase, add any commissions, then divide by the total number of shares. That figure is your cost basis per share, and it is also your break-even before tax.
Why it is not the average of the prices
Buy 100 shares at $50 and 50 at $40 and your average is $46.67, not $45. You own twice as many of the expensive ones, so they pull harder. The plain average of the prices is shown on this page next to the correct figure purely so the gap is visible — it is the most common mistake in a hand-built spreadsheet, and the error grows as your purchase sizes diverge.
Cost basis and stock average are the same number
They are two names for one calculation, used by two different people. A trader deciding whether to buy more calls it the stock average. Someone filling in a tax return calls it the cost basis. The arithmetic does not change; only what the number is for.
Where the tax version stops being this simple
For US tax purposes the average is only one of several permitted methods, and for individual shares it is usually not the one your broker uses. Brokers default to FIFO — first shares in are treated as the first shares sold — and the average cost method is generally restricted to mutual funds and dividend reinvestment plans. So the average on this page is the right number for understanding your position and for a fund holding, but if you are reporting a sale of individual shares, check which method your broker actually applied before using it. This calculator deliberately does not compute a realized gain for that reason.
Fees belong in the basis
Commissions paid to buy are added to what the shares cost you, which raises your basis and therefore your break-even. It works in your favor at sale time, since a higher basis means a smaller taxable gain. The calculator shows the average with and without fees so you can reconcile against whichever figure your broker displays.
Averaging down: how many shares do you actually need?
This is the question people are really asking when they open a stock average calculator while a position is underwater, and it is the one every competing tool leaves you to solve by trial and error. It has an exact answer. With S shares at an average of A, buying n shares at price P:
n = S × (T − A) ÷ (P − T) where T is the average you want to reach
Take the worked example on this page: 150 shares at an average of $46.67. To pull that down to $40.00 by buying at $30.00 you would need 100 more shares, costing $3,000 — and that would leave you holding 250 shares at exactly $40.00. Note what the formula also tells you: if the price you can buy at is not below your target, no quantity works. Buying at $52 can never bring a $48 average down to $45, however many shares you buy, and the calculator says so instead of returning a nonsense number.
Why recovering costs more than the fall
A position down 20% needs a 25% gain to get back to even, not 20%. The percentages are measured against different starting points — the loss against your basis, the recovery against the lower price. That asymmetry is why the calculator reports the move needed to break even as its own figure rather than leaving you to invert the loss.
Stock splits, spin-offs and reinvested dividends
Reinvested dividends are simply more purchases — enter each one as its own row and the average takes care of itself. Splits need one adjustment first: in a 2-for-1 split, double the share count and halve the price on every purchase made before the split date, then enter the adjusted figures. Your total cost is unchanged, which is the point. Spin-offs are harder, because the original basis has to be apportioned between the two companies using a ratio the company publishes at the time — that requires corporate action history this site does not hold, so for a spin-off use your broker's figures or the company's investor relations page.
Worked examples
Four positions that show what the weighting actually does.
- The default position. 100 shares at $50 plus 50 at $40 gives a cost basis of $7,000 across 150 shares — an average of $46.67. The plain average of the two prices is $45.00, which would flatter your break-even by $1.67 a share.
- Averaging down to a target. From that same position, buying at $30 to reach a $40.00 average takes exactly 100 shares and $3,000, leaving 250 shares at $40.00.
- When the target is impossible. 100 shares at $50, hoping to reach $45 by buying at $52. There is no share count that works, because every purchase above your target drags the average the wrong way. The calculator says so rather than showing a negative number.
- What fees do to a small position. 100 shares at $50 with $25 of commission is a $5,025 basis and a $50.25 average. Half a percent, and it is the reason your broker's break-even never quite matches the one you worked out.
- The recovery asymmetry. The default position at a market price of $40 is down $1,000, or 14.29% of cost. Getting back to even needs +16.67% from here, not 14.29%.
Questions about stock averages and cost basis
Including the tax question that trips people up.
The calculation
Why can't I just average the prices I paid?
Because that only works if you bought the same number of shares each time. Averaging $50 and $40 gives $45, but if you bought twice as many at $50 the true figure is $46.67 — you own more of the expensive shares, so they count for more. The plain average is shown on this page beside the correct one so the difference is visible rather than assumed.
How many purchases can I enter?
Thirty, and a new row appears automatically as soon as you fill the last one. This is worth stating because the page currently ranking first for this search accepts exactly two — a first purchase and a second — with no way to add a third.
What is the stock average formula in a spreadsheet?
With shares in column A and prices in column B: =SUMPRODUCT(A:A,B:B)/SUM(A:A). That single function does the weighting correctly. Using =AVERAGE(B:B) instead is the mistake this page keeps pointing at — it ignores the quantities entirely.
Does the order or timing of my purchases matter?
Not to the average. It is a weighted sum, so the same purchases in any order produce the same figure. Timing matters for tax lot accounting and for measuring your return over time, but not for this number.
Averaging down
Why does it say my target average is unreachable?
Because the price you entered is not below the target you want. Every share you buy pulls your average toward the price you paid, so buying at $52 moves a $48 average up, never down to $45 — and no quantity changes that direction. The same applies in reverse when averaging up. Rather than return a negative share count, the calculator tells you which of the two numbers has to change.
Should I average down on a losing stock?
That is not a question arithmetic can answer, and anyone whose calculator tells you it can is selling something. What the maths gives you is the price of the decision: how much more capital you would commit, and what your break-even becomes. What it cannot tell you is whether the fall reflects something real about the business. A lower average feels like progress while quietly increasing your exposure to a position that is already going against you.
Can it calculate averaging up as well?
Yes — it is the same equation with the inequality reversed. Set a target above your current average and a buy price above the target. If you hold 100 shares at $20 and want a $30 average, buying 100 more at $40 gets you exactly there.
What is the difference between averaging down and dollar-cost averaging?
Averaging down is a reaction: the price fell, you buy more, your average drops. Dollar-cost averaging is a schedule: you invest a fixed amount at fixed intervals whether the price rose or fell, and the averaging is a side effect rather than the goal. This page is for the first. The DCA calculator on this site is for the second, and the link below the results carries your average across to it.
Why does my stock need to rise more than it fell to break even?
Because each percentage is measured against a different number. Fall 20% from $100 and you are at $80; rising 20% from $80 only gets you to $96. You need 25% to return to $100. Down 50% needs 100% to recover. This is why the calculator reports the move required to break even as its own figure rather than letting you infer it from the loss.
Cost basis and tax
How do you calculate the cost basis of a stock?
Cost basis is what you paid in total, including commissions: the sum of every purchase plus fees. Per share, it is that total divided by the number of shares — the same figure this page calls your average price. The complications come later, at sale, when you have to decide which shares you sold and adjust for any splits or spin-offs since.
Should I use average cost or FIFO for my cost basis?
Usually you do not get to choose. For individual shares, US brokers default to FIFO — the first shares you bought are treated as the first sold — and the average cost method is generally only available for mutual funds and dividend reinvestment plans. If you sold part of a stock holding, the average on this page is the right number for understanding the position but may not be the one to report. Check what your broker applied, and take proper advice if the amount matters.
Do commissions count toward cost basis?
Yes — commissions and transaction fees paid to acquire shares are added to the basis, which raises it and reduces your eventual taxable gain. Enter them in the fees field and they are folded into both the cost basis and the per-share average. Ongoing account maintenance fees are a different matter and are not part of the basis.
What if I don't know the cost basis of my shares?
Start with your broker: since 2011 they have been required to track and report basis for covered securities, so anything bought after that should be on your statements. For older holdings, or shares transferred between brokers, you may have to reconstruct it from trade confirmations, old statements, or the historical price on the purchase date, adjusted for any splits. Reporting a basis of zero is the fallback and it is an expensive one — it makes the whole proceeds taxable.
How does the IRS verify stock cost basis?
Through the 1099-B your broker files, which reports proceeds and, for covered securities, the basis they hold. That is matched against your return. Where a broker reports basis as unknown, the figure you supply is what stands unless it is questioned — which is why keeping trade confirmations for older holdings matters. This is general information, not tax advice.
How do reinvested dividends affect cost basis?
Each reinvestment is a purchase at that day's price, and it increases your basis. Enter them as ordinary rows. Missing them is one of the most common ways people overstate a gain and overpay: you were taxed on the dividend when it was paid, and if you do not add the reinvested shares to your basis you are taxed on that money a second time at sale.
Scope and limits
Does it adjust for stock splits?
Not automatically, because doing it properly needs the split history and the date of each purchase — market data this site does not hold. The adjustment is one line of arithmetic though: in a 2-for-1 split, double the shares and halve the price on every purchase made before the split, then enter the adjusted numbers. Your total cost stays the same, which is how you know you have done it right.
Can I just type a ticker and have it fetch my purchases?
No. This site holds no market data and no accounts, so there is nothing to look up and nothing to log in to. Everything is typed in and everything stays in your browser. Tools that do fetch prices are useful, but they are a different kind of product with a different set of trade-offs.
Can it calculate my capital gain when I sell?
Deliberately not. A realized gain depends on which specific shares you are treated as having sold, and for individual stock that is normally FIFO rather than the average — so a calculator that applied the average here would hand you a wrong number for a tax return while looking authoritative. The unrealized gain against your average is shown, which is the right tool for judging a position. For a sale, use your broker's figures.
Is anything I type stored or sent anywhere?
No. Every calculation runs in your browser, there is no account and no server call when you change a figure. The Copy link button encodes your purchases into the URL so you can bookmark or share a position, and that link is the only place they go — so treat it as you would any other note about your holdings.
Other calculators
Same approach — your assumptions, visible working, no signup.
Compound Interest Calculator
Project growth with contributions, then subtract the three things other calculators leave out: fees, tax and inflation. Includes an optional withdrawal phase.
DCF Calculator
Two-stage discounted cash flow with a fade period, a reverse DCF that shows the growth the price already implies, and a full sensitivity grid.
DRIP Calculator
Reinvest dividends and see the result next to what taking them as cash would have produced. Dividend growth, yield on cost, tax and monthly income included.
CAPE Ratio Calculator
Cyclically adjusted P/E from your own earnings history, with each year inflation-adjusted — shown next to the plain one-year P/E so the difference is visible.
Benjamin Graham Formula Calculator
Graham's growth formula, the bond-yield revised version, and the Graham Number — all three on one page, clearly labelled as the different things they are.
DCA Calculator
Project a recurring investment plan, see the average price it actually pays, and put it beside the same money invested all at once with the waiting cash earning interest.
Options Profit Calculator
Four strategies in one tool — long call, long put, covered call and cash-secured put — with breakeven, max profit and loss, and a payoff chart.
Long Call Calculator
Profit, breakeven and max loss for a bought call at expiration — plus what the same money would have done in the shares.
Long Put Calculator
Profit, breakeven and max loss for a bought put at expiration — including the max profit a put actually has, which is not unlimited.
Covered Call Calculator
Premium income, annualised return, breakeven and the called-away case — using what you actually paid for the shares, not today's price.
Cash-Secured Put Calculator
Premium income, return on the cash your broker locks up, and exactly what the shares cost you if you are assigned.
Method and limitations
The average is a weighted mean: the cost of every purchase is summed, commissions are added, and the total is divided by the total share count. Rows with no share quantity are ignored rather than counted as zero-price purchases, so a partly typed row cannot distort the result. Break-even is the fee-inclusive average per share, stated before tax. The move required to break even is measured from the current price, not from the average, which is why it exceeds the percentage loss. The target-average calculation solves n = S(T − A) ÷ (P − T) in closed form and refuses targets that no purchase quantity can reach, rather than returning a negative share count. Every figure is checked against independently written formulas in the site's test suite.
This is a cost-basis and position calculator, not a tax tool. It does not compute realized gains, apply FIFO or specific-lot accounting, adjust for stock splits or spin-offs, or account for wash sales — see the FAQ for why the sale calculation is deliberately absent. Figures are nominal and in a single currency, with no foreign exchange handling. No live or historical market data is used. Built and maintained by CalcStocks; nothing here is investment or tax advice.