Stock average calculator

Bought the same stock more than once? Type in each buy. You get your average cost per share, and your profit or loss at any price. You also see what one more buy would do, and how many shares it takes to reach a target average. This is plain math on your own numbers. It is not advice to buy or sell.

For any stock, fund or coin you bought more than once · Free, no sign-up · The formula

Your buys

Examples
Buy 1
Buy 2
Buy 3
Paste a list
Stock split since these buys
for

A 2-for-1 split is 2 for 1. A 1-for-10 reverse split is 1 for 10.

Average cost per share

$39.00

You hold 60 shares that cost $2,340.00 in all. That is $39.00 a share on average.

60Total shares
$2,340.00Total cost
$39.00Break-even price
$42.00Plain average of your prices (not your real cost)
$1,800.00Value at $30.00
−$540.00 (−23.08%)Profit or loss at this price
+30.0%Gain needed to get back to even
One buy: wide is more shares, tall is a higher priceYour average, $39.00Price now, $30.00
The dashed line is your average, $39.00. A wide block pulls it more than a thin one.

Hypothetical illustration based on your inputs. Not a prediction, a recommendation, or the performance of any Amaltash strategy.

How it works: we add up what each buy cost and divide by the shares you hold. Every number comes from what you typed. No market data is used. A fee counts only when you type it, and tax is never counted. Stock prices can fall, and you can lose money.

Results change each time you change an input.

Fees, taxes and costs are not included unless you enter them.

Your average after each buy
BuySharesPriceCostShares so farCost so farAverage so farChange
120$40.00$800.0020$800.00$40.00—
210$52.00$520.0030$1,320.00$44.00+$4.00
330$34.00$1,020.0060$2,340.00$39.00−$5.00

Plan the next buy

Solve by

What this buy changes

30 shares at $30.00 cost $900.00. Your average would move from $39.00 to $36.00.

MeasureBefore the buyAfter the buy
Money in this stock$2,340.00$3,240.00
Average cost$39.00$36.00
Profit or loss at $30.00−$540.00−$540.00
Gain needed to get back to even+30.0%+20.0%
Profit or loss if the price then falls 25%, to $22.50−$990.00−$1,215.00
Profit or loss if the price then falls 50%, to $15.00−$1,440.00−$1,890.00
Profit or loss if the price goes to $0−$2,340.00−$3,240.00

These rows are plain math, not a forecast. This is not advice to buy.

Sell some shares

Cost of the shares you sell

MethodCost of the 20 sharesProfit or lossShares left, average
Oldest first (FIFO)Used for a stock when you do not pick the shares.$800.00−$200.0040 at $38.50
Average costFor mutual fund shares and some dividend plans.$780.00−$180.0040 at $39.00
You pick: highest cost firstAn example of picking shares.$920.00−$320.0040 at $35.50
You pick: lowest cost firstAn example of picking shares.$680.00−$80.0040 at $41.50

The two You pick rows are examples of picking the shares yourself. They show how far apart the answers can be. They are not a tip on which shares to pick, and this is not tax advice.

Sold at a loss? If you buy the same stock within 30 days before or after, the loss may be a wash sale. Read about the wash sale rule

What is the average cost of a stock?

Your average cost is what you paid for each share, on average, across all your buys. Add up the dollars you spent. Divide by the shares you hold. If you paid $2,340 for 60 shares, your average cost is $39.00 a share. That is also your break-even price.

A share is one small piece of a company. Each time you buy shares, that buy is called a lot. Average cost is also called average price, average share price or cost per share.

The break-even price is the price where your shares are worth exactly what you paid. Above $39.00, this holding shows a gain. Below it, a loss.

The stock average formula, step by step

The formula is total cost divided by total shares. Multiply the shares in each buy by the price you paid. Add those amounts up, plus any fees. Then divide by all the shares you hold. This is a weighted average, so a big buy counts more than a small one.

