This XIRR Calculator computes the annualized internal rate of return (XIRR) from dated cash flows plus an optional final value at maturity. It solves the discount rate that sets net present value (NPV) of all flows to zero, using actual day gaps.
Introduction
XIRR is the annual rate r that makes the present value of irregularly dated amounts sum to zero. Two modes are available: Uniform Contributions (same contribution on a fixed schedule between Start Date and Maturity Date) and Irregular Cash Flows (you enter specific dates and amounts).
Sign convention: investments/outflows are negative; withdrawals/returns are positive. Calculations use day-count based exponents (actual days ÷ 365) and are solved numerically.
How to Use the XIRR Calculator
Follow these steps to enter cash flows correctly and interpret the results.
Pick a Mode.
Choose Uniform Contributions for equal investments on a set schedule, or Irregular Cash Flows to input arbitrary dates and amounts. This determines how flows are created.
Uniform Contributions setup.
Select Contribution Frequency, Start Date, and Maturity Date; enter Contribution Amount (treated as an outflow) and Final Value (at maturity) (a positive return). This builds dated flows automatically.
Irregular Cash Flows setup.
Enter each Date and Amount in Cash Flows. Use negative values for investments and positive for returns; click + Add Cash Flow for more entries. Add Final Value (at maturity) if applicable.
Precision.
Toggle Show decimals to switch the display precision; it does not change the underlying math.
Calculate.
Click Calculate to solve for XIRR (annual). Review Number of Flows, Days Span, Total Invested, Total Returned, and NPV at XIRR (~0) to sanity-check your inputs.
Interpret the rate.
A positive XIRR indicates overall gain; negative means loss. Remember it is annualized based on actual-day timing, not just a simple average.
Adjust and compare.
Modify dates or amounts (or Contribution Frequency in uniform mode) to test scenarios; use Clear to reset. Formulas used General definition (all flows, including final value as the last positive amount):
Uniform contributions (contribution amount each period; final value at maturity):
Frequently Asked Questions
What is XIRR?
XIRR is the annualized internal rate of return for cash flows that occur on irregular dates. It is the single effective annual rate that makes the net present value (NPV) of all dated cash flows equal to zero.
How is XIRR different from IRR?
IRR assumes equal time spacing between cash flows (e.g., monthly or yearly). XIRR uses the actual calendar dates between flows, weighting time by days, so it handles uneven timing and leap years.
What sign convention should I use?
Enter investments (money you pay in) as negative amounts and withdrawals/ending value as positive amounts. XIRR requires at least one negative and one positive cash flow.
What day-count does XIRR use?
Common implementations use an Actual/365 day-count where each cash flow is discounted by the exact number of days divided by 365. This tool follows that convention.
Why can XIRR fail or show multiple answers?
If cash flows change sign more than once, the NPV equation may have multiple roots or none in the meaningful range. Also, if all flows have the same sign or 1+r ≤ 0, no valid annual rate exists.
Why does XIRR differ from CAGR or statement returns?
CAGR assumes one deposit at the start and one value at the end. XIRR accounts for the size and timing of each deposit/withdrawal, which can materially change results.
How should I model fees and taxes?
Include them as dated cash flows: fees as negative amounts, tax refunds as positive. This keeps XIRR an apples-to-apples, cash-on-cash measure.
Can I compare two investments using XIRR?
Yes—compute XIRR for each set of cash flows under the same assumptions (currency, dates, fees). Higher XIRR indicates a higher annualized cash return, but also review risk and cash-flow patterns.
What precision and rounding are used?
Currency is rounded to 2 decimals. XIRR is shown as an annual percentage to 1–2 decimals by default.
What are common data-entry pitfalls?
Duplicate dates, missing a final value, reversed signs, or mismatched time zones. If two flows occur on the same date, combine them into one amount.
- Type: Finance (return metric).
- Goal: Solve for the annual effective rate (r) such that the dated cash-flow NPV equals zero.
- Modes supported:
- Uniform Contributions: Builds a schedule of equal contributions on a fixed frequency (e.g., monthly) from Start Date to Maturity Date, plus a final value at maturity. - Irregular Cash Flows: User supplies any number of
pairs and an optional final value. Cash-flow assembly
- Use amounts with datesCFi.Di
- Sign convention: investments negative, returns positive.
- For Uniform Contributions, create one flow per interval at the chosen frequency, all equal to , and add the terminal flow-Aat the maturity date.+ VT
Core formula (Actual/365)
- Let be the day count from the first cash flow dateti:D0.ti = days(Di − D0)
- XIRR r solves:
- Derivative for Newton steps:
Numerical solution
- Initial guess:
or 10% if unknown.
- Iterate Newton–Raphson: .rk + 1 = rk − f(rk) / f'(rk)
- If Newton diverges or , switch to bracketed bisection on ([-0.9, 10]).1 + rk le 0
- Convergence when or|f(r)| le 10-9 × sum |CFi|. Fail after max 100 iterations.|Delta r| le 10-10
Outputs
- XIRR (annual, effective) in percent.
- Number of flows (n+1).
- Day span (max(t_i)).
- Total invested (sum (-CF_i)^+).
- Total returned (sum (CF_i)^+).
- NPV at XIRR ≈ 0 (sanity check).
Conversions
- Monthly effective rate from XIRR: .im = (1 + r)1 / 12-1
- Daily effective rate (Actual/365): .id = (1 + r)1 / 365-1
Assumptions
- Day-count: Actual/365 fixed; cash flows occur end-of-day.
- Currency: USD; amounts rounded to $0.01.
- No automatic fees/taxes; include them as cash flows.
- If multiple flows on the same date, they are aggregated.
- Date range uses Gregorian calendar; leap years honored.
Validation & edge cases
- Require at least one negative and one positive flow.
- Duplicate or unsorted dates are normalized.
- If all flows same sign → not defined (no solution).
- Multiple sign changes may yield multiple mathematical roots; the algorithm returns the root within the searched bracket.
- If (1+r le 0) (e.g., \(r \le -100\%\)), fractional exponents become invalid; those regions are excluded.
Worked example
- Flows: on 2020-01-01;-$1,000on 2021-01-01.+ $1,100
- Days t= 366 (leap year 2020).
- Solve: -1000 + 1100 / ((1 + r)366 / 365) = 0 Rightarrow (1 + r)366 / 365 = 1.1annual. Implementation tips1 + r = 1.1365 / 366 approx 1.0977Rightarrow r approx 9.77%
- Use high-precision floats; scale cash flows to avoid overflow.
- Provide user-controlled decimal display but compute at full precision.
- Show residual NPV to help users diagnose data issues.
Sources & Methodology