Bought the same stock more than once? Type in up to three buys. You get your average cost per share, and your profit or loss at any price. You also see 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
What did your shares cost on average?
Bought the same stock more than once? Type each buy. You get your average cost for one share.
$
$
$
$
Shows your profit or loss.
$
Shares to buy at the price now.
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.
Buy 1: 20 shares$40.00
Buy 2: 10 shares$52.00
Buy 3: 30 shares$34.00
Your average$39.00
Price now$30.00
Dollars
What your 60 shares cost$2,340.00
What they are worth at $30.00$1,800.00
Loss at this price−$540.00 (−23.08%)
Shares at $30.00 to reach $36.0030 shares ($900.00)
Hypothetical illustration based on your inputs. Not a prediction, a recommendation, or the performance of any Amaltash strategy. Results change each time you change an input. Fees, taxes and costs are not included unless you enter them.
Try an example:
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.
In words: Add up what every buy cost, fees included. Divide by all the shares.
your average cost per share
the shares in buy i
the price paid in buy i
the fee on buy i, or 0
the number of buys
Here is a made-up example with three buys: 20 shares at $40, 10 at $52 and 30 at $34.
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 $50
Shares at $30
Real average
Plain average
Plain average is off by
90
10
$48.00
$40.00
−$8.00
75
25
$45.00
$40.00
−$5.00
50
50
$40.00
$40.00
$0.00
25
75
$35.00
$40.00
+$5.00
10
90
$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.
In words: Divide 1 by each price and add those up. Then divide the number of buys by that sum.
your average cost per share
the number of buys
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.
Type the shares and the price for each time you bought, up to three buys. The answer updates as you type. Parts of a share work too. Add the price now to see your gain or loss in dollars.
Type the shares and the price of each buy, oldest first.
Open “More options” and type the price per share now to see what your shares are worth.
Type the average you want to reach. You see the shares to buy at the price now.
Copy the page 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.
In words: Take the price now minus your average cost. Multiply by your shares.
your gain, or your loss when it is below zero
the shares you hold
the price of the new buy, or the price now
your average cost per share
This is a gain or loss on paper until you sell. Type a price in the “Price per share now” box, under “More options”, to see it. Here is the same holding at five prices:
Price
Value of 60 shares
Gain or loss
As a percent of cost
$52.00
$3,120
+$780
+33.3%
$45.00
$2,700
+$360
+15.4%
$39.00
$2,340
$0
0.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.
In words: Multiply the shares you sell by the sale price. Take away the sale fee. Then take away what those shares cost.
the shares you sell
the sale price
the sale fee, or 0
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.
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.
In words: Add the cost of the new shares to what you already paid. Divide by all the shares you hold now.
your average after the buy
the shares you hold
your average cost per share
the shares in the new buy
the price of the new buy, or the price now
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.
Measure
Before the buy
After 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.
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.
the shares in the new buy
the shares you hold
your average cost per share
the average you want to reach
the price of the new buy, or the price now
the fee on the new buy, or 0
Find the gap from your average to your target. $39 − $36 = $3.
Multiply by your shares. 60 × $3 = $180.
Find the gap from the target to the new price. $36 − $30 = $6.
Divide. $180 ÷ $6 = 30 shares.
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.
In words: Take the fee off the dollars you have. Divide what is left by the price.
the shares in the new buy
the dollars you want to spend
the fee on the new buy, or 0
the price of the new buy, or the price now
One rule holds at any prices. Call it the gap rule.
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.
the part of the gap you close, so one half is 0.5
the shares in the new buy
the shares you hold
your average cost per share
the average you want to reach
the price of the new buy, or the price now
Part of the gap you close
Shares to buy, as a multiple of what you hold
10%
0.11×
25%
0.33×
One third
0.5×
50%
1×
Two thirds
2×
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.
In words: Divide your average cost by the price now. Then take away 1.
the rise needed to get back to even, as a decimal
your average cost per share
the price of the new buy, or the price now
Price fell
Buy nothing
Buy half as many
Buy as many again
Buy twice as many
Buy 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 later
With no extra buy
With 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?
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.
Method
Cost of the shares sold
Gain or loss on this sale
Average of the 200 left
Gain or loss if the rest sells at $40
Total 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 sold
Cost of the 20 shares
Gain or loss
Average 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 calculator does not count a sale. Use the math above 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.
You hold 100 shares that you bought at $50.
The price falls. You buy 100 more at $30.
Within 30 days, you sell the first 100 shares at $32.
That sale is a loss of $1,800: 100 × ($50 − $32).
You cannot deduct the $1,800 now.
It is added to the cost of the new shares: $3,000 + $1,800 = $4,800, or $48.00 a share.
In words: Take what the new shares cost. Add the loss you could not deduct.
the cost basis of the new shares
the shares in the new buy
the price of the new buy, or the price now
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 and no sales, so it cannot spot a wash sale. 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 buy
A $5 fee adds
$100
5.00%
$250
2.00%
$500
1.00%
$1,000
0.50%
$5,000
0.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.
In words: Multiply your shares by the split. Divide your average cost by the same number.
new shares for each old share, so 2 in a 2-for-1 split
the shares you hold
your average cost per share
Here is what a split does to 60 shares with a $39.00 average:
Split
Shares after
Average after
Total cost
2-for-1
120
$19.50
$2,340
3-for-1
180
$13.00
$2,340
10-for-1
600
$3.90
$2,340
1-for-10 (reverse)
6
$390.00
$2,340
The calculator has no split box. Type each buy’s shares and price as they are after 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. Count it as its own buy, with the shares it bought and the price that day. For fund shares, IRS Publication 550 says the cost is the amount of the payout used to buy them.
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.
Type your shares in cells A2 to A4 and the prices in B2 to B4.
In an empty cell, type the formula shown under this list.
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:
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.
Fees, stock splits and sales.
A fourth buy or more.
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. The calculator has no fee box. To count a fee, divide it by the shares and add that to the price you type.
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.