Stock Calculator

Stock Calculator

Add your buys and sells, with fees, and see profit, average cost and break-even as you type, exact to the cent.

Main calculator

Calculators in this browser

Saved only in this browser. A /fork/ address doesn't carry the calculation to other browsers or devices — use Copy link to send it.

Type a ticker or a company name. The search runs in your browser.
Settings
Buy fee
Sell fee
Decimal places
Percent
Amounts
Shares

Enter your trades, or try an example above:

shares at each

One trade per line — shares@price, a leading minus means sell. Example: 100@50 or -40@65.

How to read this chart
  • Each column is one trade, in order from left to right. ▲ is a buy and ▼ is a sell, drawn at the price of that trade. On a computer, point at a column to see its details.
  • The solid line is your average cost per share after each trade. A buy pulls it up if its cost per share, including fees, is above the line, and down if that cost is below it. The price you sell at does not move it.
  • At each sell, a bar runs from what the sold shares cost you, fees included, to the sell price. That gap times the shares sold is the profit or loss you locked in, printed next to the bar in green for a gain and red for a loss.
  • Enter “Share price now” to add a dashed line at that price. The shaded band between it and your average cost is the unrealized profit or loss on the shares you still hold. If the price is far from your trades, the line sits at the edge with an arrow so the trades stay readable.
  • The bars at the bottom show how many shares you hold after each trade. The bright part is what a buy added, and a red outline is what a sell took away.
Total P/L
Open position (shares)
Average cost basis
Total invested
Realized P/L
Unrealized P/L
Return on investment
Break-even price
After-tax P/L (illustrative)
Keyboard shortcuts
b / s Set the focused trade to buy / sell
Tab / Shift+Tab Next / previous field
↑ / ↓ Step a value by 1 (Shift: 10, Alt: 0.1)
Enter Copy the primary result
[ / ] Fewer / more decimal places (percent)
Esc Clear the field

How to calculate stock profit, average cost, and break-even

Every position question reduces to three numbers, and the calculator above keeps all three live as your trade list grows:

The landers go deeper on each intent: a two-row profit calculator, an averaging tool with a target-average solver, a cost basis calculator for FIFO, LIFO and HIFO, risk-based position sizing, risk/reward ratios, a dividend-reinvestment projector, CAGR, and the break-even and loss-recovery tables. Keyboard users: b/s flip a trade's direction, arrows step values, Enter copies the result — the full map sits under the calculator.

Stock math FAQ

How do I calculate profit on a stock trade?

Profit = (sell price − buy price) × shares, minus commissions on both sides. Buying 100 shares at $50 and selling at $65 with $5 commissions each way makes (65 − 50) × 100 − 10 = $1,490. The stock profit calculator does exactly this; the calculator above handles any number of buys and sells in sequence.

How does this calculator work out average cost basis?

It uses the average-cost method, applied trade by trade: every buy adds its cost (including the buy fee) to the position, and every sell removes shares at the running average. Selling 5 of 10 shares bought at $100 leaves 5 shares still averaging $100. Brokers and tax authorities often track individual lots instead: the cost basis calculator runs the same trades under FIFO, LIFO and HIFO, and the average-cost article explains the trade-offs.

What does the break-even price include?

Everything you have paid: share cost plus buy commissions, plus the sell commission you would pay to exit. With a flat sell fee it is (total cost + fee) ÷ shares; with a percentage fee the divisor shrinks instead. That is why break-even always sits above your average cost — the break-even calculator shows how far.

Why does a 50% loss need a 100% gain to recover?

Because the gain acts on a smaller base. A $200 position that loses 50% is worth $100; doubling $100 only gets back to $200. The required gain is loss ÷ (1 − loss), which grows viciously: −20% needs +25%, −50% needs +100%, −95% needs +1,900%. The recovery table lists the whole curve.

Does the currency selector convert my numbers?

No — it only formats the display ($, HK$, €, ¥, CN¥, £, ₿, ₩, S$, CA$, A$), with each currency's own decimal convention. Converting between currencies would need live exchange rates, and this site deliberately fetches no market data: your numbers never leave the browser.

Is this investment advice?

No. These are educational calculators: they do arithmetic on numbers you type, fetch no market data, and recommend nothing. The tax field applies a single illustrative rate — real capital-gains rules vary by country and holding period. The about page spells out the full methodology and posture.

Worked examples

all examples + sources →

Historical scenarios for exploring the math — not recommendations.

Articles

all →

Releases

all →

How to read your trades

Video tutorial · English with captions · 4:37

The player loads from youtube-nocookie.com only when you open it. Watch on YouTube ↗