Investing & Returns · Formula v1.0

Stock Profit Calculator

Calculate net stock gain or loss after trading fees.

Keep average cost and transaction charges in the return. 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. Net profit is what you actually made after costs, and return on cost puts it in proportion. On the example, 100 shares bought at $40 and sold at $55 makes $1,480 after trading fees, a 36.9% return on the amount paid. Compare that with how long you held the stock, since a 37% gain in a year and in eight years are very different. 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

A stock sale's headline gain and its actual profit are two different numbers once trading fees enter on both ends: the buy and the sell each typically carry their own cost, and both need subtracting before the real return shows up. On a small trade with a flat per-transaction fee, that combined cost can consume a disproportionate share of a modest gain.

Before you rely on it

What to check

Include both the purchase-side fee and the sale-side fee in the calculation, not just one. Both were paid, and both reduce the real return.

The common error

Where people go wrong with stock profit calculator

Computing gain from price difference alone and ignoring transaction costs entirely. On frequent, smaller trades, the accumulated fees can turn a series of profitable-looking trades into a net loss once actually totaled.

Sensitivity evidence

How shares changes the net profit or loss

Stock Profit 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 Profit 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 Profit 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 profit 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

Shares is the number sold, average buy price is your cost per share including any earlier purchases averaged together, and sale price is what each share sold for. Trading fees are the total commissions and regulatory fees on both buying and selling. If you bought in lots at different prices, the tax basis depends on which lots your broker treats as sold, so use the cost basis on your confirmation.

Using the net profit or loss in a real decision

Then subtract the tax you will owe to see what you keep.

When the result stops applying

The result is before tax. A gain on shares held under a year is taxed as ordinary income in the United States, while longer holds get lower long-term rates. It ignores dividends received, which belong in a total return, and it assumes one buy price. Wash-sale rules apply to losses if you buy the same stock within 30 days.

What to compare it with

For several purchase lots, the average stock cost calculator finds the blended price. For total return including dividends use the investment return calculator, and the annualized return page for the yearly rate. To plan the tax effect, the capital gains tax calculator estimates the bill.

People also ask

Frequently asked questions

Do trading fees matter?

Many brokers charge no commissions on stock trades now, but regulatory fees, spreads and any account charges still reduce the gain. On small trades even a few dollars matter.

How is the gain taxed?

In the US, stock held for more than a year is taxed at long-term capital gains rates, which are lower than the rates on shorter holds, and losses can offset gains.

Should I include dividends in profit?

Yes, if you want total profit. Dividends received while you held the stock are income in addition to the price gain and are taxed separately.

Common investing & returns questions

Sources and evidence