Fixed Deposit (FD) Calculator
A Fixed Deposit (FD) is a financial instrument offered by banks and non-banking financial companies (NBFCs) that allows individuals to deposit a lump sum amount for a fixed tenure at a predetermined interest rate. FDs are considered a safe investment option, especially for risk-averse investors, as they offer guaranteed returns. The interest earned on FDs is typically compounded, meaning that the interest earned in each period is added to the principal, and the next period's interest is calculated on the new, larger principal. This compounding effect can significantly boost your returns over the long term. When choosing an FD, consider the interest rate, tenure, compounding frequency, and any withdrawal penalties.
.calculator-container {
font-family: sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.calculator-container h2 {
text-align: center;
margin-bottom: 15px;
color: #333;
}
.calculator-container p {
text-align: justify;
margin-bottom: 25px;
color: #555;
line-height: 1.6;
}
.calculator-form .form-group {
margin-bottom: 15px;
display: flex;
flex-direction: column;
}
.calculator-form label {
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.calculator-form input[type="number"],
.calculator-form select {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
}
.calculator-form button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1.1em;
margin-top: 10px;
transition: background-color 0.3s ease;
}
.calculator-form button:hover {
background-color: #45a049;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
background-color: #e7f3fe;
border: 1px solid #b3d7fc;
border-radius: 4px;
text-align: center;
font-size: 1.1em;
color: #333;
}
.calculator-result p {
margin: 5px 0;
}
function calculateFD() {
var principal = parseFloat(document.getElementById("principal").value);
var annualRate = parseFloat(document.getElementById("annualRate").value);
var tenureYears = parseFloat(document.getElementById("tenureYears").value);
var compoundingFrequency = parseFloat(document.getElementById("compoundingFrequency").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = "; // Clear previous results
if (isNaN(principal) || isNaN(annualRate) || isNaN(tenureYears) || isNaN(compoundingFrequency) ||
principal <= 0 || annualRate <= 0 || tenureYears <= 0 || compoundingFrequency <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var ratePerPeriod = annualRate / 100 / compoundingFrequency;
var numberOfPeriods = tenureYears * compoundingFrequency;
// Formula for compound interest: A = P(1 + r/n)^(nt)
// Where:
// A = the future value of the investment/loan, including interest
// P = the principal investment amount (the initial deposit or loan amount)
// r = the annual interest rate (as a decimal)
// n = the number of times that interest is compounded per year
// t = the number of years the money is invested or borrowed for
var futureValue = principal * Math.pow(1 + ratePerPeriod, numberOfPeriods);
var totalInterestEarned = futureValue – principal;
resultDiv.innerHTML =
"
Principal Amount: ₹" + principal.toFixed(2) + "" +
"
Annual Interest Rate: " + annualRate.toFixed(2) + "%" +
"
Tenure: " + tenureYears + " Years" +
"
Compounding Frequency: " + getFrequencyText(compoundingFrequency) + "" +
"
Maturity Amount: ₹" + futureValue.toFixed(2) + "" +
"
Total Interest Earned: ₹" + totalInterestEarned.toFixed(2) + "";
}
function getFrequencyText(frequency) {
switch(frequency) {
case 1: return "Annually";
case 2: return "Semi-Annually";
case 4: return "Quarterly";
case 12: return "Monthly";
case 365: return "Daily";
default: return "Unknown";
}
}