GenerateRandomSearch

NPV and IRR Calculator

Net present value asks what a stream of future cash is worth today at a given discount rate. Internal rate of return asks the question backwards: at what rate would that stream be worth exactly nothing? Because IRR is defined by that equality, it can be checked rather than trusted — this page evaluates NPV at the rate it reports, and the answer has to come out at zero.

What this generator does

Builds a plausible investment — an initial outlay followed by uneven returns — and discounts every flow back to today at your chosen rate. It then finds the internal rate of return by bisection on the NPV curve, and reports the payback period as the first year cumulative cash turns positive.

How to use this tool

  1. Choose how many periods of returns and a discount rate.
  2. Read the NPV, then the IRR, and check they agree in direction.
  3. Raise the discount rate past the IRR and watch NPV turn negative.
  4. Look at the discounted column to see how much a distant year is really worth.

Understanding the controls

How many periods
Between 2 and 30 years of returns after the initial outlay. Longer projects discount their later years very heavily.
Discount rate
Your cost of capital, or the return available elsewhere. NPV is positive exactly when the IRR beats this figure.
Seed
Any word reproduces exactly the same cash flows, so a worked example can be set and marked later.

Common use cases

  • Teaching discounted cash flow with a self-checking answer
  • Investment appraisal worked examples with plausible figures
  • Showing that NPV and IRR cannot disagree on a simple project
  • Practice problems for a finance or accounting course
  • Setting the same scenario twice from a seed

How this generator works

Bisection narrows the interval where the NPV curve changes sign, halving it two hundred times, which locates the crossing to far more precision than any figure quoted here needs. When the flows never change sign no IRR exists, and the page says so rather than returning a number — an all-outflow project has no rate at which it breaks even, and inventing one would be worse than admitting it.

Randomness and fairness

The cash flows are generated randomly to give a realistic scenario; the NPV and IRR are then deterministic calculations on them. A seed reproduces the same flows exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Cash flows have a single sign change, so exactly one IRR exists. Projects that alternate sign can have several, and this does not find them.
  • Periods are equal and returns arrive at period ends, which is the standard textbook convention rather than reality.
  • No tax, inflation adjustment or terminal value is modelled.
  • This is an arithmetic tool for learning and worked examples, not investment advice.
  • Figures are gone once you leave; note the seed rather than the answer.

Privacy and your data

Every figure is computed in your browser. Nothing about the cash flows or your seed is transmitted or kept.