Skip to content

Stock Portfolio Calculator

✦ Finance & Money

Use this free stock portfolio calculator to see total gain or loss, return percentage and weight for each holding across your full portfolio — with optional dividends per position and annualised return when you add a holding period.

  • ✓ Calculated in your browser
  • ✓ Nothing you type is stored
  • ✓ No sign-up required
  • ✓ Formula and sources shown

The formula

Portfolio value, gain/loss, weight and annualised return

Cost basis_i     = Shares_i x Cost per share_i + Commission_i
Current value_i  = Shares_i x Current price_i
Total received_i = Current value_i + Dividends_i
Gain / loss_i    = Total received_i - Cost basis_i
Return_i (%)     = Gain / loss_i / Cost basis_i x 100
Weight_i (%)     = Current value_i / Σ Current value_j x 100
Portfolio return = (Σ Total received - Σ Cost basis) / Σ Cost basis x 100
Portfolio CAGR   = (Σ Total received / Σ Cost basis)^(1 / years) - 1

Weight is calculated from current value, not cost basis — this is the standard convention for portfolio reporting because it reflects your live exposure. Portfolio CAGR assumes all positions were opened and are valued on the same date; it is a simple compound rate, not an IRR. Taxes, stock splits, corporate actions and currency effects are not modelled. The sample holdings (Stock A, B, C) are illustrative, not quotes.

Calculating it by hand

  1. Enter the name, number of shares, cost per share and current price for each holding (up to 10).
  2. Add optional cash dividends received (not reinvested) for any holding.
  3. Add or remove rows until all your positions are entered.
  4. Open Advanced to set the holding period in years (3 by default) for the portfolio annualised return (CAGR), and to add commissions.
  5. Read the weight column to see how much each position represents of your total portfolio by current value.
  6. Compare total return (including dividends) with price return (excluding dividends) to see how much income contributed to your result.

Worked examples

Three-position portfolio with one losing stock (the sample holdings)

  1. Stock A: 50 shares × $142 cost = $7,100 cost basis; 50 × $185 = $9,250 current value. Gain $2,150; return +30.28%.
  2. Stock B: 30 × $280 = $8,400 basis; 30 × $415 = $12,450 current. Gain $4,050; return +48.21%.
  3. Stock C: 25 × $38 = $950 basis; 25 × $28 = $700 current; $50 dividends. Total received $750. Loss −$200; return −21.05%.
  4. Totals: cost basis $16,450; current value $22,400; dividends $50; total gain = $22,400 + $50 − $16,450 = $6,000.
  5. Portfolio return = $6,000 ÷ $16,450 = 36.47%; over the default 3-year holding period, CAGR = ($22,450 ÷ $16,450)^(1/3) − 1 = 10.92%.

Total cost basis $16,450; current value $22,400; total gain including dividends $6,000; portfolio return +36.47% (10.92% a year over 3 years).

Two-position portfolio with a 3-year CAGR

  1. Stock A: 100 × $50 cost = $5,000 basis; 100 × $65 = $6,500 current; $180 dividends. Total received $6,680.
  2. Stock B: 50 × $80 cost = $4,000 basis; 50 × $90 = $4,500 current; no dividends. Total received $4,500.
  3. Total cost $9,000; total received $11,180; gain $2,180; return = $2,180 ÷ $9,000 = 24.22%.
  4. CAGR over 3 years = ($11,180 ÷ $9,000)^(1/3) − 1 = 1.242222^0.3333 − 1 = 7.50%.
  5. Weights: Stock A = $6,500 ÷ $11,000 = 59.09%; Stock B = $4,500 ÷ $11,000 = 40.91%.

Portfolio return +24.22%; 3-year CAGR +7.50%. Stock A weight 59.09%; Stock B weight 40.91%.

