Fat Intake Calculator

Professional fat intake calculator: estimate daily fat grams from calories or body weight using evidence-based ranges. Includes optional TDEE estimator, minimum and recommended ranges, and saturated fat limits.

Full original guide (expanded)

Skip to main content

Fat Intake Calculator

This professional fat intake calculator helps you determine how many grams of fat to eat per day based on either a percentage of calories or grams per body weight. It includes an optional TDEE estimator and highlights evidence-based ranges and limits, making it useful for individuals, athletes, and nutrition professionals.

Data Source and Methodology

Authoritative Data Sources:

  • Institute of Medicine (IOM). Dietary Reference Intakes for Energy, Carbohydrate, Fiber, Fat, Fatty Acids, Cholesterol, Protein, and Amino Acids (2005). AMDR for total fat: 20–35% of energy. Link: National Academies Press
  • U.S. Department of Health and Human Services & U.S. Department of Agriculture. Dietary Guidelines for Americans, 2020–2025. Limit saturated fat to <10% of calories. Link: dietaryguidelines.gov
  • Mifflin MD, St Jeor ST, et al. A new predictive equation for resting energy expenditure (1990) — used to estimate TDEE. DOI: 10.1016/S0002-8223(97)00272-1

Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.

The Formulas Explained

BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5

BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161

TDEE = BMR \times \text{Activity Factor}

C_{goal} = TDEE \times (1 + \delta)

g_{fat} = \dfrac{C_{goal} \times p_{fat}}{9} \quad \text{(percentage method, where } p_{fat}\in [0,1]\text{)}

g_{fat} = w \times r \quad \text{(body-weight method; } r = \text{g per kg or g per lb)}

g_{SFA}^{max} = \dfrac{0.10 \times C_{goal}}{9}

Glossary of Variables

Daily calories (C_goal)
Calories used to compute fat targets. Entered directly or estimated from TDEE and goal.
BMR
Basal Metabolic Rate from Mifflin–St Jeor, based on sex, age, height, and weight.
TDEE
Total Daily Energy Expenditure = BMR × activity factor.
Fat percentage (p_fat)
Share of calories from fat (e.g., 0.30 for 30%). Recommended range: 20–35%.
Grams per kg (or lb)
Alternative targeting method using body weight (e.g., 0.8 g/kg ≈ 0.36 g/lb).
Calories from fat
Fat grams × 9 kcal/g.
Saturated fat limit
Upper limit set as a percentage of calories (commonly 10%).

How It Works: A Step-by-Step Example

Consider a 30-year-old male, 175 cm, 75 kg, moderate activity (1.55), aiming to maintain weight with 30% calories from fat.

  1. BMR = 10×75 + 6.25×175 − 5×30 + 5 = 750 + 1093.75 − 150 + 5 = 1,698.75 kcal
  2. TDEE = 1,698.75 × 1.55 ≈ 2,633 kcal
  3. Since the goal is maintain, C_goal = 2,633 kcal
  4. Fat calories = 2,633 × 0.30 = 790 kcal
  5. Fat grams = 790 / 9 ≈ 88 g/day
  6. Saturated fat cap (10%) = (0.10 × 2,633) / 9 ≈ 29 g/day

Frequently Asked Questions (FAQ)

Is 20–35% fat right for everyone?

It’s a broadly applicable range for healthy adults. Individual needs vary by preference, medical conditions, and training load.

What if I follow a low-carb or keto approach?

You can set a higher fat percentage in the tool; ensure micronutrient adequacy and consult a qualified professional if needed.

How do I choose between percentage vs. grams per kg?

Percentages align to total calorie intake; g/kg aligns to body size. Athletes often prefer g/kg; both are valid.

Does a higher fat intake harm performance?

Performance depends on overall energy and macro balance for your sport. Match fat intake to goals while meeting carbohydrate and protein needs.

Are unsaturated fats better?

Unsaturated fats (mono- and polyunsaturated) are generally encouraged, while saturated fat is commonly limited to <10% of calories.

Is this medical advice?

