Skip to content
Investment Math
Investment Math

Currency and number style

Only changes how amounts look. There is no currency conversion.

Stock Profit and Loss explained: formula, worked example and common mistakes

Find out what you actually made or lost on a stock trade after broker fees, taxes, and currency impact. Free, no sign-up, your numbers stay in your browser.

Updated

What is a stock P&L calculator?

A stock profit and loss (P&L) calculator computes the actual return on a stock trade after every cost that eats into your gain. The headline return — the difference between your buy price and your sell price — is just the starting point. The real return is what you keep after broker commissions, exchange fees, taxes on gains, and (for international trades) currency conversion costs. The gap between the headline number and the actual take-home return is often several percentage points, which over hundreds of trades compounds into a meaningful drag on long-term performance.

The mechanics of P&L sound simple: you bought at 100, sold at 130, so you made 30 per share. But the actual calculation has to subtract every cost incurred along the way. Buy-side charges: brokerage commission, exchange transaction charges, regulatory fees, and (in some markets) stamp duty. Sell-side charges: the same again, plus whatever tax falls on the profit. Where brokerage itself is free, the explicit commission line item is often zero, but the regulator fees, the regulator TAF, and bid-ask spread are still present and reduce your actual return. In other markets the list is longer: a flat or percentage brokerage, a transaction tax, tax on the brokerage itself, stamp duty, exchange transaction charges, and the regulator turnover fees — which together often add up to 0.05-0.15% of the trade value.

The reason these costs matter so much is that they apply to both sides of the trade — buying and selling. A round-trip trade with 0.1% total charges effectively costs you 0.2% of the trade value. If your target return per trade is 2%, you’ve given up 10% of your expected gain to fees before you even start. Active traders who make 50+ trades a year can lose 5-10% of their capital annually to charges alone — a drag that few retail traders properly account for when they review their year-end statement.

A second, subtler cost is the bid-ask spread — the difference between the price buyers are willing to pay and the price sellers are willing to accept. When you buy at the ask and sell at the bid, you lose half the spread on each side. For liquid large-cap stocks, the spread may be a penny or two — negligible. For thinly traded small caps, the spread can be 1-2% of the price — a substantial cost that’s invisible unless you specifically calculate it. The P&L calculator handles explicit fees but cannot capture spread cost (because it depends on order type and market conditions); subtract an additional 0.05-0.5% for spread on small-cap trades.

The stock P&L formula

The after-charges profit on a stock trade is calculated as follows:

Step 1: Calculate gross profit (before charges)

Gross profit = (Sell price × Quantity) - (Buy price × Quantity)
= (Sell price - Buy price) × Quantity

Step 2: Subtract total charges

Total charges = Buy charges + Sell charges + Taxes on gains

Where:

  • Buy charges = brokerage + exchange fees + regulatory fees + stamp duty (buy-side)
  • Sell charges = brokerage + exchange fees + regulatory fees + stamp duty (sell-side)
  • Tax on the gain = the rate that applies to you × gross profit

Step 3: Calculate net profit and percentage return

Net profit = Gross profit - Total charges
Net return % = (Net profit ÷ (Buy price × Quantity + Buy charges)) × 100

Worked example:

You bought 50 shares at 100 each, paying 2 in buy-side charges. Six months later you sold at 130 each, paying 2 in sell-side charges. The holding period is short, and in this example the rate that applies to a short holding is 29% once every layer is added up.

Buy value = 100 × 50 = 5,000
Sell value = 130 × 50 = 6,500
Gross profit = 6,500 - 5,000 = 1,500

Charges:

  • Buy charges = 2
  • Sell charges = 2
  • Taxes on gains = 29% × 1,500 = 435 Total charges = 2 + 2 + 435 = 439
Net profit = 1,500 - 439 = 1,061
Net return % = (1,061 ÷ (5,000 + 2)) × 100 = 21.21%

So a 30% headline gain (the (130 - 100) ÷ 100 = 30% nominal return) becomes a 21.21% after-charges return — roughly 9 percentage points of give-back to fees and taxes. The 21.21% number is what actually hits your bank account; the 30% number is what your brokerage dashboard shows you before taxes.

The calculator runs this entire calculation. Open the calculator and enter your own trade details to see the gap between your headline return and your real take-home return.

When to use a stock P&L calculator (and when not to)

Use this calculator when:

  • You want to know the actual after-charges, after-tax return on a single stock trade.
  • You are comparing two brokers and want to see which one’s fee structure leaves you with more money on the same trade.
  • You are evaluating an active trading strategy and want to see how charges eat into your expected returns.
  • You are planning to sell a position and want to know in advance how much tax you’ll owe and what your net proceeds will be.
  • You are reconciling your year-end brokerage statement and want to verify the broker’s reported P&L matches your own calculation.

