logic.codes

NPV, IRR & Payback Calculator

When does my investment pay back, and what is its NPV and IRR?

Single calculationv1.1.0Verified 2026-11-01Runs in your browser

Spec sheet

dcf_npv_irr · v1.1.0
Method

Discounted cash flow

  1. 01NPV = Σ CFₜ / (1 + r)ᵗ, t = 0…N, CF₀ = −initial investment
  2. 02IRR: real roots of NPV(r) = 0, selected as numpy-financial does
  3. 03MIRR = (FV⁺ at reinvest rate / PV⁻ at finance rate)^(1/(n−1)) · (1 + r_reinvest) − 1
  4. 04Payback: first year cumulative cash flow ≥ 0 (linear within the year)
Limits — read before relying on it
  • Cash flows are assumed at year end.
  • IRR may not be unique when cash flows change sign more than once; the root is chosen with numpy-financial's selection rule. MIRR avoids this ambiguity.
Sources

Related