Investing & Returns · Formula v1.0

Stock Average Cost Calculator

Measure profit or loss against an entered average purchase price.

Use the correct total cost basis. Enter average buy price in dollars, sale price in dollars and trading fees in dollars. At the worked-example inputs, the net profit or loss is $1,480. The blended cost is what you compare a current price with to see whether the position is up or down. Averaging down by buying more at lower prices lowers the blend and raises the price you need to break even less than you might expect, and it increases how much money is tied to one stock. Decide in advance how much of your portfolio one holding can be. It returns net profit or loss, return on cost.

FreeNo sign-upInputs stay in-browserCSV exportReviewed August 17, 2026
LAST REVIEWEDAugust 17, 2026Inputs stay in your browser
Live calculation

Enter your numbers

Calculated result
Net profit or loss$1,480
Return on cost36.9%
Sensitivity check

What if shares changes?

-10% input$1,330
0% input$1,480
+10% input$1,630

Transparent method

The formula

Net gain = sale proceeds − purchase cost − fees; return = net gain ÷ total purchase cost

Worked example

Net profit or loss$1,480
Return on cost36.9%

Example inputs

Shares100
Average buy price$40
Sale price$55
Trading fees$10

How to interpret the result

Average purchase price and total cost basis look similar but answer subtly different questions once trading fees and multiple purchase lots enter the picture, and using the wrong one of the two against an entered average price can produce a profit or loss figure that doesn't match what a brokerage statement or tax form actually reports.

Before you rely on it

What to check

Confirm the entered average price reflects the correct total cost basis, fees included, across all purchase lots, rather than a simple average of quoted share prices alone.

The common error

Where people go wrong with stock average cost calculator

Calculating profit or loss against a simple average of purchase prices that excludes trading fees or misses a purchase lot. The resulting figure can diverge from the actual cost basis a brokerage statement or tax form would show.

Sensitivity evidence

How shares changes the net profit or loss

Stock Average Cost Calculator: net profit or loss and return on cost across a range of shares, every other input held at the worked-example value.
SharesNet profit or lossReturn on cost
80$1,18036.8%
90$1,33036.8%
100worked example$1,48036.9%
110$1,63037.0%
120$1,78037.0%

Every input, tested

Which input moves the net profit or loss most

Stock Average Cost Calculator: net profit or loss with each input moved on its own, every other input held at the worked-example value.
InputTested fromToNet profit or loss at each endSwing
Sale price$50$61$980 to $2,080$1,100 (74%)
Average buy price$36$44$1,880 to $1,080$800 (54%)
Shares90110$1,330 to $1,630$300 (20%)
Trading fees$9.00$11$1,482 to $1,478$4.00 (0.3%)

Two variables at once

Net profit or loss by shares and average buy price

Stock Average Cost Calculator: net profit or loss at each combination of shares (rows) and average buy price (columns).
Shares \ Average buy price$32$40$48
80$1,820$1,180$540
90$2,050$1,330$610
100$2,280$1,480$680
110$2,510$1,630$750
120$2,740$1,780$820

Step by step

The worked example, input by input

Worked-example inputs and the results they produce for the stock average cost calculator.
InputValue used
Shares100
Average buy price$40
Sale price$55
Trading fees$10
Net profit or loss$1,480
Return on cost36.9%

Where the inputs come from

Use this when you bought the same stock at different prices. Enter the number of shares held, the blended average price you paid, and the price at which you would sell, plus total fees. To find the blended price, add the total dollars spent and divide by total shares, not the average of the prices. Brokerage cost-basis reports do this automatically.

When the result stops applying

The tax basis is not always the blended average: brokers default to specific methods such as first-in, first-out for shares, and average cost applies mainly to mutual funds. The lot you sell determines the taxable gain. The result also ignores dividends, splits and reinvested shares, each of which changes basis.

What to compare it with

Use the stock profit calculator for a complete profit figure and the stock split calculator if a split changed your share count. The position size calculator helps decide how much to add. Look at the cost-basis method in your brokerage settings before selling, since changing it later is usually not possible.

People also ask

Frequently asked questions

How do I calculate my average cost per share?

Divide the total dollars spent on all purchases, including fees, by the total shares owned. Averaging the prices instead gives the wrong answer when the share counts differ.

Does averaging down make sense?

It can lower your break-even, but it also increases exposure to a stock that has fallen. It makes sense only if you would buy the stock at the lower price anyway.

Which lots does my broker sell first?

Most default to first-in, first-out, but you can usually pick specific lots or another method, which affects your tax bill.

Common investing & returns questions

Sources and evidence