Calculators

Age Calculator

.gst-calculator { max-width: 500px; margin: 40px auto; padding: 25px; background: #fdfdfd; border-radius: 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); font-family: 'Segoe UI', sans-serif; } .gst-calculator h2 { text-align: center; margin-bottom: 20px; color: #333; font-size: 22px; } .gst-calculator label { display: block; margin-bottom: 6px; font-weight: 600; color: #444; } .gst-calculator input { width: 100%; padding: 12px; font-size: 16px; border: 1px solid #ccc; border-radius: 10px; margin-bottom: 20px; box-sizing: border-box; } .gst-calculator button { width: 100%; padding: 14px; background-color: #4CAF50; color: #fff; border: none; font-weight: bold; font-size: 16px; border-radius: 10px; cursor: pointer; transition: background 0.3s ease; } .gst-calculator button:hover { background-color: #43a047; } .gst-calculator #gstResult { text-align: center; margin-top: 20px; font-size: 18px; color: #222; } @media (max-width: 600px) { .gst-calculator { padding: 20px; } .gst-calculator h2 { font-size: 20px; } .gst-calculator input, .gst-calculator button { font-size: 15px; } }

💰 GST Calculator

function calculateGST() { const amount = parseFloat(document.getElementById("amount").value); const gstRate = parseFloat(document.getElementById("gstPercent").value); const resultDiv = document.getElementById("gstResult"); if (isNaN(amount) || amount <= 0) { resultDiv.innerHTML = "🚫 Please enter a valid amount."; return; } if (isNaN(gstRate) || gstRate < 0) { resultDiv.innerHTML = "🚫 Please enter a valid GST percentage."; return; } const gstAmount = (amount * gstRate) / 100; const totalAmount = amount + gstAmount; resultDiv.innerHTML = `

🧾 Original Amount: ₹${amount.toFixed(2)}

➕ GST (${gstRate}%): ₹${gstAmount.toFixed(2)}

💰 Total (Post-GST): ₹${totalAmount.toFixed(2)}

`; }

💰 EMI Calculator

document.addEventListener("DOMContentLoaded", function () { var btn = document.getElementById("calculateBtn"); btn.addEventListener("click", function () { var P = parseFloat(document.getElementById("loanAmt").value); var R = parseFloat(document.getElementById("rate").value); var N = parseInt(document.getElementById("months").value); if (isNaN(P) || isNaN(R) || isNaN(N) || P <= 0 || R <= 0 || N <= 0) { document.getElementById("emiResult").innerHTML = "❗ Please fill all fields correctly."; return; } var r = R / 12 / 100; var emi = (P * r * Math.pow(1 + r, N)) / (Math.pow(1 + r, N) - 1); var total = emi * N; var interest = total - P; document.getElementById("emiResult").innerHTML = "📅 Monthly EMI: ₹" + emi.toFixed(2) + "
💸 Total Interest: ₹" + interest.toFixed(2) + "
🧾 Total Payment: ₹" + total.toFixed(2); }); });

HRA Calculator

Gratuity Calculator

function calculateGratuity() { const salary = parseFloat(document.getElementById('salary').value); const doj = new Date(document.getElementById('doj').value); const lastDate = new Date(document.getElementById('lastDate').value); if (isNaN(salary) || !doj.getTime() || !lastDate.getTime()) { document.getElementById('result').innerHTML = "Please fill in all valid fields."; return; } if (lastDate < doj) { document.getElementById('result').innerHTML = "Last date must be after date of joining."; return; } const diffTime = Math.abs(lastDate - doj); const totalDays = diffTime / (1000 * 60 * 60 * 24); const yearsOfService = Math.floor(totalDays / 365); if (yearsOfService < 5) { document.getElementById('result').innerHTML = "Not eligible for gratuity (minimum 5 years required)."; return; } const gratuity = (salary * 15 * yearsOfService) / 26; document.getElementById('result').innerHTML = "Years of Service: " + yearsOfService + "
Estimated Gratuity: ₹" + gratuity.toFixed(2); }