Calorie Calculator

Estimate daily calories and macros from simple inputs.

"
Results will appear here.

For informational purposes only. Not financial advice. Consult a licensed advisor.

This tool runs completely in your browser. No data is transmitted, stored, or logged.

(function(){ const display = document.querySelector('.result'); const sources = {male:'Mifflin-St Jeor estimate', female:'Mifflin-St Jeor estimate'}; const compute = () => { const sex = document.querySelector('[data-key="sex"]')?.value; const age = parseFloat(document.querySelector('[data-key="age"]')?.value || '0') || 0; const weight = parseFloat(document.querySelector('[data-key="weight"]')?.value || '0') || 0; const heightFt = parseFloat(document.querySelector('[data-key="heightFt"]')?.value || '0') || 0; const heightIn = parseFloat(document.querySelector('[data-key="heightIn"]')?.value || '0') || 0; const activity = parseFloat(document.querySelector('[data-key="activity"]')?.value || '1.2') || 1.2; const cm = (heightFt * 30.48) + (heightIn * 2.54); if (!age || !weight || !cm) { if (display) display.textContent = 'Enter valid age, weight, and height.'; return; } const bmr = sex === 'female' ? 447.593 + (9.247 * weight) + (3.098 * cm) - (4.330 * age) : 88.362 + (13.397 * weight) + (4.799 * cm) - (5.677 * age); const calories = Math.round(bmr * activity); if (display) display.textContent = `Estimated calories/day: ${calories}\nSource: ${sources[sex]||'standard estimate'}`; }; document.querySelectorAll('[data-key="sex"],[data-key="age"],[data-key="weight"],[data-key="heightFt"],[data-key="heightIn"],[data-key="activity"]').forEach(el => el.addEventListener('input', compute)); document.getElementById('calc-btn')?.addEventListener('click', compute); compute(); })();