Single position at a full loss (current price $0)

  1. Position: 100 shares × $40 cost = $4,000 basis; 100 × $0 = $0 current; no dividends.
  2. Gain or loss = $0 − $4,000 = −$4,000; return = −$4,000 ÷ $4,000 = −100.00%.
  3. CAGR is blank: with nothing received there is no positive ending value to compound to.

Net loss $4,000.00; total return −100.00%; annualised return not available.

Methodology

How portfolio return is calculated

The gain percentage on a broker statement usually omits dividends and shows price return only. Cost basis, dividends and time together tell a different story — and weight reveals which positions actually drive your result.

Read sources and limits

What do portfolio value and portfolio return measure?

Portfolio value is the sum of every position's current market value — shares held times the current price, added across all holdings. It is not what you paid and not your profit; it is what the positions are worth at the prices you enter. The calculator keeps cost basis and current value separate so you can see the gap.

Portfolio return is the gain or loss as a percentage of what you invested. The total return here includes cash dividends you received, because they are part of the result of holding a stock; with dividends left at zero you see the price return only. Both figures are shown, so you can see how much income contributed.

How do you calculate gain or loss on each stock holding?

Cost basis is shares × purchase price plus any commission. Current value is shares × current (or target sale) price, and adding cash dividends received gives the total received. Subtract cost basis from total received for the dollar gain or loss, and divide by cost basis for the percentage return — the same steps for every row.

A position with a $5,000 cost basis, a $6,200 current value and $180 of dividends has a total return of ($6,200 + $180 − $5,000) ÷ $5,000 = 27.60%; without the dividends the price return is 24.00%. For income stocks, leaving dividends out understates the return by several points.

What does portfolio weight tell you about each position?

Portfolio weight is each position's share of the portfolio's current value: a $12,000 position in a $60,000 portfolio has a 20% weight. It is based on current value, not cost, so it reflects your live exposure and shifts as prices move — a stock that rises sharply gains weight even if you never add to it.

Weight shows how much one position can move the whole: a holding at 35% weight that gains 20% adds 7 points to the portfolio return, while the same gain on a 5% holding adds 1. Comparing weights also shows whether the portfolio is balanced or concentrated, a risk that the return percentage alone does not reveal.

How do you calculate the annualised return of a stock portfolio?

Annualised return, or CAGR, is the constant yearly rate that turns the total cost into the total received over the holding period: (total received ÷ total cost)^(1 ÷ years) − 1. Set the holding period under Advanced (3 years by default); the figure is blank when the total received is zero.

It is a simplification: one holding period for every position assumes they were all bought and are all valued on the same dates. When entry dates differ widely, the figure is an approximation of the portfolio rate. For a precise money-weighted return with dated purchases and sales, a spreadsheet XIRR is the right tool.

What does this stock portfolio calculator not model?

It is a snapshot at the prices you enter. It does not know your account type, how long each lot has been held, or whether an account is taxable. Capital-gains and dividend taxes, wash-sale rules, account fees, margin interest, stock splits, spinoffs and currency effects are all outside the model, and no live prices are retrieved.

With current quotes the result is a mark-to-market estimate of an open portfolio; with historical prices it is a completed-period return. Either way it is an educational estimate based on the values you enter, not an account statement, and not investment, tax, legal or financial advice. Investing involves risk, including possible loss of principal.

Stock Portfolio questions

How do I calculate my stock portfolio return?

Add the cost basis of every position (shares × purchase price + commissions) for the total cost, and the current values (shares × current price) plus cash dividends received for the total received. The gain is total received minus total cost, and the return is the gain divided by total cost. The sample portfolio here: $6,000 gain on $16,450, a 36.47% return.

How do I calculate the weight of a stock in my portfolio?

Divide the position's current value by the portfolio's total current value and multiply by 100: a $12,000 position in a $60,000 portfolio is a 20% weight. Weight uses current value, not cost, because it reflects your live exposure; a stock that has risen sharply carries more weight than its cost suggests, which is why checking weights is part of portfolio monitoring.

