Calculate your investment's profitability and efficiency with precision.
Please enter valid positive numbers for investment and return.
Total ROI: —
Total Gain: $0
Annualized ROI: —
The annualized ROI provides the average yearly return, accounting for compounding.
What is ROI and Why Does it Matter?
Return on Investment (ROI) is a fundamental financial metric used to evaluate the efficiency or profitability of an investment. It measures the amount of return on an investment relative to its cost. Whether you are investing in the stock market, real estate, or a marketing campaign for your business, ROI helps you understand if your money is working effectively for you.
How to Calculate ROI
The basic formula for ROI is straightforward:
ROI = ((Final Value – Initial Cost) / Initial Cost) × 100
While the basic ROI shows the total growth, the Annualized ROI is often more useful for comparing investments held over different time periods. It tells you what your average yearly return was, which allows for a "apples-to-apples" comparison between a 5-year real estate investment and a 1-year stock trade.
Real-World Example:
Suppose you invest $10,000 in a startup. After 3 years, you sell your stake for $18,000.
Total Profit: $8,000
Total ROI: 80%
Annualized ROI: 21.64% per year
Interpreting Your Results
Positive ROI: The investment is profitable. The higher the percentage, the better.
Negative ROI: The investment resulted in a loss (the final value is less than the cost).
Comparing Options: If Project A has an ROI of 15% over 1 year and Project B has an ROI of 30% over 5 years, Project A is actually the more efficient use of capital on an annualized basis.
function calculateROI() {
var initial = parseFloat(document.getElementById("initialInvestment").value);
var returned = parseFloat(document.getElementById("amountReturned").value);
var years = parseFloat(document.getElementById("holdingPeriod").value);
var errorBox = document.getElementById("error-message");
var resultBox = document.getElementById("roi-result-box");
// Reset visibility
errorBox.style.display = "none";
resultBox.style.display = "none";
// Validation
if (isNaN(initial) || isNaN(returned) || initial 0) {
annualizedROI = (Math.pow((returned / initial), (1 / years)) – 1) * 100;
showAnnual = true;
}
// Update UI
document.getElementById("totalROIResult").innerHTML = "Total ROI: " + totalROI.toFixed(2) + "%";
document.getElementById("totalGainDesc").innerHTML = "Net Profit/Loss: $" + totalGain.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
var annResultElem = document.getElementById("annualizedROIResult");
if (showAnnual) {
annResultElem.innerHTML = "Annualized ROI: " + annualizedROI.toFixed(2) + "%";
annResultElem.style.display = "block";
} else {
annResultElem.style.display = "none";
}
resultBox.style.display = "block";
// Scroll to results on mobile
resultBox.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}