A=∑i=1m(si×pi+fi)∑i=1msiA = \frac{\sum_{i=1}^{m} \left( s_i \times p_i + f_i \right)}{\sum_{i=1}^{m} s_i}

In words: Add up what every buy cost, fees included. Divide by all the shares.

AA
your average cost per share
sis_i
the shares in buy i
pip_i
the price paid in buy i
fif_i
the fee on buy i, or 0
mm
the number of buys

Here is a made-up example with three buys: 20 shares at $40, 10 at $52 and 30 at $34.

  1. Multiply each buy. 20 × $40 = $800. 10 × $52 = $520. 30 × $34 = $1,020.
  2. Add the costs. $800 + $520 + $1,020 = $2,340.
  3. Add the shares. 20 + 10 + 30 = 60.
  4. Divide the cost by the shares. $2,340 ÷ 60 = $39.00 a share.

Fees count too. With a $5 fee on each buy, the total is $2,355. Divide by 60 and the average is $39.25.

Can I average the prices I paid?

No, not unless every buy was for the same number of shares. Adding up the prices and dividing by the number of buys treats a 10-share buy like a 90-share buy. Your real cost leans toward the price where you bought the most shares.

Here are two prices, $50 and $30, and 100 shares in all. The plain average is $40 every time. The real average is not.

Shares at $50Shares at $30Real averagePlain averagePlain average is off by
9010$48.00$40.00−$8.00
7525$45.00$40.00−$5.00
5050$40.00$40.00$0.00
2575$35.00$40.00+$5.00
1090$32.00$40.00+$8.00

The real average runs from $32 to $48.

Say you buy 10 shares three times, at $50, $40 and $25. That costs $1,150 for 30 shares, or $38.33 each. That is also the plain average of the three prices. Now say you spend $1,000 each time. You get 20, 25 and 40 shares. That is 85 shares for $3,000, or $35.29 each.

A=m1p1+1p2+⋯+1pmA = \frac{m}{\frac{1}{p_1} + \frac{1}{p_2} + \dots + \frac{1}{p_m}}

In words: Divide 1 by each price and add those up. Then divide the number of buys by that sum.

AA
your average cost per share
mm
the number of buys
p1,p2,…p_1, p_2, \dots
the price at each buy

When you spend the same dollars at regular times, it is called dollar-cost averaging. It buys more shares when the price is low and fewer when it is high.

See dollar-cost averaging against a lump sum in the S&P 500 calculator →

How to use the stock average calculator

Type the shares and the price for each time you bought. The answer updates as you type. Add a row for every buy, or paste a list from a spreadsheet. Parts of a share work too. Add the price now to see your gain or loss in dollars.

  1. Type the shares and the price of each buy, oldest first.
  2. Press Add a buy for each extra buy. Or open Paste a list and paste many at once.
  3. Know the dollars you spent, not the shares? Switch that row to Dollars.
  4. Turn on Add fees if you paid a fee on any buy.
  5. Type the price now to see what your shares are worth.
  6. Go to Plan the next buy to test one more buy.
  7. Go to Sell some shares to see the cost of the shares you sell.
  8. Press Copy link to save or share your numbers.

The math works in any currency. The page shows a $ sign and uses no exchange rate.

Stock profit calculator: how to find your gain or loss

Take the price now, or your sale price, minus your average cost. Multiply that by your shares. Say you hold 60 shares with a $39.00 average. At $45.00 a share you are up $6.00 a share, a gain of $360. At $30.00 you are down $540.

G=S×(P−A)G = S \times (P - A)

In words: Take the price now minus your average cost. Multiply by your shares.

GG
your gain, or your loss when it is below zero
SS
the shares you hold
PP
the price of the new buy, or the price now
AA
your average cost per share

This is a gain or loss on paper until you sell. Type a price in the Price now box to see it. Here is the same holding at five prices:

