Finance Runs locally Ready to use Built-in examples No tracking

NPV & IRR Calculator

Enter a discount rate and per-period cash flows (initial investment as a negative first line) to get net present value, internal rate of return, a full discounting table and the payback period.

Net present value answers a single question: discount every future cash flow back to today's money at your cost of capital, subtract what you put in, and how much is left? A positive NPV means the project beats the discount rate; a negative one means the money would do better at that rate elsewhere. The internal rate of return turns the question around — it is the discount rate at which NPV is exactly zero, and it can be compared with the cost of capital directly.

Cash flows are discounted at the end of each period (period t divided by (1+r)^t, with the initial outlay undiscounted), and the IRR is found by bisection over a −90% to 100% range. Beyond the two headline figures the tool gives a period-by-period discounting table (cash flow, discounted value, running total) and the undiscounted payback period, found where the cumulative cash flow first turns positive, interpolated across the crossing.

How to use

  1. Enter the discount rate and the cash flows, one per line, with the initial outlay first (usually negative).
  2. Read the net present value and the internal rate of return.
  3. Check the period-by-period discounting table and the cumulative total.
  4. Compare the IRR with your cost of capital, and check the payback period.

How it works

Period-end discounting and the NPV convention

The NPV convention is period-end discounting: cash flow at period t divided by (1+r)^t, with t starting at 0 — the first row is t=0 at the start, undiscounted, which is why the initial investment is entered directly as a negative. For example at a 10% discount rate, 300 one year later is counted as 300/1.1 = about 272.73 in present value. Summing all present values gives the NPV; the detail table lists each period's discounted amount and cumulative value.

IRR's economic meaning and solution range

IRR is "the discount rate that makes NPV exactly 0"; this tool solves by bisection over -90% to 100%, reported to two decimals. IRR's economic meaning is the project's own annualized return: above your cost of capital means it's worth doing, below means the money is better deployed elsewhere. Note that when cash flows change sign multiple times, IRR may have multiple solutions — NPV is more reliable then.

The payback interpolation algorithm

Payback is computed on undiscounted cumulative cash flow: accumulate from period 1 and the first period to turn positive is the break-even point; the final crossing segment is interpolated linearly to two decimals (like 2.6 periods). It answers "how long to recoup," ignoring the time value of money — NPV and payback together balance return level and capital commitment.

Code example

JavaScript NPV by summation, IRR by bisection

// NPV = sum of CFt / (1+r)^t with t starting at 0 (period 0 is the initial outlay)
const npv = (rate, cfs) => cfs.reduce((s, cf, t) => s + cf / Math.pow(1 + rate, t), 0);

// IRR has no closed form: bisect on [-0.99, 10] (NPV falls monotonically in r)
function irr(cfs) {
  let lo = -0.99, hi = 10;
  if (npv(lo, cfs) * npv(hi, cfs) > 0) { return null; }   // no sign change = no root
  for (let i = 0; i < 200; i++) {
    const mid = (lo + hi) / 2;
    if (npv(mid, cfs) > 0) { lo = mid; } else { hi = mid; }
  }
  return (lo + hi) / 2;
}
// -1000 up front, then 400 / 500 / 600 back over three years
irr([-1000, 400, 500, 600]);              // ~ 0.1873 (18.73%)

Python NPV and IRR in one line with numpy_financial

import numpy_financial as npf

cfs = [-1000, 400, 500, 600]              # period 0 is the initial outlay (negative)

print(npf.npv(0.08, cfs))                 # net present value at an 8% discount rate
print(npf.irr(cfs))                       # internal rate of return ~ 0.1873

# hand-rolled equivalent: sum(cf / (1 + r) ** t for t, cf in enumerate(cfs))

FAQ

What does a positive NPV mean?

At the chosen discount rate, the project's future cash flows discounted to present value exceed the initial investment, by roughly the NPV amount. The larger the NPV the better; when choosing between two projects of similar risk, usually take the higher NPV.

Why does IRR sometimes show no solution?

When cash flows are all positive or all negative there's no sign change from negative to positive, so IRR is mathematically unsolvable or meaningless; also this tool solves over -90% to 100%, so a return outside that range also shows no solution.

What should the first cash flow row be?

The initial investment, usually negative, e.g. -1,000; from the second row on, recoveries are positive. The tool computes on the convention that the first row is t=0 at the start, undiscounted.

What does a payback of 2.6 periods mean?

Cumulative cash flow is still negative at the end of period 2 and turns positive by the end of period 3; by linear interpolation at the crossing, you recoup at about period 2.6. Note this is undiscounted — with the time value of money, the real payback is later.

Can the result serve directly as an investment basis?

No. NPV and IRR are only quantitative tools for comparing cash-flow plans, and results depend heavily on the discount rate and cash-flow forecasts you enter; this tool is not investment advice — major decisions should combine risk assessment and professional opinion.

Must cash flows start negative?

Not required. The first row is usually the initial investment (negative), but the tool doesn't check sign order; however an all-positive or all-negative series has no IRR (no sign flip) and shows no solution.

What is multiple-rate-of-return?

When cash-flow signs flip multiple times (invest again, large mid-stream repayment), the discount rate making NPV=0 may mathematically have several solutions. Bisection reports only one in the range; for such unconventional cash flows, compare NPV at different discount rates directly.