No. This calculator is informational and based on public guidelines. Consult your healthcare professional for personalized advice.


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[','\]
','
Formula (extracted LaTeX)
\[= (sel, ctx=document) => Array.from(ctx.querySelectorAll(sel)); const fmt = (n, digits=0) => Number.isFinite(n) ? n.toLocaleString(undefined, { maximumFractionDigits: digits, minimumFractionDigits: digits }) : '—'; // Elements const unitsMetric = $('#unitsMetric'); const unitsUS = $('#unitsUS'); const calSrcDirect = $('#calSrcDirect'); const calSrcEstimate = $('#calSrcEstimate'); const caloriesDirectGroup = $('#caloriesDirectGroup'); const tdeeGroup = $('#tdeeGroup'); const dailyCalories = $('#dailyCalories'); const calError = $('#calError'); const sexMale = $('#sexMale'); const sexFemale = $('#sexFemale'); const age = $('#age'); const heightCm = $('#heightCm'); const heightFt = $('#heightFt'); const heightIn = $('#heightIn'); const weightKg = $('#weightKg'); const weightLb = $('#weightLb'); const activity = $('#activity'); const goal = $('#goal'); const goalPct = $('#goalPct'); const ageError = $('#ageError'); const heightError = $('#heightError'); const weightError = $('#weightError'); const activityError = $('#activityError'); const fatByPct = $('#fatByPct'); const fatByKg = $('#fatByKg'); const pctGroup = $('#pctGroup'); const kgGroup = $('#kgGroup'); const fatPercent = $('#fatPercent'); const satLimit = $('#satLimit'); const pctError = $('#pctError'); const gPerKg = $('#gPerKg'); const gPerLb = $('#gPerLb'); const gkgError = $('#gkgError'); const glbError = $('#glbError'); const resCalories = $('#resCalories'); const resFat = $('#resFat'); const resFatCals = $('#resFatCals'); const resFatPct = $('#resFatPct'); const resRange = $('#resRange'); const resSat = $('#resSat'); const metricOnly =\]
= (sel, ctx=document) => Array.from(ctx.querySelectorAll(sel)); const fmt = (n, digits=0) => Number.isFinite(n) ? n.toLocaleString(undefined, { maximumFractionDigits: digits, minimumFractionDigits: digits }) : '—'; // Elements const unitsMetric = $('#unitsMetric'); const unitsUS = $('#unitsUS'); const calSrcDirect = $('#calSrcDirect'); const calSrcEstimate = $('#calSrcEstimate'); const caloriesDirectGroup = $('#caloriesDirectGroup'); const tdeeGroup = $('#tdeeGroup'); const dailyCalories = $('#dailyCalories'); const calError = $('#calError'); const sexMale = $('#sexMale'); const sexFemale = $('#sexFemale'); const age = $('#age'); const heightCm = $('#heightCm'); const heightFt = $('#heightFt'); const heightIn = $('#heightIn'); const weightKg = $('#weightKg'); const weightLb = $('#weightLb'); const activity = $('#activity'); const goal = $('#goal'); const goalPct = $('#goalPct'); const ageError = $('#ageError'); const heightError = $('#heightError'); const weightError = $('#weightError'); const activityError = $('#activityError'); const fatByPct = $('#fatByPct'); const fatByKg = $('#fatByKg'); const pctGroup = $('#pctGroup'); const kgGroup = $('#kgGroup'); const fatPercent = $('#fatPercent'); const satLimit = $('#satLimit'); const pctError = $('#pctError'); const gPerKg = $('#gPerKg'); const gPerLb = $('#gPerLb'); const gkgError = $('#gkgError'); const glbError = $('#glbError'); const resCalories = $('#resCalories'); const resFat = $('#resFat'); const resFatCals = $('#resFatCals'); const resFatPct = $('#resFatPct'); const resRange = $('#resRange'); const resSat = $('#resSat'); const metricOnly =
Formula (extracted LaTeX)
\[('.us-only'); // Tooltips const tooltips = [ { btn: $('#ttCalBtn'), panel: $('#ttCal') }, { btn: $('#ttGoalBtn'), panel: $('#ttGoal') }, { btn: $('#ttPctBtn'), panel: $('#ttPct') }, { btn: $('#ttSatBtn'), panel: $('#ttSat') }, { btn: $('#ttGkgBtn'), panel: $('#ttGkg') }, { btn: $('#ttGlbBtn'), panel: $('#ttGlb') } ].filter(t => t.btn && t.panel); tooltips.forEach(({btn, panel}) => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; btn.setAttribute('aria-expanded', String(!expanded)); panel.setAttribute('aria-hidden', String(expanded)); }); btn.addEventListener('keydown', (e) => { if (e.key === 'Escape') { btn.setAttribute('aria-expanded', 'false'); panel.setAttribute('aria-hidden', 'true'); btn.focus(); } }); }); // Unit switching with conversion function toCm(ft, inch){ const f = parseFloat(ft)||0, i = parseFloat(inch)||0; return (f*12 + i) * 2.54; } function cmToFtIn(cm){ const totalIn = cm / 2.54; const ft = Math.floor(totalIn / 12); const inch = Math.round(totalIn - ft*12); return { ft, inch }; } function kgToLb(kg){ return kg * 2.2046226218 } function lbToKg(lb){ return lb / 2.2046226218 } function setUnits(mode){ const toUS = mode === 'us'; metricOnly.forEach(el => el.hidden = toUS); usOnly.forEach(el => el.hidden = !toUS); if (toUS) { // Convert metric inputs to US fields if present if (heightCm.value){ const {ft, inch} = cmToFtIn(parseFloat(heightCm.value)); heightFt.value = ft; heightIn.value = inch; } if (weightKg.value){ weightLb.value = (kgToLb(parseFloat(weightKg.value))).toFixed(1); } } else { // Convert US inputs to metric const cm = toCm(heightFt.value, heightIn.value); if (cm) heightCm.value = cm.toFixed(1); if (weightLb.value){ weightKg.value = (lbToKg(parseFloat(weightLb.value))).toFixed(1); } } // Toggle g/kg vs g/lb control visibility but keep chosen method the same if (fatByKg.checked){ kgGroup.hidden = false; if (toUS){ // show g/lb, hide g/kg\]
('.us-only'); // Tooltips const tooltips = [ { btn: $('#ttCalBtn'), panel: $('#ttCal') }, { btn: $('#ttGoalBtn'), panel: $('#ttGoal') }, { btn: $('#ttPctBtn'), panel: $('#ttPct') }, { btn: $('#ttSatBtn'), panel: $('#ttSat') }, { btn: $('#ttGkgBtn'), panel: $('#ttGkg') }, { btn: $('#ttGlbBtn'), panel: $('#ttGlb') } ].filter(t => t.btn && t.panel); tooltips.forEach(({btn, panel}) => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; btn.setAttribute('aria-expanded', String(!expanded)); panel.setAttribute('aria-hidden', String(expanded)); }); btn.addEventListener('keydown', (e) => { if (e.key === 'Escape') { btn.setAttribute('aria-expanded', 'false'); panel.setAttribute('aria-hidden', 'true'); btn.focus(); } }); }); // Unit switching with conversion function toCm(ft, inch){ const f = parseFloat(ft)||0, i = parseFloat(inch)||0; return (f*12 + i) * 2.54; } function cmToFtIn(cm){ const totalIn = cm / 2.54; const ft = Math.floor(totalIn / 12); const inch = Math.round(totalIn - ft*12); return { ft, inch }; } function kgToLb(kg){ return kg * 2.2046226218 } function lbToKg(lb){ return lb / 2.2046226218 } function setUnits(mode){ const toUS = mode === 'us'; metricOnly.forEach(el => el.hidden = toUS); usOnly.forEach(el => el.hidden = !toUS); if (toUS) { // Convert metric inputs to US fields if present if (heightCm.value){ const {ft, inch} = cmToFtIn(parseFloat(heightCm.value)); heightFt.value = ft; heightIn.value = inch; } if (weightKg.value){ weightLb.value = (kgToLb(parseFloat(weightKg.value))).toFixed(1); } } else { // Convert US inputs to metric const cm = toCm(heightFt.value, heightIn.value); if (cm) heightCm.value = cm.toFixed(1); if (weightLb.value){ weightKg.value = (lbToKg(parseFloat(weightLb.value))).toFixed(1); } } // Toggle g/kg vs g/lb control visibility but keep chosen method the same if (fatByKg.checked){ kgGroup.hidden = false; if (toUS){ // show g/lb, hide g/kg
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = true); } else {\]
('.metric-only', kgGroup).forEach(n => n.hidden = true); } else {
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = false); } } compute(); } unitsMetric.addEventListener('change', () => { if (unitsMetric.checked) setUnits('metric') }); unitsUS.addEventListener('change', () => { if (unitsUS.checked) setUnits('us') }); // Calorie source toggle function setCalSrc(src){ const est = src === 'estimate'; caloriesDirectGroup.hidden = est; tdeeGroup.hidden = !est; compute(); } calSrcDirect.addEventListener('change', () => { if (calSrcDirect.checked) setCalSrc('direct') }); calSrcEstimate.addEventListener('change', () => { if (calSrcEstimate.checked) setCalSrc('estimate') }); // Fat method toggle function setFatMethod(method){ const byPct = method === 'percent'; pctGroup.hidden = !byPct; kgGroup.hidden = byPct; // show appropriate kg/lb inner groups depending on units if (!byPct){ const isUS = unitsUS.checked;\]
('.metric-only', kgGroup).forEach(n => n.hidden = false); } } compute(); } unitsMetric.addEventListener('change', () => { if (unitsMetric.checked) setUnits('metric') }); unitsUS.addEventListener('change', () => { if (unitsUS.checked) setUnits('us') }); // Calorie source toggle function setCalSrc(src){ const est = src === 'estimate'; caloriesDirectGroup.hidden = est; tdeeGroup.hidden = !est; compute(); } calSrcDirect.addEventListener('change', () => { if (calSrcDirect.checked) setCalSrc('direct') }); calSrcEstimate.addEventListener('change', () => { if (calSrcEstimate.checked) setCalSrc('estimate') }); // Fat method toggle function setFatMethod(method){ const byPct = method === 'percent'; pctGroup.hidden = !byPct; kgGroup.hidden = byPct; // show appropriate kg/lb inner groups depending on units if (!byPct){ const isUS = unitsUS.checked;
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = isUS); } compute(); } fatByPct.addEventListener('change', () => { if (fatByPct.checked) setFatMethod('percent') }); fatByKg.addEventListener('change', () => { if (fatByKg.checked) setFatMethod('bykg') }); // Validation (on blur) and live compute (on input) function setError(el, msg){ el.textContent = msg || ''; } function requiredNumber(input, {min, max, name}, errorEl){ const v = input.value.trim(); if (v === ''){ setError(errorEl, `${name} is required.`); input.setAttribute('aria-invalid','true'); return null; } const n = Number(v); if (!Number.isFinite(n)){ setError(errorEl, `Please enter a valid number for ${name}.`); input.setAttribute('aria-invalid','true'); return null; } if (min!=null && n < min){ setError(errorEl, `${name} must be at least ${min}.`); input.setAttribute('aria-invalid','true'); return null; } if (max!=null && n > max){ setError(errorEl, `${name} must be at most ${max}.`); input.setAttribute('aria-invalid','true'); return null; } setError(errorEl, ''); input.setAttribute('aria-invalid','false'); return n; } // Attach blur validators dailyCalories.addEventListener('blur', () => requiredNumber(dailyCalories, {min:800,max:10000,name:'Daily calories'}, calError)); age.addEventListener('blur', () => requiredNumber(age, {min:14,max:80,name:'Age'}, ageError)); heightCm.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightCm.closest('.metric-only').hidden) requiredNumber(heightCm, {min:120,max:220,name:'Height (cm)'}, heightError) }); heightFt.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightFt.closest('.us-only').hidden) requiredNumber(heightFt, {min:4,max:7,name:'Height (ft)'}, heightError) }); heightIn.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightIn.closest('.us-only').hidden) requiredNumber(heightIn, {min:0,max:11,name:'Height (in)'}, heightError) }); weightKg.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightKg.closest('.metric-only').hidden) requiredNumber(weightKg, {min:35,max:250,name:'Weight (kg)'}, weightError) }); weightLb.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightLb.closest('.us-only').hidden) requiredNumber(weightLb, {min:80,max:550,name:'Weight (lb)'}, weightError) }); fatPercent.addEventListener('blur', () => requiredNumber(fatPercent, {min:10,max:70,name:'Fat percentage'}, pctError)); gPerKg.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerKg.closest('.metric-only').hidden) requiredNumber(gPerKg, {min:0.3,max:1.5,name:'Grams per kg'}, gkgError) }); gPerLb.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerLb.closest('.us-only').hidden) requiredNumber(gPerLb, {min:0.15,max:0.7,name:'Grams per lb'}, glbError) }); // Live compute on changes\]
('.metric-only', kgGroup).forEach(n => n.hidden = isUS); } compute(); } fatByPct.addEventListener('change', () => { if (fatByPct.checked) setFatMethod('percent') }); fatByKg.addEventListener('change', () => { if (fatByKg.checked) setFatMethod('bykg') }); // Validation (on blur) and live compute (on input) function setError(el, msg){ el.textContent = msg || ''; } function requiredNumber(input, {min, max, name}, errorEl){ const v = input.value.trim(); if (v === ''){ setError(errorEl, `${name} is required.`); input.setAttribute('aria-invalid','true'); return null; } const n = Number(v); if (!Number.isFinite(n)){ setError(errorEl, `Please enter a valid number for ${name}.`); input.setAttribute('aria-invalid','true'); return null; } if (min!=null && n < min){ setError(errorEl, `${name} must be at least ${min}.`); input.setAttribute('aria-invalid','true'); return null; } if (max!=null && n > max){ setError(errorEl, `${name} must be at most ${max}.`); input.setAttribute('aria-invalid','true'); return null; } setError(errorEl, ''); input.setAttribute('aria-invalid','false'); return n; } // Attach blur validators dailyCalories.addEventListener('blur', () => requiredNumber(dailyCalories, {min:800,max:10000,name:'Daily calories'}, calError)); age.addEventListener('blur', () => requiredNumber(age, {min:14,max:80,name:'Age'}, ageError)); heightCm.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightCm.closest('.metric-only').hidden) requiredNumber(heightCm, {min:120,max:220,name:'Height (cm)'}, heightError) }); heightFt.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightFt.closest('.us-only').hidden) requiredNumber(heightFt, {min:4,max:7,name:'Height (ft)'}, heightError) }); heightIn.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightIn.closest('.us-only').hidden) requiredNumber(heightIn, {min:0,max:11,name:'Height (in)'}, heightError) }); weightKg.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightKg.closest('.metric-only').hidden) requiredNumber(weightKg, {min:35,max:250,name:'Weight (kg)'}, weightError) }); weightLb.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightLb.closest('.us-only').hidden) requiredNumber(weightLb, {min:80,max:550,name:'Weight (lb)'}, weightError) }); fatPercent.addEventListener('blur', () => requiredNumber(fatPercent, {min:10,max:70,name:'Fat percentage'}, pctError)); gPerKg.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerKg.closest('.metric-only').hidden) requiredNumber(gPerKg, {min:0.3,max:1.5,name:'Grams per kg'}, gkgError) }); gPerLb.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerLb.closest('.us-only').hidden) requiredNumber(gPerLb, {min:0.15,max:0.7,name:'Grams per lb'}, glbError) }); // Live compute on changes
Formula (extracted text)
BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5 BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161 TDEE = BMR \times \text{Activity Factor} C_{goal} = TDEE \times (1 + \delta) g_{fat} = \dfrac{C_{goal} \times p_{fat}}{9} \quad \text{(percentage method, where } p_{fat}\in [0,1]\text{)} g_{fat} = w \times r \quad \text{(body-weight method; } r = \text{g per kg or g per lb)} g_{SFA}^{max} = \dfrac{0.10 \times C_{goal}}{9}
Formula (extracted text)
BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5
Formula (extracted text)
BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161
Formula (extracted text)
TDEE = BMR \times \text{Activity Factor}
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn
Skip to main content

