Home › Finance › 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
initial_investment | number | yes | Outlay at time 0, entered as a positive number. Range: > 0, ≤ 1000000000000000 | |
cash_flows | number_list | yes | Net cash flow at the end of periods 1, 2, 3 … (negative values allowed). |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
irr_percent | number | % per period | Rate at which NPV = 0 (annual if the cash flows are yearly). |
net_undiscounted_gain | number | Σ cash_flows − initial_investment (NPV at 0 %). | |
total_cash_flows | number | Σ cash_flows. | |
number_of_periods | integer | Length of cash_flows. | |
sign_changes | integer | Sign 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
- API:
GET https://tttkmbb.com/api/v1/calculate/irr(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/irr · Markdown: https://tttkmbb.com/finance/irr.md · JSON definition: https://tttkmbb.com/finance/irr.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="irr" - OpenAPI operationId:
calculate_irr - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
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
- NPV Calculator — Value of the same cash flows at a chosen rate.
- CAGR Calculator — Return between a single start and end value.
- ROI Calculator — Simple total return without timing.