CalcOpenly
English

XIRR calculator (irregular cash flows)

Calculate XIRR, the annualized return on cash flows made on irregular dates, and XNPV at your discount rate, matching Excel's actual/365 method.

Drafted with AI writing toolsUpdated Checked examples: 5

One per line: date as YYYY-MM-DD, then the amount. Money you put in is negative, money you take out (or the current value) is positive.
%
Try
XIRR (annualized)
%
XIRR (annualized): 11.71 %
Maximum decimal places: 2; Nearest, ties away from zero
XNPV at the discount rate
$788.66
Total paid in
$12,500.00
Total received
$15,300.00
Net gain
$2,800.00
Days from first to last flow
731

Over 731 days these flows earn 11.71% a year (XIRR). Discounted at 8% a year to 2024-01-15, they are worth $788.66.

Cash flows by date

2024-01-15: −$10K−$10K2024-01-152024-07-01: −$2,500−$2,5002024-07-012025-03-10: $1,500$1,5002025-03-102026-01-15: $13.8K$13.8K2026-01-15

XNPV at different annual rates

−$2,000$0$2,000$4,000$6,000-10%0%10%20%30%Annual rateXNPVXNPV = 0Discount rateXIRR 11.71%
Cash flows Rows: 4
DateDays from startYears (÷ 365)AmountDiscount factorPresent value
2024-01-1500−$10,000.001−$10,000.00
2024-07-011680.4603−$2,500.000.9652−$2,412.99
2025-03-104201.1507$1,500.000.9153$1,372.88
2026-01-157312.0027$13,800.000.8572$11,828.78
How it's calculated S
  1. Time from the first date in years

    ti=di−d0365,tlast=731365=2.00274t_i = \frac{d_i - d_0}{365},\quad t_{\text{last}} = \frac{731}{365} = 2.00274

    Flows are sorted by date; the earliest is t = 0. Actual days over 365, as in Excel's XIRR and XNPV, even across leap years.

  2. XNPV at the discount rate

    XNPV=−10,000(1+r)0+−2,500(1+r)0.4603+1,500(1+r)1.1507+13,800(1+r)2.0027=788.66,r=0.08XNPV = \frac{-10{,}000}{(1+r)^{0}} + \frac{-2{,}500}{(1+r)^{0.4603}} + \frac{1{,}500}{(1+r)^{1.1507}} + \frac{13{,}800}{(1+r)^{2.0027}} = 788.66,\quad r = 0.08
  3. Solve for the rate that makes XNPV zero

    ∑iPi(1+XIRR)ti=0  ⇒  XIRR=11.709437%\sum_i \frac{P_i}{(1+XIRR)^{t_i}} = 0 \;\Rightarrow\; XIRR = 11.709437\%

    Bracketed on a rate grid, narrowed by bisection, then refined with Newton's method: 16 steps, |XNPV| = 1 × 10⁻⁴⁵ at the root.

About the XIRR calculator

XIRR is the yearly rate r that makes dated cash flows net to zero when each one is discounted by (1 + r)^(days since the first flow ÷ 365). It is the money-weighted return for an investment with deposits and withdrawals on irregular dates, such as a fund topped up now and then or a monthly SIP. XNPV applies the same discounting at a rate you choose and values every flow on the earliest date.

With the defaults, 10,000 invested on 15 January 2024, 2,500 more on 1 July 2024, 1,500 taken out on 10 March 2025 and a value of 13,800 on 15 January 2026, the XIRR is 11.71% a year. Discounted at 8%, the flows are worth 788.66 on the first date, and the net gain is 2,800 over 731 days.

Enter money you put in as negative and money you take out, including today's value, as positive. As in Excel, days are counted exactly and divided by 365, leap years included.

How XIRR is calculated

XIRR is the annual rate r at which dated cash flows net to zero, each discounted by (1 + r)^(days from the first flow ÷ 365). 1,000 invested on 1 January 2023 and worth 1,100 a year later gives 10%. It suits money moved on irregular dates.

