Stock profit calculator guide

How to Calculate Annualized Stock Return and XIRR

Annualized return places gains and losses from different holding periods on a yearly scale. For a position with irregular dated cash flows, XIRR uses the timing and amount of every relevant purchase, sale, and dividend.

Quick answer

How does the calculator annualize a stock return?

For one purchase and one sale, the calculator compounds the total return over the entered holding period. With Position history and complete dates, it solves for the annual rate that makes the net present value of all modeled cash flows equal to zero.

Annualized return=(1 + Total return)365 / days held-1
Annotated stock profit calculator result showing annualized return over exact purchase and sale dates, cost basis, and net proceeds
The arrows identify the annualized result based on exact purchase and sale dates and the main cash amounts used in the return calculation.
  1. 1

    Exact-date annualization. The 19.78% result uses the displayed August 30, 2025 to August 30, 2026 holding period.

  2. 2

    Negative cash flow. Total cost basis is the purchase-side cash outflow assigned to the modeled sale.

  3. 3

    Positive cash flow. Net proceeds are the sale-side cash inflow after the Sell commission.

One purchase and one sale

Annualize a return from the holding period

The default example produces $1,980 in Net profit on $10,010 of cost basis, or 19.78% ROI.

If the same total return occurred over six months, the annualized result is approximately (1 + 0.197802)2 - 1 = 43.47%. This is a mathematical rate for comparison, not a forecast that the trade will repeat.

Enter exact Purchase date and Sale date when available. The quick workflow uses the Actual/365 Fixed convention; a month count remains an estimate of the holding period.

Six-month example

19.78% total return becomes 43.47% annualized

Compounding a six-month result to a yearly rate can create a much larger percentage. That does not mean the position actually earned 43.47% in dollars.

Cost basis
$10,010.00
Net profit
$1,980.00
Total ROI
19.78%
Holding period
6 months
Annualized return
43.47%

Irregular cash flows

Use XIRR for multiple dated transactions

A position built over time cannot be annualized accurately as if all capital was invested on the first purchase date.

1. PURCHASES

Record negative cash flows

Each purchase value and its Buy commission is placed on the purchase date.

2. DIVIDENDS

Record dated inflows

Each dividend is a positive cash flow on its payment date.

3. SALES

Record net proceeds

Included previous sales and the current modeled sale are positive dated cash flows.

4. SOLVE

Find the zero-NPV rate

XIRR finds an annual rate that discounts the combined cash-flow series to zero.

For a position with several buys, continue with How to Calculate Stock Profit with Multiple Purchases.

Dated cash-flow example

Two purchases, a dividend, and one sale produce a 12.65% XIRR

Assume $6,000 is invested on January 1, 2025, another $4,000 on July 1, a $200 dividend is received on September 30, and the sale returns $10,800 on January 1, 2026.

Total positive cash flow is $11,000, so the simple gain is still $1,000 on $10,000 invested. XIRR is approximately 12.65% because the second $4,000 was invested for about half the period and the dividend arrived before the final sale.

Cash flows used in the XIRR example
DateTransactionCash flowXIRR treatment
January 1, 2025First purchase-$6,000.00Negative on purchase date
July 1, 2025Second purchase-$4,000.00Negative on purchase date
September 30, 2025Dividend+$200.00Positive on payment date
January 1, 2026Net sale proceeds+$10,800.00Positive on modeled sale date

Required dates

Why XIRR may be unavailable

Missing dates

Every relevant purchase, included sale, dividend, and current sale needs a valid date.

Invalid chronology

A dividend must occur after the earliest relevant purchase and no later than the modeled sale.

No sign change

The cash-flow series must contain at least one negative value and one positive value.

No valid solution

Some non-conventional cash-flow patterns may have no solution or more than one theoretical internal rate of return.

Which return measure the calculator uses
MeasureInputsWhat it answersMain limitation
ROIProfit and assigned basisTotal gain or loss relative to invested basisDoes not reflect time
Annualized returnOne purchase, one sale, holding periodEquivalent compounded yearly rateAssumes one starting investment
XIRRFully dated irregular cash flowsAnnual rate that sets modeled NPV to zeroRequires valid dates and a solvable cash-flow series

Methodology and references

Interpret annualized returns as comparison metrics

Annualized return and XIRR describe modeled historical or hypothetical cash flows. They are not predictions, tax results, or guarantees of future performance.

Related calculator guides

Connect return timing with transaction history

Use these guides to enter multiple purchases, dated dividends, and the net profit used in the return calculation.

Ready to calculate annualized return or XIRR?

Use the Stock Profit Calculator