PriceValue of 60 sharesGain or lossAs a percent of cost
$52.00$3,120+$780+33.3%
$45.00$2,700+$360+15.4%
$39.00$2,340$00.0%
$30.00$1,800−$540−23.1%
$19.50$1,170−$1,170−50.0%

When you sell, take off the sale fee too.

Gsale=q×Psell−fsell−BsoldG_{\text{sale}} = q \times P_{\text{sell}} - f_{\text{sell}} - B_{\text{sold}}

In words: Multiply the shares you sell by the sale price. Take away the sale fee. Then take away what those shares cost.

qq
the shares you sell
PsellP_{\text{sell}}
the sale price
fsellf_{\text{sell}}
the sale fee, or 0
BsoldB_{\text{sold}}
the cost of the shares sold

Say you sell all 60 shares at $45.00 and pay a $5 fee. You get $2,700, less $5, less the $2,340 cost. That is a $355 gain.

A percent gain does not show how long it took. A yearly rate does.

Turn a gain or loss into a yearly rate with the CAGR calculator →

What does averaging down mean?

Averaging down means buying more of a stock you own after its price has fallen. The new shares cost less, so your average cost per share drops. The dollars you have lost so far do not change. You now have more money in the same stock.

Anew=S×A+n×P+fS+nA_{\text{new}} = \frac{S \times A + n \times P + f}{S + n}

In words: Add the cost of the new shares to what you already paid. Divide by all the shares you hold now.

AnewA_{\text{new}}
your average after the buy
SS
the shares you hold
AA
your average cost per share
nn
the shares in the new buy
PP
the price of the new buy, or the price now
ff
the fee on the new buy, or 0

Say you hold 60 shares at a $39.00 average and the price is $30.00. You buy 30 more shares for $900. Here is what changes and what does not.

MeasureBefore the buyAfter the buy
Money in this stock$2,340.00$3,240.00
Average cost$39.00$36.00
Loss on paper at $30.00−$540.00−$540.00
Gain needed to get back to even+30.0%+20.0%

The buy moved the average. It did not move the loss.

Averaging up is the same math the other way. Say you hold 60 shares at $39.00 and buy 20 more at $51.00. Now you hold 80 shares at a $42.00 average. Your break-even price went up.

How many shares do I need to buy to average down?

Pick the average you want to reach. Multiply the shares you hold by the gap between your average and that target. Divide by the gap between the target and the new price. To move 60 shares from a $39.00 average to $36.00 by buying at $30.00, you need 30 more shares, or $900.

n=S×(A−T)+fT−Pn = \frac{S \times (A - T) + f}{T - P}

In words: Take your shares times the gap between your average and your target. Divide by the gap between the target and the new price.

nn
the shares in the new buy
SS
the shares you hold
AA
your average cost per share
TT
the average you want to reach
PP
the price of the new buy, or the price now
ff
the fee on the new buy, or 0
  1. Find the gap from your average to your target. $39 − $36 = $3.
  2. Multiply by your shares. 60 × $3 = $180.
  3. Find the gap from the target to the new price. $36 − $30 = $6.
  4. Divide. $180 ÷ $6 = 30 shares.
  5. Multiply by the price for the cost. 30 × $30 = $900.

There is a limit. The target must sit between the new price and your average. Each buy pulls your average toward the new price. It never gets all the way there.

Most answers are not whole shares. A $37.00 target needs 17.14 shares. Round up to 18. That costs $540 and lands on a $36.92 average.

You can work from dollars too. $1,000 at $30.00 buys 33 whole shares for $990. That moves the average to $35.81.

n=D−fPn = \frac{D - f}{P}

In words: Take the fee off the dollars you have. Divide what is left by the price.

nn
the shares in the new buy
DD
the dollars you want to spend
ff
the fee on the new buy, or 0
PP
the price of the new buy, or the price now

One rule holds at any prices. Call it the gap rule.

nS=x1−x,x=A−TA−P\frac{n}{S} = \frac{x}{1 - x}, \qquad x = \frac{A - T}{A - P}

