Annual Return Calculator
<div id="calculator-container" style="max-width: 400px; padding: 20px; border-radius: 12px; background: #f9f9f9; box-shadow: 0 4px 10px rgba(0,0,0,0.1); font-family: sans-serif;">
<h3 style="margin-top: 0; color: #333;">Annual Return Calculator</h3>
<div style="margin-bottom: 15px;">
<label style="display: block; font-size: 14px; margin-bottom: 5px;">Investment Term (Years)</label>
<input type="number" id="years" placeholder="e.g. 5" style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box;">
</div>
<div style="margin-bottom: 15px;">
<label style="display: block; font-size: 14px; margin-bottom: 5px;">Total Cumulative Return (%)</label>
<input type="number" id="totalReturn" placeholder="e.g. 50" style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box;">
</div>
<button onclick="calculateCAGR()" style="width: 100%; padding: 12px; background-color: #007bff; color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold;">Calculate</button>
<div id="result" style="margin-top: 20px; padding: 15px; border-radius: 6px; background: #e7f3ff; display: none; text-align: center;">
<span style="font-size: 14px; color: #555;">Annualized Return (CAGR):</span><br>
<strong id="cagrValue" style="font-size: 24px; color: #007bff;">0%</strong>
</div>
</div>
<script>
function calculateCAGR() {
const years = parseFloat(document.getElementById('years').value);
const totalReturnPercent = parseFloat(document.getElementById('totalReturn').value);
const resultDiv = document.getElementById('result');
const cagrDisplay = document.getElementById('cagrValue');
if (years > 0 && !isNaN(totalReturnPercent)) {
// Formula: ((1 + R)^(1/n)) - 1
const decimalReturn = totalReturnPercent / 100;
const cagr = (Math.pow((1 + decimalReturn), (1 / years)) - 1) * 100;
cagrDisplay.innerText = cagr.toFixed(2) + '%';
resultDiv.style.display = 'block';
} else {
alert("Please enter valid positive numbers.");
}
}
</script>
This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piƱa coladas. (And gettin’ caught in the rain.)
…or something like this:
The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!