Fat Intake Calculator

This professional fat intake calculator helps you determine how many grams of fat to eat per day based on either a percentage of calories or grams per body weight. It includes an optional TDEE estimator and highlights evidence-based ranges and limits, making it useful for individuals, athletes, and nutrition professionals.

Data Source and Methodology

Authoritative Data Sources:

  • Institute of Medicine (IOM). Dietary Reference Intakes for Energy, Carbohydrate, Fiber, Fat, Fatty Acids, Cholesterol, Protein, and Amino Acids (2005). AMDR for total fat: 20–35% of energy. Link: National Academies Press
  • U.S. Department of Health and Human Services & U.S. Department of Agriculture. Dietary Guidelines for Americans, 2020–2025. Limit saturated fat to <10% of calories. Link: dietaryguidelines.gov
  • Mifflin MD, St Jeor ST, et al. A new predictive equation for resting energy expenditure (1990) — used to estimate TDEE. DOI: 10.1016/S0002-8223(97)00272-1

Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.

The Formulas Explained

BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5

BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161

TDEE = BMR \times \text{Activity Factor}

C_{goal} = TDEE \times (1 + \delta)

g_{fat} = \dfrac{C_{goal} \times p_{fat}}{9} \quad \text{(percentage method, where } p_{fat}\in [0,1]\text{)}

g_{fat} = w \times r \quad \text{(body-weight method; } r = \text{g per kg or g per lb)}

g_{SFA}^{max} = \dfrac{0.10 \times C_{goal}}{9}

Glossary of Variables

Daily calories (C_goal)
Calories used to compute fat targets. Entered directly or estimated from TDEE and goal.
BMR
Basal Metabolic Rate from Mifflin–St Jeor, based on sex, age, height, and weight.
TDEE
Total Daily Energy Expenditure = BMR × activity factor.
Fat percentage (p_fat)
Share of calories from fat (e.g., 0.30 for 30%). Recommended range: 20–35%.
Grams per kg (or lb)
Alternative targeting method using body weight (e.g., 0.8 g/kg ≈ 0.36 g/lb).
Calories from fat
Fat grams × 9 kcal/g.
Saturated fat limit
Upper limit set as a percentage of calories (commonly 10%).

How It Works: A Step-by-Step Example

Consider a 30-year-old male, 175 cm, 75 kg, moderate activity (1.55), aiming to maintain weight with 30% calories from fat.

  1. BMR = 10×75 + 6.25×175 − 5×30 + 5 = 750 + 1093.75 − 150 + 5 = 1,698.75 kcal
  2. TDEE = 1,698.75 × 1.55 ≈ 2,633 kcal
  3. Since the goal is maintain, C_goal = 2,633 kcal
  4. Fat calories = 2,633 × 0.30 = 790 kcal
  5. Fat grams = 790 / 9 ≈ 88 g/day
  6. Saturated fat cap (10%) = (0.10 × 2,633) / 9 ≈ 29 g/day

