* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: ‘Segoe UI’, Arial, sans-serif; background: #f0f4f8; color: #1a202c; line-height: 1.6; }
.calculator-wrapper { max-width: 720px; margin: 0 auto; padding: 16px; }
.hero { background: linear-gradient(135deg, #1a3c6e 0%, #2563eb 100%); border-radius: 16px 16px 0 0; padding: 28px 28px 22px; color: #fff; text-align: center; }
.hero h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; }
.hero p { margin-top: 6px; font-size: 0.88rem; opacity: 0.88; }
.calc-card { background: #fff; border-radius: 0 0 16px 16px; padding: 28px 28px 24px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.use-hint { background: #eff6ff; border: 1.5px solid #bfdbfe; border-radius: 10px; padding: 10px 14px; font-size: 0.83rem; color: #1e40af; margin-bottom: 20px; line-height: 1.5; }
.use-hint strong { color: #1a3c6e; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 20px; }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } .hero h1 { font-size: 1.2rem; } }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: #4a5568; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.date-selects { display: flex; gap: 6px; align-items: center; }
.date-selects select { padding: 11px 6px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 0.95rem; color: #1a202c; background: #f7fafc; outline: none; cursor: pointer; transition: border-color 0.2s; }
.date-selects select:focus { border-color: #2563eb; background: #fff; }
.sel-day { width: 72px; }
.sel-month { flex: 1; }
.sel-year { width: 90px; }
/* Year: number input, typeable */
.inp-year {
width: 90px;
padding: 11px 8px;
border: 2px solid #e2e8f0;
border-radius: 10px;
font-size: 0.95rem;
color: #1a202c;
background: #f7fafc;
outline: none;
transition: border-color 0.2s;
-moz-appearance: textfield;
}
.inp-year::-webkit-inner-spin-button,
.inp-year::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.inp-year:focus { border-color: #2563eb; background: #fff; }
.category-row { margin-bottom: 20px; }
.category-row label { display: block; font-size: 0.82rem; font-weight: 600; color: #4a5568; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.cat-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-btn { padding: 8px 16px; border-radius: 8px; border: 2px solid #e2e8f0; background: #f7fafc; font-size: 0.85rem; font-weight: 600; cursor: pointer; color: #4a5568; transition: all 0.18s; }
.cat-btn:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.cat-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.calc-btn { width: 100%; padding: 14px; background: linear-gradient(90deg, #1a3c6e, #2563eb); color: #fff; font-size: 1.05rem; font-weight: 700; border: none; border-radius: 10px; cursor: pointer; letter-spacing: 0.3px; transition: opacity 0.2s; }
.calc-btn:hover { opacity: 0.9; }
.reset-btn { width: 100%; margin-top: 10px; padding: 10px; background: transparent; color: #718096; font-size: 0.88rem; font-weight: 600; border: 2px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all 0.18s; }
.reset-btn:hover { border-color: #cbd5e0; color: #4a5568; }
#result-section { display: none; margin-top: 24px; }
.result-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.res-box { background: linear-gradient(135deg, #eff6ff, #dbeafe); border: 1.5px solid #bfdbfe; border-radius: 12px; padding: 16px 10px; text-align: center; }
.res-box .num { font-size: 2rem; font-weight: 800; color: #1d4ed8; line-height: 1; }
.res-box .lbl { font-size: 0.75rem; font-weight: 600; color: #3b82f6; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.detail-row { background: #f0f9ff; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; font-size: 0.9rem; color: #374151; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.detail-row span { font-weight: 600; color: #1e40af; }
.eligibility-section { margin-top: 8px; border-radius: 12px; overflow: hidden; border: 1.5px solid #e2e8f0; }
.elig-header { background: #1a3c6e; color: #fff; padding: 12px 16px; font-size: 0.92rem; font-weight: 700; letter-spacing: 0.3px; }
.elig-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; font-size: 0.88rem; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; gap: 4px; }
.elig-row:last-child { border-bottom: none; }
.elig-row:nth-child(even) { background: #f8fafc; }
.exam-name { font-weight: 600; color: #1a202c; }
.badge { padding: 3px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.badge.eligible { background: #d1fae5; color: #065f46; }
.badge.not-eligible { background: #fee2e2; color: #991b1b; }
.badge.check { background: #fef3c7; color: #92400e; }
.info-section { margin-top: 28px; background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.info-section h2 { font-size: 1.1rem; font-weight: 700; color: #1a3c6e; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid #dbeafe; }
.age-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; table-layout: fixed; }
.age-table th:nth-child(1) { width: 42%; }
.age-table th:nth-child(2), .age-table th:nth-child(3) { width: 13%; }
.age-table th:nth-child(4), .age-table th:nth-child(5) { width: 16%; }
.age-table th { background: #1a3c6e; color: #ffffff; padding: 10px 12px; text-align: left; font-weight: 700; letter-spacing: 0.3px; font-size: 0.88rem; white-space: nowrap; }
.age-table td { word-break: break-word; }
.age-table td { padding: 9px 12px; border-bottom: 1px solid #e2e8f0; color: #374151; }
.age-table tr:nth-child(even) td { background: #f8fafc; }
.age-table tr:last-child td { border-bottom: none; }
.relaxation-box { margin-top: 16px; background: #fffbeb; border-left: 4px solid #f59e0b; border-radius: 0 8px 8px 0; padding: 12px 16px; font-size: 0.86rem; color: #78350f; }
.relaxation-box strong { display: block; margin-bottom: 6px; color: #92400e; font-size: 0.9rem; }
.faq-section { margin-top: 20px; background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.faq-section h2 { font-size: 1.1rem; font-weight: 700; color: #1a3c6e; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid #dbeafe; }
details { border-bottom: 1px solid #e2e8f0; padding: 4px 0; }
details:last-child { border-bottom: none; }
summary { padding: 12px 0; font-size: 0.9rem; font-weight: 600; color: #1a3c6e; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::after { content: ‘+’; font-size: 1.2rem; color: #2563eb; font-weight: 700; flex-shrink: 0; }
details[open] summary::after { content: ‘−’; }
.faq-ans { font-size: 0.86rem; color: #4a5568; padding: 0 0 14px 0; line-height: 1.7; }
.error-msg { background: #fee2e2; border-radius: 10px; padding: 12px 16px; color: #991b1b; font-size: 0.88rem; font-weight: 600; display: none; margin-top: 12px; }
🗓️ Age Calculator
Calculate your exact age between any two dates — and instantly check eligibility for UPSC, SSC, NDA, Bank & other Government Job exams
💡 Age Calculator from Date to Date: Enter any start date in “Date of Birth” and any end date in “Calculate As On Date” to find the exact time difference in years, months, and days.
DD
Month
JanuaryFebruary
MarchApril
MayJune
JulyAugust
SeptemberOctober
NovemberDecember
DD
Month
JanuaryFebruary
MarchApril
MayJune
JulyAugust
SeptemberOctober
NovemberDecember
📋 Popular Government Exam Age Limits (General Category)
| Exam | Min Age | Max Age | OBC | SC/ST |
|---|---|---|---|---|
| UPSC Civil Services (IAS/IPS) | 21 | 32 | +3 | +5 |
| SSC CGL | 18 | 32 | +3 | +5 |
| SSC CHSL | 18 | 27 | +3 | +5 |
| SSC MTS | 18 | 25 | +3 | +5 |
| NDA | 16.5 | 19.5 | No | No |
| CDS | 20 | 25 | No | No |
| IBPS PO | 20 | 30 | +3 | +5 |
| IBPS Clerk | 20 | 28 | +3 | +5 |
| RRB NTPC | 18 | 36 | +3 | +5 |
| RRB Group D | 18 | 36 | +3 | +5 |
| SBI PO | 21 | 30 | +3 | +5 |
| SBI Clerk | 20 | 28 | +3 | +5 |
| CISF/BSF/CRPF Constable | 18 | 23 | +3 | +5 |
| Central Govt Retirement | – | 60 | – | – |
⚠️ Age Relaxation — Standard Rules (Central Govt):
OBC: +3 Years | SC/ST: +5 Years | PwD (General): +10 Years | PwD (OBC): +13 Years | PwD (SC/ST): +15 Years | Ex-Servicemen: Service period + 3 Years
Note: Always check the official notification for exact age limits and relaxation rules.
❓ Frequently Asked Questions
What is the cutoff date for age calculation?
Can I use this as an age calculator from date to date?
What is the maximum age limit for UPSC?
Does this calculator account for leap years?
What is the age limit for NDA?
How much age relaxation do PwD candidates get?
const monthNames = [‘January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,’September’,’October’,’November’,’December’];
function getDaysInMonth(year, month) {
if (!year || !month) return 31;
return new Date(parseInt(year), parseInt(month), 0).getDate();
}
function populateDays(dayEl, year, month) {
const prev = dayEl.value;
const total = getDaysInMonth(year, month);
dayEl.innerHTML = ‘DD’;
for (let i = 1; i <= total; i++) {
const o = document.createElement('option');
o.value = i;
o.textContent = i {
document.getElementById(id).addEventListener(‘change’, () => {
const y = document.getElementById(‘dobYear’).value;
const m = document.getElementById(‘dobMonth’).value;
populateDays(document.getElementById(‘dobDay’), y, m);
});
});
[‘aodMonth’, ‘aodYear’].forEach(id => {
document.getElementById(id).addEventListener(‘change’, () => {
const y = document.getElementById(‘aodYear’).value;
const m = document.getElementById(‘aodMonth’).value;
populateDays(document.getElementById(‘aodDay’), y, m);
});
});
let selectedCategory = ‘General’;
const relaxationYears = { ‘General’: 0, ‘OBC’: 3, ‘SC/ST’: 5, ‘PwD’: 10, ‘Ex-Servicemen’: 3 };
function setCategory(btn, cat) {
document.querySelectorAll(‘.cat-btn’).forEach(b => b.classList.remove(‘active’));
btn.classList.add(‘active’);
selectedCategory = cat;
}
function getDate(prefix) {
const d = document.getElementById(prefix + ‘Day’).value;
const m = document.getElementById(prefix + ‘Month’).value;
const y = document.getElementById(prefix + ‘Year’).value;
if (!d || !m || !y || y.length < 4) return null;
return new Date(parseInt(y), parseInt(m) – 1, parseInt(d));
}
function formatDate(d) {
return d.toLocaleDateString('en-IN', { day: '2-digit', month: 'long', year: 'numeric' });
}
function calculateAge() {
const errMsg = document.getElementById('errorMsg');
errMsg.style.display = 'none';
const dobY = document.getElementById('dobYear').value;
const aodY = document.getElementById('aodYear').value;
if (!dobY || dobY.length < 4) {
errMsg.textContent = '⚠️ Date of Birth mein sahi 4-digit year daalen.';
errMsg.style.display = 'block'; return;
}
if (!aodY || aodY.length = asOn) {
errMsg.textContent = ‘⚠️ Date of Birth, As On Date se pehle honi chahiye.’;
errMsg.style.display = ‘block’; return;
}
let years = asOn.getFullYear() – dob.getFullYear();
let months = asOn.getMonth() – dob.getMonth();
let days = asOn.getDate() – dob.getDate();
if (days < 0) { months–; const pm = new Date(asOn.getFullYear(), asOn.getMonth(), 0); days += pm.getDate(); }
if (months < 0) { years–; months += 12; }
document.getElementById('resYears').textContent = years;
document.getElementById('resMonths').textContent = months;
document.getElementById('resDays').textContent = days;
const relax = relaxationYears[selectedCategory] || 0;
const effectiveAge = years + relax;
document.getElementById('detDOB').textContent = formatDate(dob);
document.getElementById('detAsOn').textContent = formatDate(asOn);
document.getElementById('detCategory').textContent = selectedCat