Rate Calculator Cd

Certificate of Deposit (CD) Interest Calculator

A Certificate of Deposit (CD) is a type of savings account that offers a fixed interest rate for a predetermined period. You agree to leave your money in the CD for the entire term, and in return, the bank usually offers a higher interest rate than a standard savings account. This calculator helps you estimate the potential earnings on your CD investment.

Annually Semi-Annually Quarterly Monthly Daily
function calculateCDInterest() { var principal = parseFloat(document.getElementById("principalAmount").value); var annualRate = parseFloat(document.getElementById("annualInterestRate").value); var term = parseFloat(document.getElementById("cdTermYears").value); var frequency = parseFloat(document.getElementById("compoundingFrequency").value); var resultDiv = document.getElementById("result"); resultDiv.innerHTML = ""; // Clear previous results if (isNaN(principal) || isNaN(annualRate) || isNaN(term) || isNaN(frequency) || principal <= 0 || annualRate < 0 || term <= 0 || frequency <= 0) { resultDiv.innerHTML = "Please enter valid positive numbers for all fields."; return; } var ratePerPeriod = annualRate / 100 / frequency; var numberOfPeriods = term * frequency; // Compound Interest Formula: A = P(1 + r/n)^(nt) var totalAmount = principal * Math.pow((1 + ratePerPeriod), numberOfPeriods); var totalInterestEarned = totalAmount – principal; resultDiv.innerHTML = "

Estimated Earnings

" + "Total Amount at Maturity: $" + totalAmount.toFixed(2) + "" + "Total Interest Earned: $" + totalInterestEarned.toFixed(2) + ""; } .calculator-container { font-family: sans-serif; border: 1px solid #ccc; padding: 20px; border-radius: 8px; max-width: 500px; margin: 20px auto; background-color: #f9f9f9; } .calculator-container h2 { text-align: center; color: #333; margin-bottom: 15px; } .calculator-container p { color: #555; line-height: 1.6; margin-bottom: 20px; text-align: justify; } .calculator-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; } .input-group { display: flex; flex-direction: column; } .input-group label { margin-bottom: 5px; font-weight: bold; color: #444; } .input-group input, .input-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; } button { display: block; width: 100%; padding: 12px; background-color: #007bff; color: white; border: none; border-radius: 4px; font-size: 1.1rem; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #0056b3; } #result { margin-top: 25px; padding: 15px; border: 1px dashed #ddd; background-color: #fff; border-radius: 4px; } #result h3 { margin-top: 0; color: #2c3e50; } #result p { margin-bottom: 8px; color: #333; text-align: left; }

Leave a Comment