How do I calculate annualised return for a portfolio?

Use (total received ÷ total cost)^(1 ÷ years) − 1, with the holding period set under Advanced. A 24.22% total return over three years is a CAGR of 7.50%; the sample portfolio's 36.47% over three years is 10.92% a year. The figure is blank when the total received is zero, and it assumes one holding period for every position.

Does this calculator include dividends?

Yes. Each row has an optional Dividends field for the cash dividends received from that position and not reinvested. They are added to current value before the gain and return are computed, giving total return rather than price return. Do not enter reinvested dividends: the extra shares they bought are already in the share count and current value.

What is the difference between this and a portfolio allocation calculator?

This calculator measures performance: how much each position and the whole portfolio have gained or lost against what you paid, and each position's weight. A portfolio allocation calculator measures drift from target percentages and the buys and sells needed to rebalance. Use this page for gain, loss and return; use the Portfolio Allocation Calculator for drift and rebalancing.

How do I calculate portfolio return with multiple stocks?

Sum the cost basis, the current values and the dividends across all stocks, then apply (total received − total cost) ÷ total cost. This weights each position by its dollar size, so large positions move the result more than small ones; it differs from a simple average of the individual returns unless every position cost the same.

What is the difference between time-weighted and money-weighted return?

Time-weighted return measures how the investments performed, ignoring when money was added or withdrawn, by chaining the returns between cash flows; fund managers are judged on it because they do not control deposits. Money-weighted return (IRR, or XIRR in a spreadsheet) measures how your money performed, so adding cash before a rise helps it. Brokers label these differently, so check which your statement shows.

How do I calculate portfolio return if I added money during the year?

A simple gain over cost understates the return, because the new money was invested for only part of the year. The Modified Dietz method weights each contribution by the share of the period it was invested: start $50,000, add $10,000 at mid-year, end at $66,000. Gain = $6,000; weighted capital = $50,000 + $10,000 × 0.5 = $55,000; return = 10.9%, against 10.0% on a $60,000 base.

Which cost basis method should I use: FIFO, average cost or specific identification?

For tracking performance it does not matter; use the total you paid. For taxes it decides which lots you are treated as selling. First in, first out is the IRS default for stock and usually sells the oldest, lowest-cost shares first. Specific identification lets you choose lots if you identify them to your broker at the time of sale; average cost is generally limited to mutual fund and dividend-reinvestment shares (IRS Publication 550).

What is the difference between realised and unrealised gains in a portfolio?

An unrealised gain is the paper profit on a position you still hold — current value minus cost basis — and can shrink before you sell. A realised gain is locked in by a sale and is the only kind on your tax return. 100 shares bought at $50 and now at $70 show a $2,000 unrealised gain; sell 40 and $800 is realised while $1,200 stays unrealised.

How much of my portfolio should be in a single stock?

There is no rule, but weight is the number to watch: $15,000 in one stock in a $60,000 portfolio is a 25% weight, so a 40% fall in that company removes 10% of the whole portfolio. Concentration risk is greater still when the stock is your employer's, because your income depends on the same company. Weights drift as prices move, so review them periodically, not only at purchase.

How do I calculate the expected return of a portfolio from its weights?

Multiply each holding's weight by its expected return and add the results: 60% in a stock fund expected to return 8% and 40% in a bond fund at 4% gives 0.60 × 8% + 0.40 × 4% = 6.4%. Use current weights, not cost weights. The same formula with realised returns gives a completed period's return; it says nothing about risk, since two portfolios with a 6.4% expected return can behave very differently.

Source notes

Method, sources & limitations

Every figure on this page comes from the formula above applied to the values you enter. Nothing is estimated from market data, and no result is a forecast. These are the sources behind the method and any fixed figures it uses:

Educational information only. Results are estimates produced from the assumptions you enter, and are not financial, tax, legal or medical advice. Check anything that matters against a qualified professional and the cited sources.