Keto Macro Calculator

Keto Macro Calculator

Use this calculator to estimate your daily macronutrient needs (carbohydrates, protein, and fat) for a ketogenic diet, based on your personal details and activity level. Achieving the right macro balance is crucial for entering and maintaining ketosis.









Sedentary (little or no exercise) Lightly Active (light exercise/sports 1-3 days/week) Moderately Active (moderate exercise/sports 3-5 days/week) Very Active (hard exercise/sports 6-7 days a week) Extra Active (very hard exercise/physical job)

Lose Weight (20% deficit) Maintain Weight Gain Weight (15% surplus)



Moderate (1.2 g/kg) Higher (1.5 g/kg) Athlete (1.8 g/kg) Very High (2.0 g/kg)

Your Estimated Daily Keto Macros:

Enter your details and click "Calculate Macros" to see your personalized recommendations.

function calculateKetoMacros() { // Get input values var age = parseFloat(document.getElementById('age').value); var gender = document.querySelector('input[name="gender"]:checked').value; var weight = parseFloat(document.getElementById('weight').value); var weightUnit = document.querySelector('input[name="weightUnit"]:checked').value; var height = parseFloat(document.getElementById('height').value); var heightUnit = document.querySelector('input[name="heightUnit"]:checked').value; var activityFactor = parseFloat(document.getElementById('activityLevel').value); var goal = document.getElementById('goal').value; var carbLimit = parseFloat(document.getElementById('carbLimit').value); var proteinMultiplier = parseFloat(document.getElementById('proteinMultiplier').value); // Input validation if (isNaN(age) || age <= 0 || isNaN(weight) || weight <= 0 || isNaN(height) || height <= 0 || isNaN(carbLimit) || carbLimit < 0 || isNaN(proteinMultiplier) || proteinMultiplier <= 0) { document.getElementById('result').innerHTML = 'Please enter valid positive numbers for all fields.'; return; } // Convert units to metric if necessary var weightKg = (weightUnit === 'lbs') ? weight * 0.453592 : weight; var heightCm = (heightUnit === 'inches') ? height * 2.54 : height; // Step 1: Calculate Basal Metabolic Rate (BMR) using Mifflin-St Jeor Equation var bmr; if (gender === 'male') { bmr = (10 * weightKg) + (6.25 * heightCm) – (5 * age) + 5; } else { // female bmr = (10 * weightKg) + (6.25 * heightCm) – (5 * age) – 161; } // Step 2: Calculate Total Daily Energy Expenditure (TDEE) var tdee = bmr * activityFactor; // Step 3: Adjust TDEE for Goal var targetCalories; if (goal === 'lose') { targetCalories = tdee * 0.80; // 20% deficit } else if (goal === 'maintain') { targetCalories = tdee; } else { // gain targetCalories = tdee * 1.15; // 15% surplus } // Step 4: Calculate Macronutrients // Carbs var carbGrams = carbLimit; var carbCalories = carbGrams * 4; // Protein var proteinGrams = weightKg * proteinMultiplier; var proteinCalories = proteinGrams * 4; // Fat var fatCalories = targetCalories – carbCalories – proteinCalories; // If fat calories are negative, it means protein + carb calories exceed target. // We need to adjust protein down to ensure fat is at least 0. if (fatCalories < 0) { var excessCalories = Math.abs(fatCalories); proteinCalories -= excessCalories; // Ensure protein calories don't go below zero if (proteinCalories < 0) { proteinCalories = 0; // If protein is now zero and fat is still negative, it means carbs alone exceed target. // This is an extreme edge case, handle by capping carbs to remaining target calories. if (targetCalories – carbCalories < 0) { carbCalories = targetCalories; carbGrams = carbCalories / 4; } } proteinGrams = proteinCalories / 4; fatCalories = 0; // Fat is now 0 as protein was adjusted to fit. } var fatGrams = fatCalories / 9; // Display results var resultHtml = '

Your Daily Macro Targets:

'; resultHtml += 'Target Calories: ' + Math.round(targetCalories) + ' kcal'; resultHtml += 'Net Carbohydrates: ' + Math.round(carbGrams) + ' g'; resultHtml += 'Protein: ' + Math.round(proteinGrams) + ' g'; resultHtml += 'Fat: ' + Math.round(fatGrams) + ' g'; resultHtml += 'These are estimated values. Individual needs may vary.'; document.getElementById('result').innerHTML = resultHtml; }

Understanding Your Keto Macros

The ketogenic diet is a low-carb, moderate-protein, high-fat eating plan that aims to shift your body's metabolism from burning glucose for energy to burning fat, a state known as ketosis. Tracking your macronutrients (macros) is essential to ensure you stay within the strict limits required to achieve and maintain ketosis.

How This Calculator Works:

  1. Basal Metabolic Rate (BMR): First, the calculator estimates your Basal Metabolic Rate (BMR) using the Mifflin-St Jeor equation. BMR is the number of calories your body burns at rest to maintain basic bodily functions.
  2. Total Daily Energy Expenditure (TDEE): Your BMR is then multiplied by an activity factor to determine your Total Daily Energy Expenditure (TDEE). This is the total number of calories you burn in a day, including exercise and daily activities.
  3. Calorie Adjustment for Goal: Based on your goal (lose, maintain, or gain weight), your TDEE is adjusted. A deficit is applied for weight loss, a surplus for weight gain, and no change for maintenance.
  4. Macronutrient Distribution:
    • Carbohydrates: Your chosen net carb limit (typically 20-30g for keto) is prioritized.
    • Protein: Protein intake is calculated based on your body weight and the selected protein multiplier, which accounts for activity level and muscle preservation needs.
    • Fat: The remaining calories after accounting for carbs and protein are allocated to fat, which is the primary energy source on a ketogenic diet.

Why Each Macro Matters on Keto:

  • Carbohydrates: Keeping net carbs very low (typically under 20-50g per day) is the cornerstone of keto. This forces your body to deplete its glycogen stores and switch to burning fat for fuel, producing ketones.
  • Protein: Protein is vital for muscle maintenance and repair. While essential, too much protein can be converted into glucose (gluconeogenesis), potentially kicking you out of ketosis. The calculator helps you find a moderate, appropriate level.
  • Fat: Fat is your primary energy source on keto. It provides satiety, helps absorb fat-soluble vitamins, and ensures you have enough fuel when carbs are restricted.

Tips for Using Your Macros:

  • Track Diligently: Use a food tracking app to log everything you eat and ensure you're hitting your macro targets.
  • Net Carbs: Remember to calculate "net carbs" (Total Carbs – Fiber) for most keto plans.
  • Listen to Your Body: These are estimates. Adjust your macros slightly based on how you feel, your energy levels, and your progress.
  • Hydration & Electrolytes: Don't forget to stay well-hydrated and replenish electrolytes, especially during the initial adaptation phase.

Disclaimer: This calculator provides estimates and should not replace professional medical or nutritional advice. Consult with a healthcare provider or registered dietitian before making significant dietary changes.

Leave a Reply

Your email address will not be published. Required fields are marked *