x402AgentsToolsHub

IRR & NPV Calculator

Compute NPV at any discount rate and solve IRR (bisection on the IRR equation) for a period cash-flow series: investment analysis, project comparison and bond-style math with exact, reproducible results. Period 0 is the initial outflow.

Worked examples

Classic project

GET /api/v1/finance/irr-npv?cashflows=-1000%2C500%2C400%2C300%2C100&ratePct=10

Result: NPV @ 10% = 78.82 · IRR = 14.49%

Real-estate style

GET /api/v1/finance/irr-npv?cashflows=-250000%2C12000%2C13000%2C13500%2C14000%2C265000&ratePct=7

Result: NPV @ 7% = -16,788.45 · IRR = 5.37%

No-IRR case (all positive)

GET /api/v1/finance/irr-npv?cashflows=100%2C120%2C140&ratePct=5

Result: NPV @ 5% = 341.27 · IRR: no sign change (no solution in −99.9%…1000%)

Machine API (x402)

$0.01 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/finance/irr-npv?cashflows=-1000%2C500%2C400%2C300%2C100&ratePct=10 HTTP/1.1
Host: agentstoolshub.com

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "finance/irr-npv",
  "input": {"cashflows":"-1000,500,400,300,100","ratePct":10},
  "result": { "value": 78.81975274912901, "answer": "NPV @ 10% = 78.82 · IRR = 14.49%" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

Exact NPV at your discount rate plus IRR solved by bisection to 9 decimal places — no Newton-method divergence, no spreadsheet required. The pair of numbers that decide project selection: positive NPV creates value at that rate; IRR is the break-even discount rate itself.

NPV = Σ CFt/(1+r)^t; IRR is r where NPV = 0

Frequently asked questions

Which cash-flow sign convention?

Period 0 is 'now' — write the investment as negative (-1000) and later returns as positive. IRR only exists if the flows change sign at least once.

What does NPV > 0 mean?

The project returns more than your discount rate: after repaying the cost of capital at ratePct, you're left with that many present-value units of profit.

Related tools