When NOT to use this calculator:

  • If you have multiple buy entries at different prices (e.g., cost averaging or scaling in), use the Averaging-Down Planner to find your blended cost basis first, then run the blended buy price through this calculator.
  • If you want the annualized return on a series of trades with irregular dates, use the XIRR Calculator. This calculator gives you the percentage return on a single round-trip trade, not an annualized figure.
  • If you are trading options, futures, or other derivatives, the P&L calculation is more complex and may involve margin, premiums, and exercise/assignment events. This calculator is for plain stock trades.
  • If you want to track performance over many trades (not just one), use a portfolio tracker or spreadsheet that aggregates across all positions.

Common mistakes people make

1. Ignoring charges on the buy side. Many traders remember the sell-side commission but forget the buy-side commission, understating their cost basis. Always enter both buy and sell charges — the calculator handles them on both sides of the trade.

2. Treating every holding period the same. Many countries tax a short holding differently from a long one, sometimes by a wide margin, with the line drawn at a specific length of time. Selling just before that line and just after it can produce two quite different net figures from the same trade — which is worth knowing about, and still not a reason on its own to hold something you have decided to sell. The after-tax return.

3. Forgetting the second layer of tax. Where a local, state or provincial tax sits on top of the national one, leaving it out understates the bill, sometimes badly. Add every layer that applies to you before putting the rate in.

4. Not accounting for the bid-ask spread. The calculator handles explicit fees but not the implicit cost of crossing the spread. If you buy at the ask and immediately sell at the bid, you lose the entire spread — typically 0.05% for large caps, 0.5% or more for small caps. For active traders, spread cost can exceed commission cost.

5. Calculating return on the wrong base. Some traders calculate their return percentage as (net profit ÷ sell value) instead of (net profit ÷ buy value + buy charges). The correct denominator is your total invested amount (buy value plus buy-side charges), not your sell value. The difference is small for short holding periods but grows meaningful over multi-year holds.

Frequently asked questions

How is stock profit calculated?

Gross profit = (sell price - buy price) × quantity. Net profit subtracts all charges: buy-side commissions, sell-side commissions, exchange fees, regulatory fees, stamp duty, and capital gains taxes. The net profit is what actually hits your bank account.

What charges apply to a stock trade?

Brokerage, exchange and regulator charges, any transaction taxes or stamp duty your market applies, and tax on the gain. Which of those exist, and at what rate, depends on your broker, your exchange and your country — so the calculator stores none of them and asks you to type each one.

How much tax do I pay on stock gains?

In many countries the rate depends on how long you held it, and the gap between the short and the long rate can be wide. The holding periods and the rates are local rules and none are stored here — look up what applies to you and type that rate into the charges.

Does this calculator handle dividend payments?

No. This calculator handles the price-change portion of your return only. If you received dividends while holding the stock, add them to your gross profit before running the calculation. The Dividend Yield and Yield on Cost Calculator handles dividend-specific calculations.

What is the bid-ask spread and why does it matter?

The bid-ask spread is the difference between the highest price a buyer will pay (bid) and the lowest price a seller will accept (ask). When you buy at the ask and sell at the bid, you lose the spread. For liquid large caps, the spread is pennies. For illiquid small caps, the spread can be 1-2% of the price — a substantial hidden cost.

Does the holding period change what a sale costs?

In many countries it does. Something held briefly is often taxed at a different rate from something held for years, and the gap can be wide enough to change what a sale is worth. The rules and the holding periods differ by country, and none are stored here — look up what applies to you and put that rate in the charges.

Does the calculator handle currency conversion for foreign stocks?

No. For trades in a foreign currency, you also need to account for the exchange rate at buy time and at sell time, plus any FX spread charged by your broker. Use the Currency Impact Calculator to model the FX portion of the return separately, then combine.

What if I bought the same stock at multiple prices?

Use the Averaging-Down Planner to calculate your blended cost basis first. Then enter the blended buy price in this calculator. The blended cost is the weighted average price you paid across all purchases, weighted by share count.

This tool shows math, not advice.

Cite this page

Copy this line into a reference list, a report or a spreadsheet note.

Investment Math Calculator. “Stock Profit and Loss Calculator”. Updated 2026-10-27. https://investmentmathcalculator.com/guides/stock-profit-and-loss-calculator/

Disclaimer: For education only. These calculators show arithmetic and hypothetical scenarios. They are not investment, tax or legal advice and do not recommend any security or product. Consult a licensed adviser in your country before acting.