Worked example: two deposits, a withdrawal and a final value

Take 10,000 invested on 15 January 2024, 2,500 more on 1 July 2024, 1,500 taken out on 10 March 2025 and a value of 13,800 on 15 January 2026. Count each flow's days from the first date and divide by 365:

  • 15 January 2024: −10,000 at 0 years
  • 1 July 2024: −2,500 at 168 days, 0.4603 years
  • 10 March 2025: +1,500 at 420 days, 1.1507 years
  • 15 January 2026: +13,800 at 731 days, 2.0027 years

XIRR is the rate that makes −10,000 − 2,500 ÷ (1 + r)^0.4603 + 1,500 ÷ (1 + r)^1.1507 + 13,800 ÷ (1 + r)^2.0027 equal zero. Solving by trial gives 11.71% a year.

The net gain is 2,800 on 12,500 paid in, or 22.4%. That simple figure ignores timing: the 2,500 was invested for only 563 days, and 1,500 came back early.

XNPV: value at a discount rate you choose

XNPV uses the same discounting at a fixed rate and values every flow on the earliest date. At 8%, these flows are worth 788.66, so they beat an 8% alternative. At the XIRR itself, XNPV is zero.

Why a leap year changes the result

Days are counted exactly and always divided by 365, so a year containing 29 February counts as 366 ÷ 365 years. Both rows below invest 1,000 and receive 1,100, with XNPV at 10%:

Actual day intervalXIRR (%)XNPV at 10%
36510.0000000.00
3669.971359-0.26

The first runs from 1 January 2023 to 1 January 2024; the second spans 2024, so XIRR is 1.1^(365/366) − 1 = 9.971359%. Excel's XIRR and XNPV functions use the same actual/365 count.

Microsoft's published example, −10,000 on 1 January 2008 followed by four receipts over 456 days, gives 37.34%; to six decimals the rate is 37.336253%.

XIRR vs IRR vs CAGR

  • IRR assumes flows exactly one period apart and returns a rate per period. Monthly flows give a monthly IRR, which still needs converting to a year.
  • CAGR covers one deposit and one final value. Over exactly 365 days it equals XIRR: 1,000 to 1,100 is 10% either way.
  • XIRR handles any number of deposits and withdrawals, weighting each amount by how long it was invested.

XIRR measures the return on your own money, so the timing of your deposits changes it. A fund's published return measures the fund's growth regardless of when you bought, which is why the two figures differ.

Common mistakes

  • Wrong signs. Money you put in is negative; withdrawals, dividends paid out and the current value are positive. A series with only one sign has no XIRR.
  • Leaving out the current value. For holdings you still own, add today's value as a positive flow dated today. Dropping the final 13,800 from the worked example turns 11.71% into −87.57%.
  • Counting reinvested dividends twice. A reinvested dividend is already inside the current value, so list only dividends paid out to you.
  • Annualizing a short period. A 2% gain over 10 days is an XIRR of 106.02% a year. Short-period rates exaggerate both gains and losses.
  • Expecting one answer when signs flip repeatedly. Several rates can then make XNPV zero. The one closest to 10% is shown, with a warning.

Entering dated flows

  • Write one flow per line: the date as YYYY-MM-DD, a space, then the amount, as in 2024-01-15 -10000.
  • Lines can be in any order and can share a date; flows are sorted by date first.
  • Lines starting with # are ignored, so you can label entries.
  • A monthly SIP is twelve negative lines a year plus one positive line for the current value.

The rate search runs from −99.9% to 1,000% a year. A loss is a negative XIRR: 1,000 that is worth 900 a year later gives −10%.

For equally spaced periods, use the NPV and IRR calculator. The ROI and CAGR calculator handles a single start and end value, and the SIP calculator projects a monthly investment plan.

Worked examples

Microsoft XIRR example

