Sedentary (Office job)
Lightly Active (1-3 days/week)
Moderately Active (3-5 days/week)
Very Active (6-7 days/week)
Lose Weight (20% Deficit)
Maintenance
Gain Muscle (10% Surplus)
Keto Specifics
Your Daily Targets
Total Calories
0
kcal/day
Net Carbs
0
grams
Protein
0
grams
Fat
0
grams
Caloric Breakdown: Carbs 0% | Protein 0% | Fat 0%
Understanding Your Keto Macros
The Ketogenic (Keto) diet is a high-fat, moderate-protein, and very low-carbohydrate nutritional approach designed to transition the body into a metabolic state called ketosis. In ketosis, your body burns fat for fuel instead of glucose.
The Components of Keto Macros
Net Carbs: These are your total carbohydrates minus fiber and sugar alcohols. Keeping net carbs between 20g and 50g is crucial for maintaining ketosis.
Protein: Essential for maintaining muscle mass. Our calculator uses a standard ratio of 1.8g of protein per kg of body weight, which is ideal for most active individuals on keto.
Fats: Fat is your primary energy source on keto. Once you set your carb and protein limits, fat fills in the remaining calories to meet your energy needs.
How We Calculate Your Needs
We use the Mifflin-St Jeor Equation to calculate your Basal Metabolic Rate (BMR), adjust it for your activity level (TDEE), and then apply your specific goal (weight loss, maintenance, or muscle gain). The keto specific macros are then derived by prioritizing protein and carbs, with fats making up the balance.
Realistic Example
Imagine a 30-year-old male weighing 85kg at 180cm tall with a sedentary job. His maintenance calories might be around 2,200. For a weight loss goal (20% deficit), his target would be ~1,760 calories. On a keto plan:
Carbs: 20g (80 kcal)
Protein: 153g (612 kcal)
Fat: 119g (1,068 kcal)
This results in a macro ratio of roughly 5% Carbs, 35% Protein, and 60% Fat—a classic high-protein keto breakdown.
function calculateKetoMacros() {
// Get Inputs
var gender = document.getElementById("gender").value;
var age = parseFloat(document.getElementById("age").value);
var weight = parseFloat(document.getElementById("weight").value);
var height = parseFloat(document.getElementById("height").value);
var activity = parseFloat(document.getElementById("activity").value);
var goalFactor = parseFloat(document.getElementById("goal").value);
var netCarbsLimit = parseFloat(document.getElementById("netCarbs").value);
var proteinRatio = parseFloat(document.getElementById("proteinRatio").value);
// Validation
if (isNaN(age) || isNaN(weight) || isNaN(height) || isNaN(netCarbsLimit)) {
alert("Please enter valid numeric values for all fields.");
return;
}
// BMR Calculation (Mifflin-St Jeor)
var bmr;
if (gender === "male") {
bmr = (10 * weight) + (6.25 * height) – (5 * age) + 5;
} else {
bmr = (10 * weight) + (6.25 * height) – (5 * age) – 161;
}
// TDEE and Target Calories
var tdee = bmr * activity;
var targetCalories = Math.round(tdee * goalFactor);
// Protein Calculation
var targetProtein = Math.round(weight * proteinRatio);
var proteinCals = targetProtein * 4;
// Carb Calculation
var carbCals = netCarbsLimit * 4;
// Fat Calculation (Remaining Calories)
var remainingCals = targetCalories – proteinCals – carbCals;
// Safety check if calories are too low for the chosen carbs/protein
if (remainingCals < 0) {
remainingCals = 0;
}
var targetFat = Math.round(remainingCals / 9);
// Percentages
var pCarbs = Math.round((carbCals / targetCalories) * 100);
var pProtein = Math.round((proteinCals / targetCalories) * 100);
var pFat = 100 – pCarbs – pProtein;
// Display Results
document.getElementById("res-calories").innerText = targetCalories.toLocaleString();
document.getElementById("res-carbs").innerText = netCarbsLimit;
document.getElementById("res-protein").innerText = targetProtein;
document.getElementById("res-fat").innerText = targetFat;
document.getElementById("p-carbs").innerText = pCarbs;
document.getElementById("p-protein").innerText = pProtein;
document.getElementById("p-fat").innerText = pFat;
document.getElementById("keto-results").style.display = "block";
}