HomeFinance › IRR Calculator

IRR Calculator

Solves numerically for the discount rate at which the net present value of an initial investment and its subsequent cash flows equals zero, and reports the undiscounted gain and the number of sign changes (a warning for multiple IRRs).

When to use

You want the annualized (per-period) return implied by an investment's cash-flow pattern, e.g. to compare projects or check a fund's stated return.

Do not use when: Cash flows change sign more than once (multiple IRRs may exist; use npv at your hurdle rate), or there are only two values (use cagr).

Formula

Solve −initial_investment + Σ_{t=1..n} cash_flows[t] / (1 + IRR)^t = 0 for IRR by bisection on (−99 %, 1000 %)

Bisection to machine precision on the NPV function, which is guaranteed to converge when the series has one sign change (conventional investment). The IRR is a per-period rate and assumes interim cash flows are reinvested at the IRR.

Inputs

ParameterTypeUnitRequiredDescription
initial_investmentnumberyesOutlay at time 0, entered as a positive number. Range: > 0, ≤ 1000000000000000
cash_flowsnumber_listyesNet cash flow at the end of periods 1, 2, 3 … (negative values allowed).

Outputs

OutputTypeUnitDescription
irr_percentnumber% per periodRate at which NPV = 0 (annual if the cash flows are yearly).
net_undiscounted_gainnumberΣ cash_flows − initial_investment (NPV at 0 %).
total_cash_flowsnumberΣ cash_flows.
number_of_periodsintegerLength of cash_flows.
sign_changesintegerSign changes in the series (−investment, CF_1 … CF_n); more than 1 means several IRRs can exist.

Example

−1,000 then 500, 400, 300: {"initial_investment":1000,"cash_flows":[500,400,300]}{"irr_percent":10.65,"net_undiscounted_gain":200,"total_cash_flows":1200,"number_of_periods":3,"sign_changes":1}

−10,000 then 3,000, 4,000, 5,000, 2,000: {"initial_investment":10000,"cash_flows":[3000,4000,5000,2000]}{"irr_percent":15.32,"net_undiscounted_gain":4000,"sign_changes":1}

GET https://tttkmbb.com/api/v1/calculate/irr?initial_investment=1000&cash_flows=500%2C400%2C300

Machine access

Sources

FAQ

Why can there be no IRR?

If the cash flows never turn positive (or the series never changes sign) NPV never crosses zero, so no rate satisfies the equation; the calculator returns CALCULATION_ERROR in that case.

IRR or NPV?

NPV measures value created at your required return and ranks mutually exclusive projects correctly; IRR is a convenient rate for comparing against a hurdle rate but can mislead when project sizes or timings differ.

Related calculators