Dated cash flows
2008-01-01 -10000 2008-03-01 2750 2008-10-30 4250 2009-02-15 3250 2009-04-01 …
Discount rate for XNPV (per year)
9%
XIRR (annualized)
37.336253%
XNPV at the discount rate
2,086.65
Days from first to last flow
456

Checked against: Microsoft XIRR documentation: 0.373362535; XNPV documentation at 9%: 2,086.65. exact decimal arithmetic bisection gives 37.3362533519% and 2,086.6476

Exactly one non-leap year

Dated cash flows
2023-01-01 -1000 2024-01-01 1100
Discount rate for XNPV (per year)
10%
XIRR (annualized)
10%
XNPV at the discount rate
0.00

Checked against: 365 days = 1 year under actual/365, so 1100/1000 − 1 = 10% and XNPV at 10% is 0

A leap year spans 366 days

Dated cash flows
2024-01-01 -1000 2025-01-01 1100
Discount rate for XNPV (per year)
10%
XIRR (annualized)
9.971359%
Days from first to last flow
366

Checked against: 1.1^(365/366) − 1 = 9.9713585934%

Break-even flows give 0%

Dated cash flows
2024-01-01 -1000 2024-07-01 400 2025-03-01 600
Discount rate for XNPV (per year)
0%
XIRR (annualized)
0%
XNPV at the discount rate
0.00
Net gain
0.00

Checked against: Inflows equal the outflow, so NPV at 0% is 0 by definition

Questions

What is XIRR and how is it different from IRR?

Both find the rate at which discounted cash flows sum to zero, but IRR assumes the flows are one period apart, while XIRR uses the actual date of each flow and returns an annual rate. For the default flows, spread over 731 days at uneven intervals, XIRR is 11.71% a year; an IRR on the same amounts would treat them as four equally spaced periods and give a different, per-period rate.

How does Excel calculate XIRR?

=XIRR(values, dates, [guess]) searches for the rate iteratively, measuring time as days ÷ 365, and returns #NUM! if it has not converged after 100 tries. Microsoft's example, −10,000 on 1 January 2008 followed by 2,750, 4,250, 3,250 and 2,750 over the next 456 days, gives 37.34%, which this page reproduces to 37.336253%.

What is the difference between XIRR and CAGR?

CAGR describes one deposit and one final value; XIRR handles any number of deposits and withdrawals. With a single flow in and out they agree when the gap is exactly 365 days: 1,000 growing to 1,100 in a year is 10% either way. Add a second deposit and only XIRR accounts for how long each amount was invested.

Why does XIRR change in a leap year?

Because XIRR divides the actual number of days by 365, a calendar year that contains 29 February counts as 366 ÷ 365 years. 1,000 growing to 1,100 from 1 January 2024 to 1 January 2025 therefore gives 1.1^(365/366) − 1 = 9.97%, not 10%, while the same growth across 2023 gives exactly 10%.

How do I calculate XIRR for a SIP or a fund with top-ups?

List every installment as a negative amount on the date it was invested, then add the current value as a positive amount on today's date. Twelve installments of 5,000 on the first of each month in 2025, worth 64,000 on 1 January 2026, give an XIRR of 12.48%: the 4,000 gain is large relative to the average time each installment was invested, about half a year.

About this calculator

∑iPi(1+XIRR)(di−d0)/365=0,XNPV=∑iPi(1+r)(di−d0)/365\sum_{i} \frac{P_i}{(1+XIRR)^{(d_i - d_0)/365}} = 0,\qquad XNPV = \sum_{i} \frac{P_i}{(1+r)^{(d_i - d_0)/365}}

Sources

  1. Microsoft Excel XIRR function
  2. Microsoft Excel XNPV function

For planning only. Lenders, tax authorities and markets apply their own rounding, fees and rules; confirm figures with them before you commit.

Checked against references

This calculator includes 5 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.

Put this calculator on your site

Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.

Height
Preview the embed

Keep the credit line. It is the only condition, and it is what keeps these calculators free.