Frequently Asked Questions (FAQ)

Is 20–35% fat right for everyone?

It’s a broadly applicable range for healthy adults. Individual needs vary by preference, medical conditions, and training load.

What if I follow a low-carb or keto approach?

You can set a higher fat percentage in the tool; ensure micronutrient adequacy and consult a qualified professional if needed.

How do I choose between percentage vs. grams per kg?

Percentages align to total calorie intake; g/kg aligns to body size. Athletes often prefer g/kg; both are valid.

Does a higher fat intake harm performance?

Performance depends on overall energy and macro balance for your sport. Match fat intake to goals while meeting carbohydrate and protein needs.

Are unsaturated fats better?

Unsaturated fats (mono- and polyunsaturated) are generally encouraged, while saturated fat is commonly limited to <10% of calories.

Is this medical advice?

No. This calculator is informational and based on public guidelines. Consult your healthcare professional for personalized advice.


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[','\]
','
Formula (extracted LaTeX)
\[= (sel, ctx=document) => Array.from(ctx.querySelectorAll(sel)); const fmt = (n, digits=0) => Number.isFinite(n) ? n.toLocaleString(undefined, { maximumFractionDigits: digits, minimumFractionDigits: digits }) : '—'; // Elements const unitsMetric = $('#unitsMetric'); const unitsUS = $('#unitsUS'); const calSrcDirect = $('#calSrcDirect'); const calSrcEstimate = $('#calSrcEstimate'); const caloriesDirectGroup = $('#caloriesDirectGroup'); const tdeeGroup = $('#tdeeGroup'); const dailyCalories = $('#dailyCalories'); const calError = $('#calError'); const sexMale = $('#sexMale'); const sexFemale = $('#sexFemale'); const age = $('#age'); const heightCm = $('#heightCm'); const heightFt = $('#heightFt'); const heightIn = $('#heightIn'); const weightKg = $('#weightKg'); const weightLb = $('#weightLb'); const activity = $('#activity'); const goal = $('#goal'); const goalPct = $('#goalPct'); const ageError = $('#ageError'); const heightError = $('#heightError'); const weightError = $('#weightError'); const activityError = $('#activityError'); const fatByPct = $('#fatByPct'); const fatByKg = $('#fatByKg'); const pctGroup = $('#pctGroup'); const kgGroup = $('#kgGroup'); const fatPercent = $('#fatPercent'); const satLimit = $('#satLimit'); const pctError = $('#pctError'); const gPerKg = $('#gPerKg'); const gPerLb = $('#gPerLb'); const gkgError = $('#gkgError'); const glbError = $('#glbError'); const resCalories = $('#resCalories'); const resFat = $('#resFat'); const resFatCals = $('#resFatCals'); const resFatPct = $('#resFatPct'); const resRange = $('#resRange'); const resSat = $('#resSat'); const metricOnly =\]
= (sel, ctx=document) => Array.from(ctx.querySelectorAll(sel)); const fmt = (n, digits=0) => Number.isFinite(n) ? n.toLocaleString(undefined, { maximumFractionDigits: digits, minimumFractionDigits: digits }) : '—'; // Elements const unitsMetric = $('#unitsMetric'); const unitsUS = $('#unitsUS'); const calSrcDirect = $('#calSrcDirect'); const calSrcEstimate = $('#calSrcEstimate'); const caloriesDirectGroup = $('#caloriesDirectGroup'); const tdeeGroup = $('#tdeeGroup'); const dailyCalories = $('#dailyCalories'); const calError = $('#calError'); const sexMale = $('#sexMale'); const sexFemale = $('#sexFemale'); const age = $('#age'); const heightCm = $('#heightCm'); const heightFt = $('#heightFt'); const heightIn = $('#heightIn'); const weightKg = $('#weightKg'); const weightLb = $('#weightLb'); const activity = $('#activity'); const goal = $('#goal'); const goalPct = $('#goalPct'); const ageError = $('#ageError'); const heightError = $('#heightError'); const weightError = $('#weightError'); const activityError = $('#activityError'); const fatByPct = $('#fatByPct'); const fatByKg = $('#fatByKg'); const pctGroup = $('#pctGroup'); const kgGroup = $('#kgGroup'); const fatPercent = $('#fatPercent'); const satLimit = $('#satLimit'); const pctError = $('#pctError'); const gPerKg = $('#gPerKg'); const gPerLb = $('#gPerLb'); const gkgError = $('#gkgError'); const glbError = $('#glbError'); const resCalories = $('#resCalories'); const resFat = $('#resFat'); const resFatCals = $('#resFatCals'); const resFatPct = $('#resFatPct'); const resRange = $('#resRange'); const resSat = $('#resSat'); const metricOnly =
Formula (extracted LaTeX)
\[('.us-only'); // Tooltips const tooltips = [ { btn: $('#ttCalBtn'), panel: $('#ttCal') }, { btn: $('#ttGoalBtn'), panel: $('#ttGoal') }, { btn: $('#ttPctBtn'), panel: $('#ttPct') }, { btn: $('#ttSatBtn'), panel: $('#ttSat') }, { btn: $('#ttGkgBtn'), panel: $('#ttGkg') }, { btn: $('#ttGlbBtn'), panel: $('#ttGlb') } ].filter(t => t.btn && t.panel); tooltips.forEach(({btn, panel}) => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; btn.setAttribute('aria-expanded', String(!expanded)); panel.setAttribute('aria-hidden', String(expanded)); }); btn.addEventListener('keydown', (e) => { if (e.key === 'Escape') { btn.setAttribute('aria-expanded', 'false'); panel.setAttribute('aria-hidden', 'true'); btn.focus(); } }); }); // Unit switching with conversion function toCm(ft, inch){ const f = parseFloat(ft)||0, i = parseFloat(inch)||0; return (f*12 + i) * 2.54; } function cmToFtIn(cm){ const totalIn = cm / 2.54; const ft = Math.floor(totalIn / 12); const inch = Math.round(totalIn - ft*12); return { ft, inch }; } function kgToLb(kg){ return kg * 2.2046226218 } function lbToKg(lb){ return lb / 2.2046226218 } function setUnits(mode){ const toUS = mode === 'us'; metricOnly.forEach(el => el.hidden = toUS); usOnly.forEach(el => el.hidden = !toUS); if (toUS) { // Convert metric inputs to US fields if present if (heightCm.value){ const {ft, inch} = cmToFtIn(parseFloat(heightCm.value)); heightFt.value = ft; heightIn.value = inch; } if (weightKg.value){ weightLb.value = (kgToLb(parseFloat(weightKg.value))).toFixed(1); } } else { // Convert US inputs to metric const cm = toCm(heightFt.value, heightIn.value); if (cm) heightCm.value = cm.toFixed(1); if (weightLb.value){ weightKg.value = (lbToKg(parseFloat(weightLb.value))).toFixed(1); } } // Toggle g/kg vs g/lb control visibility but keep chosen method the same if (fatByKg.checked){ kgGroup.hidden = false; if (toUS){ // show g/lb, hide g/kg\]
('.us-only'); // Tooltips const tooltips = [ { btn: $('#ttCalBtn'), panel: $('#ttCal') }, { btn: $('#ttGoalBtn'), panel: $('#ttGoal') }, { btn: $('#ttPctBtn'), panel: $('#ttPct') }, { btn: $('#ttSatBtn'), panel: $('#ttSat') }, { btn: $('#ttGkgBtn'), panel: $('#ttGkg') }, { btn: $('#ttGlbBtn'), panel: $('#ttGlb') } ].filter(t => t.btn && t.panel); tooltips.forEach(({btn, panel}) => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; btn.setAttribute('aria-expanded', String(!expanded)); panel.setAttribute('aria-hidden', String(expanded)); }); btn.addEventListener('keydown', (e) => { if (e.key === 'Escape') { btn.setAttribute('aria-expanded', 'false'); panel.setAttribute('aria-hidden', 'true'); btn.focus(); } }); }); // Unit switching with conversion function toCm(ft, inch){ const f = parseFloat(ft)||0, i = parseFloat(inch)||0; return (f*12 + i) * 2.54; } function cmToFtIn(cm){ const totalIn = cm / 2.54; const ft = Math.floor(totalIn / 12); const inch = Math.round(totalIn - ft*12); return { ft, inch }; } function kgToLb(kg){ return kg * 2.2046226218 } function lbToKg(lb){ return lb / 2.2046226218 } function setUnits(mode){ const toUS = mode === 'us'; metricOnly.forEach(el => el.hidden = toUS); usOnly.forEach(el => el.hidden = !toUS); if (toUS) { // Convert metric inputs to US fields if present if (heightCm.value){ const {ft, inch} = cmToFtIn(parseFloat(heightCm.value)); heightFt.value = ft; heightIn.value = inch; } if (weightKg.value){ weightLb.value = (kgToLb(parseFloat(weightKg.value))).toFixed(1); } } else { // Convert US inputs to metric const cm = toCm(heightFt.value, heightIn.value); if (cm) heightCm.value = cm.toFixed(1); if (weightLb.value){ weightKg.value = (lbToKg(parseFloat(weightLb.value))).toFixed(1); } } // Toggle g/kg vs g/lb control visibility but keep chosen method the same if (fatByKg.checked){ kgGroup.hidden = false; if (toUS){ // show g/lb, hide g/kg
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = true); } else {\]
('.metric-only', kgGroup).forEach(n => n.hidden = true); } else {
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = false); } } compute(); } unitsMetric.addEventListener('change', () => { if (unitsMetric.checked) setUnits('metric') }); unitsUS.addEventListener('change', () => { if (unitsUS.checked) setUnits('us') }); // Calorie source toggle function setCalSrc(src){ const est = src === 'estimate'; caloriesDirectGroup.hidden = est; tdeeGroup.hidden = !est; compute(); } calSrcDirect.addEventListener('change', () => { if (calSrcDirect.checked) setCalSrc('direct') }); calSrcEstimate.addEventListener('change', () => { if (calSrcEstimate.checked) setCalSrc('estimate') }); // Fat method toggle function setFatMethod(method){ const byPct = method === 'percent'; pctGroup.hidden = !byPct; kgGroup.hidden = byPct; // show appropriate kg/lb inner groups depending on units if (!byPct){ const isUS = unitsUS.checked;\]
('.metric-only', kgGroup).forEach(n => n.hidden = false); } } compute(); } unitsMetric.addEventListener('change', () => { if (unitsMetric.checked) setUnits('metric') }); unitsUS.addEventListener('change', () => { if (unitsUS.checked) setUnits('us') }); // Calorie source toggle function setCalSrc(src){ const est = src === 'estimate'; caloriesDirectGroup.hidden = est; tdeeGroup.hidden = !est; compute(); } calSrcDirect.addEventListener('change', () => { if (calSrcDirect.checked) setCalSrc('direct') }); calSrcEstimate.addEventListener('change', () => { if (calSrcEstimate.checked) setCalSrc('estimate') }); // Fat method toggle function setFatMethod(method){ const byPct = method === 'percent'; pctGroup.hidden = !byPct; kgGroup.hidden = byPct; // show appropriate kg/lb inner groups depending on units if (!byPct){ const isUS = unitsUS.checked;
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = isUS); } compute(); } fatByPct.addEventListener('change', () => { if (fatByPct.checked) setFatMethod('percent') }); fatByKg.addEventListener('change', () => { if (fatByKg.checked) setFatMethod('bykg') }); // Validation (on blur) and live compute (on input) function setError(el, msg){ el.textContent = msg || ''; } function requiredNumber(input, {min, max, name}, errorEl){ const v = input.value.trim(); if (v === ''){ setError(errorEl, `${name} is required.`); input.setAttribute('aria-invalid','true'); return null; } const n = Number(v); if (!Number.isFinite(n)){ setError(errorEl, `Please enter a valid number for ${name}.`); input.setAttribute('aria-invalid','true'); return null; } if (min!=null && n < min){ setError(errorEl, `${name} must be at least ${min}.`); input.setAttribute('aria-invalid','true'); return null; } if (max!=null && n > max){ setError(errorEl, `${name} must be at most ${max}.`); input.setAttribute('aria-invalid','true'); return null; } setError(errorEl, ''); input.setAttribute('aria-invalid','false'); return n; } // Attach blur validators dailyCalories.addEventListener('blur', () => requiredNumber(dailyCalories, {min:800,max:10000,name:'Daily calories'}, calError)); age.addEventListener('blur', () => requiredNumber(age, {min:14,max:80,name:'Age'}, ageError)); heightCm.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightCm.closest('.metric-only').hidden) requiredNumber(heightCm, {min:120,max:220,name:'Height (cm)'}, heightError) }); heightFt.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightFt.closest('.us-only').hidden) requiredNumber(heightFt, {min:4,max:7,name:'Height (ft)'}, heightError) }); heightIn.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightIn.closest('.us-only').hidden) requiredNumber(heightIn, {min:0,max:11,name:'Height (in)'}, heightError) }); weightKg.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightKg.closest('.metric-only').hidden) requiredNumber(weightKg, {min:35,max:250,name:'Weight (kg)'}, weightError) }); weightLb.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightLb.closest('.us-only').hidden) requiredNumber(weightLb, {min:80,max:550,name:'Weight (lb)'}, weightError) }); fatPercent.addEventListener('blur', () => requiredNumber(fatPercent, {min:10,max:70,name:'Fat percentage'}, pctError)); gPerKg.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerKg.closest('.metric-only').hidden) requiredNumber(gPerKg, {min:0.3,max:1.5,name:'Grams per kg'}, gkgError) }); gPerLb.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerLb.closest('.us-only').hidden) requiredNumber(gPerLb, {min:0.15,max:0.7,name:'Grams per lb'}, glbError) }); // Live compute on changes\]
('.metric-only', kgGroup).forEach(n => n.hidden = isUS); } compute(); } fatByPct.addEventListener('change', () => { if (fatByPct.checked) setFatMethod('percent') }); fatByKg.addEventListener('change', () => { if (fatByKg.checked) setFatMethod('bykg') }); // Validation (on blur) and live compute (on input) function setError(el, msg){ el.textContent = msg || ''; } function requiredNumber(input, {min, max, name}, errorEl){ const v = input.value.trim(); if (v === ''){ setError(errorEl, `${name} is required.`); input.setAttribute('aria-invalid','true'); return null; } const n = Number(v); if (!Number.isFinite(n)){ setError(errorEl, `Please enter a valid number for ${name}.`); input.setAttribute('aria-invalid','true'); return null; } if (min!=null && n < min){ setError(errorEl, `${name} must be at least ${min}.`); input.setAttribute('aria-invalid','true'); return null; } if (max!=null && n > max){ setError(errorEl, `${name} must be at most ${max}.`); input.setAttribute('aria-invalid','true'); return null; } setError(errorEl, ''); input.setAttribute('aria-invalid','false'); return n; } // Attach blur validators dailyCalories.addEventListener('blur', () => requiredNumber(dailyCalories, {min:800,max:10000,name:'Daily calories'}, calError)); age.addEventListener('blur', () => requiredNumber(age, {min:14,max:80,name:'Age'}, ageError)); heightCm.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightCm.closest('.metric-only').hidden) requiredNumber(heightCm, {min:120,max:220,name:'Height (cm)'}, heightError) }); heightFt.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightFt.closest('.us-only').hidden) requiredNumber(heightFt, {min:4,max:7,name:'Height (ft)'}, heightError) }); heightIn.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightIn.closest('.us-only').hidden) requiredNumber(heightIn, {min:0,max:11,name:'Height (in)'}, heightError) }); weightKg.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightKg.closest('.metric-only').hidden) requiredNumber(weightKg, {min:35,max:250,name:'Weight (kg)'}, weightError) }); weightLb.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightLb.closest('.us-only').hidden) requiredNumber(weightLb, {min:80,max:550,name:'Weight (lb)'}, weightError) }); fatPercent.addEventListener('blur', () => requiredNumber(fatPercent, {min:10,max:70,name:'Fat percentage'}, pctError)); gPerKg.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerKg.closest('.metric-only').hidden) requiredNumber(gPerKg, {min:0.3,max:1.5,name:'Grams per kg'}, gkgError) }); gPerLb.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerLb.closest('.us-only').hidden) requiredNumber(gPerLb, {min:0.15,max:0.7,name:'Grams per lb'}, glbError) }); // Live compute on changes
Formula (extracted text)
BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5 BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161 TDEE = BMR \times \text{Activity Factor} C_{goal} = TDEE \times (1 + \delta) g_{fat} = \dfrac{C_{goal} \times p_{fat}}{9} \quad \text{(percentage method, where } p_{fat}\in [0,1]\text{)} g_{fat} = w \times r \quad \text{(body-weight method; } r = \text{g per kg or g per lb)} g_{SFA}^{max} = \dfrac{0.10 \times C_{goal}}{9}
Formula (extracted text)
BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5
Formula (extracted text)
BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161
Formula (extracted text)
TDEE = BMR \times \text{Activity Factor}
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn
Skip to main content

