The total cost to start the project (Year 0). Enter as a positive number (logic handles subtraction).
Your required rate of return or WACC.
Enter the net cash inflow for each subsequent year, separated by commas.
Net Present Value (NPV)
$0.00
Yearly Breakdown
Year
Cash Flow
Discount Factor
Present Value
function calculateNPV() {
var investmentInput = document.getElementById('initialInvestment').value;
var rateInput = document.getElementById('discountRate').value;
var cashFlowsInput = document.getElementById('cashFlows').value;
// Basic validation
if (investmentInput === " || rateInput === " || cashFlowsInput === ") {
alert('Please fill in all fields correctly.');
return;
}
var investment = parseFloat(investmentInput);
var ratePercent = parseFloat(rateInput);
var rateDecimal = ratePercent / 100;
// Parse cash flows string into array
var flowsArray = cashFlowsInput.split(',').map(function(item) {
return parseFloat(item.trim());
});
// Filter out NaNs just in case user typed nonsense
flowsArray = flowsArray.filter(function(value) {
return !isNaN(value);
});
if (isNaN(investment) || isNaN(ratePercent) || flowsArray.length === 0) {
alert('Please enter valid numeric values.');
return;
}
var totalPV = 0;
var breakdownHTML = ";
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2
});
// Loop through flows to calculate PV for each year
for (var i = 0; i < flowsArray.length; i++) {
var year = i + 1;
var cashFlow = flowsArray[i];
// Formula: PV = CashFlow / (1 + r)^t
var factor = Math.pow(1 + rateDecimal, year);
var pv = cashFlow / factor;
totalPV += pv;
breakdownHTML += '
';
}
var npv = totalPV – investment;
// Display results
var resultContainer = document.getElementById('result-container');
var npvDisplay = document.getElementById('npvValue');
var decisionDisplay = document.getElementById('decisionText');
var tbody = document.getElementById('breakdownBody');
resultContainer.style.display = 'block';
npvDisplay.innerHTML = formatter.format(npv);
tbody.innerHTML = breakdownHTML;
// Styling based on positive/negative result
if (npv > 0) {
npvDisplay.className = 'result-value positive-npv';
decisionDisplay.innerHTML = "Decision: Accept Project (Profitable)";
decisionDisplay.style.color = "#28a745";
} else if (npv < 0) {
npvDisplay.className = 'result-value negative-npv';
decisionDisplay.innerHTML = "Decision: Reject Project (Unprofitable)";
decisionDisplay.style.color = "#dc3545";
} else {
npvDisplay.className = 'result-value';
decisionDisplay.innerHTML = "Decision: Neutral (Break-even)";
decisionDisplay.style.color = "#6c757d";
}
}
How to Calculate NPV Using Discount Rate
Net Present Value (NPV) is one of the most fundamental concepts in finance and capital budgeting. It helps investors and business managers determine the profitability of an investment by accounting for the "time value of money." Essentially, a dollar today is worth more than a dollar tomorrow.
This guide explains how to calculate NPV using a discount rate, breaking down the formula, the variables, and how to interpret the results to make sound financial decisions.
What is the Discount Rate in NPV?
To calculate NPV accurately, you cannot simply add up future cash flows. You must "discount" them back to their present value. The discount rate is the percentage used to do this math.
Depending on the context, the discount rate might represent:
WACC (Weighted Average Cost of Capital): For corporate projects, this represents the average rate a company pays to finance its assets.
Hurdle Rate: The minimum rate of return a company or investor requires before accepting a project.
Risk-Free Rate + Risk Premium: Often used in valuation models to account for the specific risk of an investment.
The NPV Formula
The Net Present Value formula sums the present values of all future cash flows and subtracts the initial investment.
NPV = [ sum of (Cash Flow / (1 + r)^t) ] – Initial Investment
Where:
r = Discount Rate (decimal form)
t = Time period (year 1, year 2, etc.)
Initial Investment = The cost incurred at the start (t=0)
Step-by-Step Calculation Example
Let's say you are considering a project that costs $10,000 upfront. You expect it to generate $3,000 per year for 4 years. Your required rate of return (discount rate) is 10%.
Step 1: Determine the Present Value of Each Year
Year 1: $3,000 / (1 + 0.10)^1 = $2,727.27
Year 2: $3,000 / (1 + 0.10)^2 = $2,479.34
Year 3: $3,000 / (1 + 0.10)^3 = $2,253.94
Year 4: $3,000 / (1 + 0.10)^4 = $2,049.04
Step 2: Sum the Present Values
Total PV of Inflows = $2,727.27 + $2,479.34 + $2,253.94 + $2,049.04 = $9,509.59
In this example, the NPV is negative, suggesting the project would destroy value given the 10% discount rate requirement.
Interpreting the Results
When you calculate NPV using a discount rate, the result tells you whether the investment exceeds your required return.
Positive NPV (> 0): The project is expected to generate more value than the cost of capital. It is generally considered a good investment.
Negative NPV (< 0): The project fails to meet the required rate of return. It should likely be rejected.
Zero NPV (= 0): The project exactly meets the required rate of return. It breaks even in terms of value creation.
Why the Discount Rate Matters
The discount rate has a massive impact on the calculation. A higher discount rate reduces the present value of future cash flows significantly. This reflects the concept that higher risk requires higher returns. If you adjust the rate in the calculator above from 5% to 15%, you will see the NPV drop dramatically, potentially turning a "good" project into a "bad" one.