In words: To close a part x of the gap between your average and the new price, buy x ÷ (1 − x) times the shares you hold.

xx
the part of the gap you close, so one half is 0.5
nn
the shares in the new buy
SS
the shares you hold
AA
your average cost per share
TT
the average you want to reach
PP
the price of the new buy, or the price now
Part of the gap you closeShares to buy, as a multiple of what you hold
10%0.11×
25%0.33×
One third0.5×
50%1×
Two thirds2×
75%3×
90%9×

To move your average halfway to the new price, you must buy as many shares as you already hold.

Is averaging down a good idea?

No one answer fits every stock, and this page does not give advice. Here is what the math shows about averaging down as a strategy. It lowers the price you need to get back to even. It also puts more money into one stock. If the price keeps falling, you lose more dollars.

First, the help. After a fall, you need a rise to get back to even. Buying more at the low price makes that rise smaller.

g=AP−1g = \frac{A}{P} - 1

In words: Divide your average cost by the price now. Then take away 1.

gg
the rise needed to get back to even, as a decimal
AA
your average cost per share
PP
the price of the new buy, or the price now
Price fellBuy nothingBuy half as manyBuy as many againBuy twice as manyBuy 4 times as many
10%+11.1%+7.4%+5.6%+3.7%+2.2%
20%+25.0%+16.7%+12.5%+8.3%+5.0%
30%+42.9%+28.6%+21.4%+14.3%+8.6%
40%+66.7%+44.4%+33.3%+22.2%+13.3%
50%+100.0%+66.7%+50.0%+33.3%+20.0%

Buy as many shares again and the rise you need is cut in half. The price still has to rise.

Now the cost. Say you hold 100 shares bought at $80, so $8,000. The price falls to $50. You buy 100 more for $5,000. Your average is now $65, and you have $13,000 in the stock. Here is your gain or loss at five later prices.

Price laterWith no extra buyWith the extra buy
$80$0+$3,000
$65−$1,500$0
$50−$3,000−$3,000
$25−$5,500−$8,000
$0−$8,000−$13,000

Above $50 the extra buy helps. Below $50 it hurts. Nobody knows which way the price goes next.

Putting a large part of your money in one thing has a name: concentration risk. FINRA, a group that makes rules for brokers, says it can make a loss much bigger. If you spread your money over many things you own, that is called diversification. The SEC site Investor.gov says it cannot promise you will not lose money.

A stock can also go to zero. Say a company goes bankrupt. Investor.gov says the people who own its common stock are last in line. They may get nothing.

Three plain questions can help. They are not advice.

  • How much of my money would sit in this one stock after the buy?
  • Could I need this money soon?
  • What would a further fall cost me in dollars?

A loss always needs a bigger gain to undo it.

See why a loss needs a bigger gain to recover in the CAGR calculator →

See how much of what you own sits in one holding with the net worth calculator →

Work out your cash cushion with the emergency fund calculator →

Is my average cost my cost basis for taxes?

Not always. For a single stock, the IRS does not let you use the average. If you do not say which shares you sold, the oldest shares count as sold first. That is called first-in, first-out, or FIFO. The average method is for mutual fund shares. It also fits some dividend reinvestment plans.

Cost basis is the tax word for what an investment cost you. IRS Publication 551 says what the basis of a stock is. In general, it is the price you paid plus the costs of buying it, such as commissions.

There are three ways to count the cost of the shares you sell:

  • Oldest first (FIFO). This is the rule when you do not pick.
  • You pick the shares. The IRS has a long name for this, and it is specific identification. You tell your broker which shares to sell at the time you sell. IRS Publication 550 sets out the steps.
  • Average cost. This is for mutual fund shares, and for dividend reinvestment plan shares bought after 2011. You choose it in writing with the firm that holds them.

Brokers report the cost basis of your shares on Form 1099-B. That covers stock bought after 2010. For mutual funds and dividend reinvestment plans, it covers shares bought after 2011. FINRA says to check the form against your own records.