Fat Intake Calculator

This professional fat intake calculator helps you determine how many grams of fat to eat per day based on either a percentage of calories or grams per body weight. It includes an optional TDEE estimator and highlights evidence-based ranges and limits, making it useful for individuals, athletes, and nutrition professionals.

Data Source and Methodology

Authoritative Data Sources:

  • Institute of Medicine (IOM). Dietary Reference Intakes for Energy, Carbohydrate, Fiber, Fat, Fatty Acids, Cholesterol, Protein, and Amino Acids (2005). AMDR for total fat: 20–35% of energy. Link: National Academies Press
  • U.S. Department of Health and Human Services & U.S. Department of Agriculture. Dietary Guidelines for Americans, 2020–2025. Limit saturated fat to <10% of calories. Link: dietaryguidelines.gov
  • Mifflin MD, St Jeor ST, et al. A new predictive equation for resting energy expenditure (1990) — used to estimate TDEE. DOI: 10.1016/S0002-8223(97)00272-1

Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.

The Formulas Explained

BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5

BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161

TDEE = BMR \times \text{Activity Factor}

C_{goal} = TDEE \times (1 + \delta)

g_{fat} = \dfrac{C_{goal} \times p_{fat}}{9} \quad \text{(percentage method, where } p_{fat}\in [0,1]\text{)}

