NPV and IRR calculator

Net present value, internal rate of return, simple and discounted payback and profitability index from a cash flow you paste, with the discounted

loading NPV and IRR calculator
About this tool

What are NPV and IRR?

Net present value (NPV) and internal rate of return (IRR) are the two standard tests for a project or an investment that pays out over time. A euro today is worth more than a euro next year, so the NPV brings every future cash flow back to today at the discount rate you choose and adds them up. If the total, after paying the initial investment, is above zero, the project earns more than the discount rate. The IRR turns the question around: it is the discount rate at which the NPV is exactly zero, the project's own yearly (or monthly) return.

This calculator reads a cash flow you paste in a box, one value per line. Period 0 comes first and is the investment, written as a negative number; the following lines are the flows of period 1, 2, 3 and so on. It returns the NPV, the IRR, the simple payback, the discounted payback and the profitability index, plus a table with each flow, its present value and the running totals. You can paste a column straight from a spreadsheet, or separate values with a semicolon or a tab, and write numbers the way your language does: 1,234.50 in English, 1.234,50 in Portuguese or Spanish.

Rates are yours: the tool never looks anything up. Type the discount rate per period (the same unit as your periods: a monthly rate for monthly flows, a yearly rate for yearly flows). Everything is calculated in your browser and nothing is sent.

How to calculate NPV and IRR

  1. Paste or type the cash flow, one value per line. Start with the investment as a negative number, then the expected flows in order. Receipts are positive, payments are negative.
  2. Type the discount rate per period, in percent. It is usually your required return or the cost of capital.
  3. Read the NPV first: above zero means the project beats the rate. The IRR shows the project's own return; compare it with the discount rate.
  4. Check the payback lines to see how many periods it takes to recover the investment, and the table to see where the cumulative flow turns positive.
  5. Read any warning under the results: they flag flows without an IRR or with more than one.

For a plain loan or savings schedule, the loan calculator builds the payments for you. For a single return over a period, use the ROI calculator.

Examples

A four-year project at 10%

Flow: -1,000, 300, 400, 500, 600. Discounting each flow by 1.1 to the power of its period gives 272.73, 330.58, 375.66 and 409.81, which add to 1,388.77. The NPV is 1,388.77 - 1,000 = 388.77. The IRR is 24.89%: at that rate the discounted flows add up to exactly 1,000. The profitability index is 1,388.77 / 1,000 = 1.389.

Payback, simple and discounted

With the same flow, the cumulative total is -1,000, -700, -300, +200, +800. Payback happens during period 3: 2 whole periods plus 300 / 500 = 2.6 periods. Discounted, the cumulative present value is -1,000, -727.27, -396.69, -21.04, +388.77, so it turns positive in period 4: 3 + 21.04 / 409.81 = 3.05 periods. Discounting always delays the payback.

A project that falls just short

Flow: -5,000 and then 1,500 for four periods, at 8%. The NPV is -31.81 and the IRR is 7.71%, a little below 8%. Both say the same thing: reject, or negotiate a better price. A project that never recovers its cost can even show a negative IRR: -1,000 followed by four flows of 200 has an IRR of -8.36%.

Two IRRs

Flow: -100, 230, -132. The flow changes sign twice, and the NPV is zero at both 10% and 20%. The tool shows the lowest, lists both in a warning, and tells you to trust the NPV for the decision. This happens when there is a large outflow at the end, such as a decommissioning cost.

Common mistakes

  • Positive investment at period 0. The initial investment must be negative. If the first value is not negative, payback and the profitability index do not apply, and the tool warns you.
  • Mixing units. A yearly rate with monthly flows gives nonsense. Convert the rate to the period of the flow first.
  • Using IRR alone. With unconventional flows, the IRR can be missing or multiple. The NPV is always defined.
  • A flow that never changes sign. All inflows or all outflows have no IRR.
  • Wrong separators. In English, write 1,234.50; in Portuguese or Spanish, 1.234,50. Use a new line, a semicolon or a tab between values, never a comma.
  • Forgetting that period 0 is not discounted. The first value is today's money.

Frequently asked questions

What does a positive NPV mean?

The project returns more than the discount rate, after recovering the investment. It adds value. A negative NPV means it earns less than the rate you asked for, and an NPV of zero means it earns exactly that rate.

Which discount rate should I use?

Use your required return: the rate of a safe alternative plus a premium for the risk, or the cost of the money you borrow. A higher rate lowers the NPV. Try several rates to see how sensitive the result is.

What is a good IRR?

One that is above your required return, with a margin for risk. Compare the IRR with the discount rate, not with a fixed number.

What is the profitability index?

It is the present value of the future flows divided by the initial investment. Above 1 means the NPV is positive. It helps rank projects of different sizes when capital is limited.

How is the IRR found?

The tool scans rates for every sign change of the NPV curve and then narrows each interval by bisection, which cannot jump out of range. To compare the result with a total return over a period, use the CAGR calculator.

Formulas in code

JavaScript

const npv = (rate, flows) => flows.reduce((sum, cf, t) => sum + cf / (1 + rate) ** t, 0);
console.log(npv(0.1, [-1000, 300, 400, 500, 600])); // 388.7712587937979

Python

flows = [-1000, 300, 400, 500, 600]
f = lambda r: sum(cf / (1 + r) ** t for t, cf in enumerate(flows))
print(f(0.1))                       # 388.7712587937979
lo, hi = 0.0, 1.0
for _ in range(100):                # bisection for the IRR
    mid = (lo + hi) / 2
    lo, hi = (mid, hi) if f(mid) > 0 else (lo, mid)
print(lo)                           # 0.24888335662407102
Report a problem