How long you held the shares matters too. IRS Topic 409 says a gain or loss is long-term if you held the shares more than 1 year. One year or less is short-term.

Here is one sale counted three ways. You made three buys of 100 shares: at $20 first, then $50, then $35. You sell 100 shares at $40.

MethodCost of the shares soldGain or loss on this saleAverage of the 200 leftGain or loss if the rest sells at $40Total gain
Oldest first (FIFO)$2,000+$2,000$42.50−$500+$1,500
Average cost (fund shares only)$3,500+$500$35.00+$1,000+$1,500
You pick: the $50 shares$5,000−$1,000$27.50+$2,500+$1,500

Same sale, three answers. The total over all 300 shares is $1,500 each way. The method changes when it shows up.

These rules are as of Nov 12, 2026. Most come from IRS Publication 550 for tax year 2025. This is general education, and it is not tax advice.

Does selling shares change my average cost?

It depends on which shares count as sold. If the oldest shares go first, the average of the shares you keep can go up or down. Under the average method used for fund shares, it stays the same. A sale changes which shares are left, not what each one cost.

Take the three buys from the formula example: 20 shares at $40, 10 at $52 and 30 at $34. You sell 20 shares at $30. Here is the cost of those 20 shares, and the average of the 40 you keep.

Which shares count as soldCost of the 20 sharesGain or lossAverage of the 40 left
Oldest first (FIFO)$800.00−$200.00$38.50
Average cost (fund shares only)$780.00−$180.00$39.00

Here is the math for the first row. 20 × $30 = $600 received. $600 − $800 is a $200 loss.

The Sell some shares part of the calculator does this for your own buys.

Averaging down and the wash sale rule

A wash sale happens when you sell a stock at a loss and buy the same stock within 30 days before or after. The IRS does not let you deduct that loss right away. It is added to the cost of the new shares. Buying more, then selling the old shares, can cause one.

The rule also covers shares that are nearly the same. The IRS has a term for these shares, and it is substantially identical.

  1. You hold 100 shares that you bought at $50.
  2. The price falls. You buy 100 more at $30.
  3. Within 30 days, you sell the first 100 shares at $32.
  4. That sale is a loss of $1,800: 100 × ($50 − $32).
  5. You cannot deduct the $1,800 now.
  6. It is added to the cost of the new shares: $3,000 + $1,800 = $4,800, or $48.00 a share.
Bnew=n×P+LB_{\text{new}} = n \times P + L

In words: Take what the new shares cost. Add the loss you could not deduct.

BnewB_{\text{new}}
the cost basis of the new shares
nn
the shares in the new buy
PP
the price of the new buy, or the price now
LL
the loss that was not allowed

In a regular account, the loss is put off, not gone. The higher cost makes the gain smaller, or the loss bigger, when you sell the new shares.

A buy inside an IRA counts as well. For that case, IRS Publication 550 does not add the loss to the cost of the new shares.

This calculator has no dates, so it cannot spot a wash sale. It shows a reminder on any sale at a loss. Form 1099-B has a box for a wash sale loss that is not allowed: box 1g.

These wash sale rules are from IRS Publication 550 for tax year 2025.

Stock splits, fees and reinvested dividends

Three things change your average besides a new buy. A fee adds to what you paid. A stock split changes how many shares you hold and the cost of each one, but not the total. A reinvested dividend is a new buy at that day's price.

A flat fee weighs more on a small buy. Here is a $5 fee as a share of the buy:

Size of the buyA $5 fee adds
$1005.00%
$2502.00%
$5001.00%
$1,0000.50%
$5,0000.10%

In a stock split, a company swaps each share for more shares, or for fewer. Investor.gov gives this example: after a two-for-one split, 100 shares at $100 become 200 shares at $50. You own the same slice of the company.

Safter=S×k,Aafter=AkS_{\text{after}} = S \times k, \qquad A_{\text{after}} = \frac{A}{k}