g_{fat} = w \times r \quad \text{(body-weight method; } r = \text{g per kg or g per lb)}

g_{SFA}^{max} = \dfrac{0.10 \times C_{goal}}{9}

Glossary of Variables

Daily calories (C_goal)
Calories used to compute fat targets. Entered directly or estimated from TDEE and goal.
BMR
Basal Metabolic Rate from Mifflin–St Jeor, based on sex, age, height, and weight.
TDEE
Total Daily Energy Expenditure = BMR × activity factor.
Fat percentage (p_fat)
Share of calories from fat (e.g., 0.30 for 30%). Recommended range: 20–35%.
Grams per kg (or lb)
Alternative targeting method using body weight (e.g., 0.8 g/kg ≈ 0.36 g/lb).
Calories from fat
Fat grams × 9 kcal/g.
Saturated fat limit
Upper limit set as a percentage of calories (commonly 10%).

How It Works: A Step-by-Step Example

Consider a 30-year-old male, 175 cm, 75 kg, moderate activity (1.55), aiming to maintain weight with 30% calories from fat.

  1. BMR = 10×75 + 6.25×175 − 5×30 + 5 = 750 + 1093.75 − 150 + 5 = 1,698.75 kcal
  2. TDEE = 1,698.75 × 1.55 ≈ 2,633 kcal
  3. Since the goal is maintain, C_goal = 2,633 kcal
  4. Fat calories = 2,633 × 0.30 = 790 kcal
  5. Fat grams = 790 / 9 ≈ 88 g/day
  6. Saturated fat cap (10%) = (0.10 × 2,633) / 9 ≈ 29 g/day

Frequently Asked Questions (FAQ)

Is 20–35% fat right for everyone?

It’s a broadly applicable range for healthy adults. Individual needs vary by preference, medical conditions, and training load.

What if I follow a low-carb or keto approach?

You can set a higher fat percentage in the tool; ensure micronutrient adequacy and consult a qualified professional if needed.

How do I choose between percentage vs. grams per kg?

Percentages align to total calorie intake; g/kg aligns to body size. Athletes often prefer g/kg; both are valid.

Does a higher fat intake harm performance?

Performance depends on overall energy and macro balance for your sport. Match fat intake to goals while meeting carbohydrate and protein needs.

Are unsaturated fats better?

Unsaturated fats (mono- and polyunsaturated) are generally encouraged, while saturated fat is commonly limited to <10% of calories.

Is this medical advice?

No. This calculator is informational and based on public guidelines. Consult your healthcare professional for personalized advice.


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[','\]
','
Formula (extracted LaTeX)
\[= (sel, ctx=document) => Array.from(ctx.querySelectorAll(sel)); const fmt = (n, digits=0) => Number.isFinite(n) ? n.toLocaleString(undefined, { maximumFractionDigits: digits, minimumFractionDigits: digits }) : '—'; // Elements const unitsMetric = $('#unitsMetric'); const unitsUS = $('#unitsUS'); const calSrcDirect = $('#calSrcDirect'); const calSrcEstimate = $('#calSrcEstimate'); const caloriesDirectGroup = $('#caloriesDirectGroup'); const tdeeGroup = $('#tdeeGroup'); const dailyCalories = $('#dailyCalories'); const calError = $('#calError'); const sexMale = $('#sexMale'); const sexFemale = $('#sexFemale'); const age = $('#age'); const heightCm = $('#heightCm'); const heightFt = $('#heightFt'); const heightIn = $('#heightIn'); const weightKg = $('#weightKg'); const weightLb = $('#weightLb'); const activity = $('#activity'); const goal = $('#goal'); const goalPct = $('#goalPct'); const ageError = $('#ageError'); const heightError = $('#heightError'); const weightError = $('#weightError'); const activityError = $('#activityError'); const fatByPct = $('#fatByPct'); const fatByKg = $('#fatByKg'); const pctGroup = $('#pctGroup'); const kgGroup = $('#kgGroup'); const fatPercent = $('#fatPercent'); const satLimit = $('#satLimit'); const pctError = $('#pctError'); const gPerKg = $('#gPerKg'); const gPerLb = $('#gPerLb'); const gkgError = $('#gkgError'); const glbError = $('#glbError'); const resCalories = $('#resCalories'); const resFat = $('#resFat'); const resFatCals = $('#resFatCals'); const resFatPct = $('#resFatPct'); const resRange = $('#resRange'); const resSat = $('#resSat'); const metricOnly =\]
= (sel, ctx=document) => Array.from(ctx.querySelectorAll(sel)); const fmt = (n, digits=0) => Number.isFinite(n) ? n.toLocaleString(undefined, { maximumFractionDigits: digits, minimumFractionDigits: digits }) : '—'; // Elements const unitsMetric = $('#unitsMetric'); const unitsUS = $('#unitsUS'); const calSrcDirect = $('#calSrcDirect'); const calSrcEstimate = $('#calSrcEstimate'); const caloriesDirectGroup = $('#caloriesDirectGroup'); const tdeeGroup = $('#tdeeGroup'); const dailyCalories = $('#dailyCalories'); const calError = $('#calError'); const sexMale = $('#sexMale'); const sexFemale = $('#sexFemale'); const age = $('#age'); const heightCm = $('#heightCm'); const heightFt = $('#heightFt'); const heightIn = $('#heightIn'); const weightKg = $('#weightKg'); const weightLb = $('#weightLb'); const activity = $('#activity'); const goal = $('#goal'); const goalPct = $('#goalPct'); const ageError = $('#ageError'); const heightError = $('#heightError'); const weightError = $('#weightError'); const activityError = $('#activityError'); const fatByPct = $('#fatByPct'); const fatByKg = $('#fatByKg'); const pctGroup = $('#pctGroup'); const kgGroup = $('#kgGroup'); const fatPercent = $('#fatPercent'); const satLimit = $('#satLimit'); const pctError = $('#pctError'); const gPerKg = $('#gPerKg'); const gPerLb = $('#gPerLb'); const gkgError = $('#gkgError'); const glbError = $('#glbError'); const resCalories = $('#resCalories'); const resFat = $('#resFat'); const resFatCals = $('#resFatCals'); const resFatPct = $('#resFatPct'); const resRange = $('#resRange'); const resSat = $('#resSat'); const metricOnly =
Formula (extracted LaTeX)
\[('.us-only'); // Tooltips const tooltips = [ { btn: $('#ttCalBtn'), panel: $('#ttCal') }, { btn: $('#ttGoalBtn'), panel: $('#ttGoal') }, { btn: $('#ttPctBtn'), panel: $('#ttPct') }, { btn: $('#ttSatBtn'), panel: $('#ttSat') }, { btn: $('#ttGkgBtn'), panel: $('#ttGkg') }, { btn: $('#ttGlbBtn'), panel: $('#ttGlb') } ].filter(t => t.btn && t.panel); tooltips.forEach(({btn, panel}) => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; btn.setAttribute('aria-expanded', String(!expanded)); panel.setAttribute('aria-hidden', String(expanded)); }); btn.addEventListener('keydown', (e) => { if (e.key === 'Escape') { btn.setAttribute('aria-expanded', 'false'); panel.setAttribute('aria-hidden', 'true'); btn.focus(); } }); }); // Unit switching with conversion function toCm(ft, inch){ const f = parseFloat(ft)||0, i = parseFloat(inch)||0; return (f*12 + i) * 2.54; } function cmToFtIn(cm){ const totalIn = cm / 2.54; const ft = Math.floor(totalIn / 12); const inch = Math.round(totalIn - ft*12); return { ft, inch }; } function kgToLb(kg){ return kg * 2.2046226218 } function lbToKg(lb){ return lb / 2.2046226218 } function setUnits(mode){ const toUS = mode === 'us'; metricOnly.forEach(el => el.hidden = toUS); usOnly.forEach(el => el.hidden = !toUS); if (toUS) { // Convert metric inputs to US fields if present if (heightCm.value){ const {ft, inch} = cmToFtIn(parseFloat(heightCm.value)); heightFt.value = ft; heightIn.value = inch; } if (weightKg.value){ weightLb.value = (kgToLb(parseFloat(weightKg.value))).toFixed(1); } } else { // Convert US inputs to metric const cm = toCm(heightFt.value, heightIn.value); if (cm) heightCm.value = cm.toFixed(1); if (weightLb.value){ weightKg.value = (lbToKg(parseFloat(weightLb.value))).toFixed(1); } } // Toggle g/kg vs g/lb control visibility but keep chosen method the same if (fatByKg.checked){ kgGroup.hidden = false; if (toUS){ // show g/lb, hide g/kg\]
('.us-only'); // Tooltips const tooltips = [ { btn: $('#ttCalBtn'), panel: $('#ttCal') }, { btn: $('#ttGoalBtn'), panel: $('#ttGoal') }, { btn: $('#ttPctBtn'), panel: $('#ttPct') }, { btn: $('#ttSatBtn'), panel: $('#ttSat') }, { btn: $('#ttGkgBtn'), panel: $('#ttGkg') }, { btn: $('#ttGlbBtn'), panel: $('#ttGlb') } ].filter(t => t.btn && t.panel); tooltips.forEach(({btn, panel}) => { btn.addEventListener('click', () => { const expanded = btn.getAttribute('aria-expanded') === 'true'; btn.setAttribute('aria-expanded', String(!expanded)); panel.setAttribute('aria-hidden', String(expanded)); }); btn.addEventListener('keydown', (e) => { if (e.key === 'Escape') { btn.setAttribute('aria-expanded', 'false'); panel.setAttribute('aria-hidden', 'true'); btn.focus(); } }); }); // Unit switching with conversion function toCm(ft, inch){ const f = parseFloat(ft)||0, i = parseFloat(inch)||0; return (f*12 + i) * 2.54; } function cmToFtIn(cm){ const totalIn = cm / 2.54; const ft = Math.floor(totalIn / 12); const inch = Math.round(totalIn - ft*12); return { ft, inch }; } function kgToLb(kg){ return kg * 2.2046226218 } function lbToKg(lb){ return lb / 2.2046226218 } function setUnits(mode){ const toUS = mode === 'us'; metricOnly.forEach(el => el.hidden = toUS); usOnly.forEach(el => el.hidden = !toUS); if (toUS) { // Convert metric inputs to US fields if present if (heightCm.value){ const {ft, inch} = cmToFtIn(parseFloat(heightCm.value)); heightFt.value = ft; heightIn.value = inch; } if (weightKg.value){ weightLb.value = (kgToLb(parseFloat(weightKg.value))).toFixed(1); } } else { // Convert US inputs to metric const cm = toCm(heightFt.value, heightIn.value); if (cm) heightCm.value = cm.toFixed(1); if (weightLb.value){ weightKg.value = (lbToKg(parseFloat(weightLb.value))).toFixed(1); } } // Toggle g/kg vs g/lb control visibility but keep chosen method the same if (fatByKg.checked){ kgGroup.hidden = false; if (toUS){ // show g/lb, hide g/kg
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = true); } else {\]
('.metric-only', kgGroup).forEach(n => n.hidden = true); } else {
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = false); } } compute(); } unitsMetric.addEventListener('change', () => { if (unitsMetric.checked) setUnits('metric') }); unitsUS.addEventListener('change', () => { if (unitsUS.checked) setUnits('us') }); // Calorie source toggle function setCalSrc(src){ const est = src === 'estimate'; caloriesDirectGroup.hidden = est; tdeeGroup.hidden = !est; compute(); } calSrcDirect.addEventListener('change', () => { if (calSrcDirect.checked) setCalSrc('direct') }); calSrcEstimate.addEventListener('change', () => { if (calSrcEstimate.checked) setCalSrc('estimate') }); // Fat method toggle function setFatMethod(method){ const byPct = method === 'percent'; pctGroup.hidden = !byPct; kgGroup.hidden = byPct; // show appropriate kg/lb inner groups depending on units if (!byPct){ const isUS = unitsUS.checked;\]
('.metric-only', kgGroup).forEach(n => n.hidden = false); } } compute(); } unitsMetric.addEventListener('change', () => { if (unitsMetric.checked) setUnits('metric') }); unitsUS.addEventListener('change', () => { if (unitsUS.checked) setUnits('us') }); // Calorie source toggle function setCalSrc(src){ const est = src === 'estimate'; caloriesDirectGroup.hidden = est; tdeeGroup.hidden = !est; compute(); } calSrcDirect.addEventListener('change', () => { if (calSrcDirect.checked) setCalSrc('direct') }); calSrcEstimate.addEventListener('change', () => { if (calSrcEstimate.checked) setCalSrc('estimate') }); // Fat method toggle function setFatMethod(method){ const byPct = method === 'percent'; pctGroup.hidden = !byPct; kgGroup.hidden = byPct; // show appropriate kg/lb inner groups depending on units if (!byPct){ const isUS = unitsUS.checked;
Formula (extracted LaTeX)
\[('.metric-only', kgGroup).forEach(n => n.hidden = isUS); } compute(); } fatByPct.addEventListener('change', () => { if (fatByPct.checked) setFatMethod('percent') }); fatByKg.addEventListener('change', () => { if (fatByKg.checked) setFatMethod('bykg') }); // Validation (on blur) and live compute (on input) function setError(el, msg){ el.textContent = msg || ''; } function requiredNumber(input, {min, max, name}, errorEl){ const v = input.value.trim(); if (v === ''){ setError(errorEl, `${name} is required.`); input.setAttribute('aria-invalid','true'); return null; } const n = Number(v); if (!Number.isFinite(n)){ setError(errorEl, `Please enter a valid number for ${name}.`); input.setAttribute('aria-invalid','true'); return null; } if (min!=null && n < min){ setError(errorEl, `${name} must be at least ${min}.`); input.setAttribute('aria-invalid','true'); return null; } if (max!=null && n > max){ setError(errorEl, `${name} must be at most ${max}.`); input.setAttribute('aria-invalid','true'); return null; } setError(errorEl, ''); input.setAttribute('aria-invalid','false'); return n; } // Attach blur validators dailyCalories.addEventListener('blur', () => requiredNumber(dailyCalories, {min:800,max:10000,name:'Daily calories'}, calError)); age.addEventListener('blur', () => requiredNumber(age, {min:14,max:80,name:'Age'}, ageError)); heightCm.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightCm.closest('.metric-only').hidden) requiredNumber(heightCm, {min:120,max:220,name:'Height (cm)'}, heightError) }); heightFt.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightFt.closest('.us-only').hidden) requiredNumber(heightFt, {min:4,max:7,name:'Height (ft)'}, heightError) }); heightIn.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightIn.closest('.us-only').hidden) requiredNumber(heightIn, {min:0,max:11,name:'Height (in)'}, heightError) }); weightKg.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightKg.closest('.metric-only').hidden) requiredNumber(weightKg, {min:35,max:250,name:'Weight (kg)'}, weightError) }); weightLb.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightLb.closest('.us-only').hidden) requiredNumber(weightLb, {min:80,max:550,name:'Weight (lb)'}, weightError) }); fatPercent.addEventListener('blur', () => requiredNumber(fatPercent, {min:10,max:70,name:'Fat percentage'}, pctError)); gPerKg.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerKg.closest('.metric-only').hidden) requiredNumber(gPerKg, {min:0.3,max:1.5,name:'Grams per kg'}, gkgError) }); gPerLb.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerLb.closest('.us-only').hidden) requiredNumber(gPerLb, {min:0.15,max:0.7,name:'Grams per lb'}, glbError) }); // Live compute on changes\]
('.metric-only', kgGroup).forEach(n => n.hidden = isUS); } compute(); } fatByPct.addEventListener('change', () => { if (fatByPct.checked) setFatMethod('percent') }); fatByKg.addEventListener('change', () => { if (fatByKg.checked) setFatMethod('bykg') }); // Validation (on blur) and live compute (on input) function setError(el, msg){ el.textContent = msg || ''; } function requiredNumber(input, {min, max, name}, errorEl){ const v = input.value.trim(); if (v === ''){ setError(errorEl, `${name} is required.`); input.setAttribute('aria-invalid','true'); return null; } const n = Number(v); if (!Number.isFinite(n)){ setError(errorEl, `Please enter a valid number for ${name}.`); input.setAttribute('aria-invalid','true'); return null; } if (min!=null && n < min){ setError(errorEl, `${name} must be at least ${min}.`); input.setAttribute('aria-invalid','true'); return null; } if (max!=null && n > max){ setError(errorEl, `${name} must be at most ${max}.`); input.setAttribute('aria-invalid','true'); return null; } setError(errorEl, ''); input.setAttribute('aria-invalid','false'); return n; } // Attach blur validators dailyCalories.addEventListener('blur', () => requiredNumber(dailyCalories, {min:800,max:10000,name:'Daily calories'}, calError)); age.addEventListener('blur', () => requiredNumber(age, {min:14,max:80,name:'Age'}, ageError)); heightCm.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightCm.closest('.metric-only').hidden) requiredNumber(heightCm, {min:120,max:220,name:'Height (cm)'}, heightError) }); heightFt.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightFt.closest('.us-only').hidden) requiredNumber(heightFt, {min:4,max:7,name:'Height (ft)'}, heightError) }); heightIn.addEventListener('blur', () => { if (!tdeeGroup.hidden && !heightIn.closest('.us-only').hidden) requiredNumber(heightIn, {min:0,max:11,name:'Height (in)'}, heightError) }); weightKg.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightKg.closest('.metric-only').hidden) requiredNumber(weightKg, {min:35,max:250,name:'Weight (kg)'}, weightError) }); weightLb.addEventListener('blur', () => { if (!tdeeGroup.hidden && !weightLb.closest('.us-only').hidden) requiredNumber(weightLb, {min:80,max:550,name:'Weight (lb)'}, weightError) }); fatPercent.addEventListener('blur', () => requiredNumber(fatPercent, {min:10,max:70,name:'Fat percentage'}, pctError)); gPerKg.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerKg.closest('.metric-only').hidden) requiredNumber(gPerKg, {min:0.3,max:1.5,name:'Grams per kg'}, gkgError) }); gPerLb.addEventListener('blur', () => { if (!kgGroup.hidden && !gPerLb.closest('.us-only').hidden) requiredNumber(gPerLb, {min:0.15,max:0.7,name:'Grams per lb'}, glbError) }); // Live compute on changes
Formula (extracted text)
BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5 BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161 TDEE = BMR \times \text{Activity Factor} C_{goal} = TDEE \times (1 + \delta) g_{fat} = \dfrac{C_{goal} \times p_{fat}}{9} \quad \text{(percentage method, where } p_{fat}\in [0,1]\text{)} g_{fat} = w \times r \quad \text{(body-weight method; } r = \text{g per kg or g per lb)} g_{SFA}^{max} = \dfrac{0.10 \times C_{goal}}{9}
Formula (extracted text)
BMR_{male} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age + 5
Formula (extracted text)
BMR_{female} = 10\,w_{kg} + 6.25\,h_{cm} - 5\,age - 161
Formula (extracted text)
TDEE = BMR \times \text{Activity Factor}
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn
Formulas

(Formulas preserved from original page content, if present.)

Version 0.1.0-draft
Citations

Add authoritative sources relevant to this calculator (standards bodies, manuals, official docs).

Changelog
  • 0.1.0-draft — 2026-01-19: Initial draft (review required).