In words: Multiply your shares by the split. Divide your average cost by the same number.

kk
new shares for each old share, so 2 in a 2-for-1 split
SS
the shares you hold
AA
your average cost per share

Here is what a split does to 60 shares with a $39.00 average:

SplitShares afterAverage afterTotal cost
2-for-1120$19.50$2,340
3-for-1180$13.00$2,340
10-for-1600$3.90$2,340
1-for-10 (reverse)6$390.00$2,340

To adjust your buys, open Stock split in the calculator and type the split.

A part of a share is called a fractional share. Investor.gov says it is when you own less than one full share. The math is the same: 0.5 shares at $40 cost $20.

A reinvested dividend buys more shares, often a part of a share. Add it as its own row, with the dollars reinvested and the price that day. For fund shares, IRS Publication 550 says the cost is the amount of the payout used to buy them.

See what dividends you reinvest can add up to with the dividend calculator →

How to find your average stock price in Excel or Google Sheets

Put the shares in column A and the prices in column B, one buy per row. In an empty cell, type the formula below. SUMPRODUCT multiplies each pair and adds them up. SUM adds the shares. The answer is your average cost per share.

  1. Type your shares in cells A2 to A4 and the prices in B2 to B4.
  2. In an empty cell, type the formula shown under this list.
  3. Have more buys? Stretch both ranges to the last row.

=SUMPRODUCT(A2:A4,B2:B4)/SUM(A2:A4)

For the three buys in the example, the cell shows 39.

You can find the shares for a target average too. Put the shares you hold in D1, your average in D2, your target in D3 and the new price in D4. Then type this:

=D1*(D2-D3)/(D3-D4)

Google Sheets uses the same two functions.

See what money you add each month could grow to with the investment calculator →

What this calculator leaves out

This page does plain math on the numbers you type. It leaves these out:

  • Tax you may owe on a sale.
  • Dividends paid to you in cash.
  • Interest you pay on borrowed money, which is called margin.
  • Options, which are deals to buy or sell later at a set price.
  • Changes in currency rates.
  • The price you really get when an order fills.
  • Mergers and spin-offs.
  • Wash sale tracking.

Your broker's records are the official ones. Check your numbers against them.

Questions people ask

How do I calculate my average stock price?

Divide the total dollars you paid by the total shares you hold. For example, 20 shares at $40 and 30 shares at $34 cost $1,820 in all. That is 50 shares, so the average is $36.40 a share.

How do I calculate profit or loss on a stock?

Take what your shares are worth now and subtract what you paid in all, fees included. Say you paid $1,820 for 50 shares and the price is $40. They are worth $2,000, so you are up $180. Divide by what you paid for the percent: about 9.9%. A minus answer is a loss.

Does averaging down reduce my loss?

No. Buying more shares does not change the dollars you have lost so far. It lowers your average cost, so a smaller rise gets you back to even. If the price falls again, your loss grows faster, because you own more shares.

Does my average cost include fees and commissions?

It should. The IRS counts what you paid plus the costs of buying, such as commissions, as your basis. A $5 fee on a $500 buy adds 1% to your cost. Turn on fees in the calculator to count them.

What happens to my average cost after a stock split?

The total you paid stays the same, but it is spread over a new number of shares. In a 2-for-1 split, 60 shares at a $39.00 average become 120 shares at $19.50. Your total cost is still $2,340.

Does this calculator work for crypto, ETFs and mutual funds?

Yes. The average math is the same for anything you buy in units. Type the units and the price for each buy. Parts of a unit work, down to 8 decimal places. Tax rules differ by what you own, so check the IRS rules for yours.

More calculators

See this with your real accounts

Connect your accounts and we keep the numbers up to date for you.

Connect accounts

Reviewed by Tavish Sharma, CFA · Last reviewed

Published by Amaltash Advisors LLC, an SEC-registered investment adviser

Sources

Get started