Free Keto Calculator
Use this calculator to estimate your daily caloric needs and macronutrient breakdown (carbohydrates, protein, and fat) for a ketogenic diet. This tool helps you tailor your intake based on your age, gender, weight, height, activity level, and fitness goals.
Your Estimated Keto Macros:
Fill in the details and click "Calculate Keto Macros" to see your results.
.keto-calculator-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 700px;
margin: 20px auto;
padding: 25px;
border: 1px solid #e0e0e0;
border-radius: 10px;
background-color: #f9f9f9;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
color: #333;
}
.keto-calculator-container h2 {
text-align: center;
color: #2c3e50;
margin-bottom: 20px;
font-size: 1.8em;
}
.keto-calculator-container p {
line-height: 1.6;
margin-bottom: 15px;
color: #555;
}
.calculator-form .form-group {
margin-bottom: 18px;
display: flex;
flex-direction: column;
}
.calculator-form label {
font-weight: bold;
margin-bottom: 8px;
color: #444;
font-size: 0.95em;
}
.calculator-form input[type="number"],
.calculator-form select {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 6px;
box-sizing: border-box;
font-size: 1em;
background-color: #fff;
transition: border-color 0.3s ease;
}
.calculator-form input[type="number"]:focus,
.calculator-form select:focus {
border-color: #007bff;
outline: none;
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
.calculator-form button {
display: block;
width: 100%;
padding: 14px 20px;
background-color: #28a745;
color: white;
border: none;
border-radius: 6px;
font-size: 1.1em;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
margin-top: 20px;
}
.calculator-form button:hover {
background-color: #218838;
transform: translateY(-2px);
}
.calculator-form button:active {
transform: translateY(0);
}
.calculator-results {
margin-top: 30px;
padding-top: 25px;
border-top: 1px solid #eee;
}
.calculator-results h3 {
color: #2c3e50;
text-align: center;
margin-bottom: 20px;
font-size: 1.5em;
}
.calculator-results #result {
background-color: #e9f7ef;
border: 1px solid #d4edda;
border-radius: 8px;
padding: 20px;
font-size: 1.1em;
line-height: 1.8;
color: #155724;
}
.calculator-results #result p {
margin-bottom: 10px;
}
.calculator-results #result strong {
color: #004085;
}
function calculateKeto() {
var age = parseFloat(document.getElementById("age").value);
var gender = document.getElementById("gender").value;
var weight = parseFloat(document.getElementById("weight").value); // kg
var height = parseFloat(document.getElementById("height").value); // cm
var activityLevel = document.getElementById("activityLevel").value;
var goal = document.getElementById("goal").value;
var resultDiv = document.getElementById("result");
// Input validation
if (isNaN(age) || age <= 0 || isNaN(weight) || weight <= 0 || isNaN(height) || height <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for Age, Weight, and Height.";
return;
}
// 1. Calculate Basal Metabolic Rate (BMR) using Mifflin-St Jeor Equation
var bmr;
if (gender === "male") {
bmr = (10 * weight) + (6.25 * height) – (5 * age) + 5;
} else { // female
bmr = (10 * weight) + (6.25 * height) – (5 * age) – 161;
}
// 2. Calculate Total Daily Energy Expenditure (TDEE)
var activityFactor;
switch (activityLevel) {
case "sedentary":
activityFactor = 1.2;
break;
case "light":
activityFactor = 1.375;
break;
case "moderate":
activityFactor = 1.55;
break;
case "very":
activityFactor = 1.725;
break;
case "extra":
activityFactor = 1.9;
break;
default:
activityFactor = 1.2; // Default to sedentary
}
var tdee = bmr * activityFactor;
// 3. Adjust TDEE for Goal
var targetCalories;
if (goal === "lose") {
targetCalories = tdee * 0.80; // 20% calorie deficit
} else if (goal === "gain") {
targetCalories = tdee * 1.20; // 20% calorie surplus
} else { // maintain
targetCalories = tdee;
}
// 4. Calculate Macronutrients for Keto
// Strict Keto: Net Carbs typically 20g
var netCarbsGrams = 20;
var netCarbsCalories = netCarbsGrams * 4; // 1g carbs = 4 calories
// Protein: Common recommendation 1.2g to 1.7g per kg of body weight for active individuals.
// Let's use 1.2g/kg for a general keto approach.
var proteinGrams = 1.2 * weight;
var proteinCalories = proteinGrams * 4; // 1g protein = 4 calories
// Fat: Remaining calories
var fatCalories = targetCalories – netCarbsCalories – proteinCalories;
var fatGrams = fatCalories / 9; // 1g fat = 9 calories
// Ensure fat grams are not negative due to very low target calories or high protein/carbs
if (fatGrams < 0) {
fatGrams = 0;
fatCalories = 0;
// Recalculate protein if fat is zero to fit within calories, or adjust target calories
// For simplicity, we'll just cap fat at 0 and var protein/carbs dominate if target is too low.
// In a real scenario, this would indicate an unrealistic calorie target for the given macros.
}
// Display results
var resultsHTML = "
Your Daily Estimates:
";
resultsHTML += "
Basal Metabolic Rate (BMR): " + bmr.toFixed(0) + " calories/day";
resultsHTML += "
Total Daily Energy Expenditure (TDEE): " + tdee.toFixed(0) + " calories/day";
resultsHTML += "
Target Daily Calories: " + targetCalories.toFixed(0) + " calories/day";
resultsHTML += "
Keto Macronutrient Breakdown:
";
resultsHTML += "
Net Carbs: " + netCarbsGrams.toFixed(0) + "g (" + ((netCarbsCalories / targetCalories) * 100).toFixed(1) + "%)";
resultsHTML += "
Protein: " + proteinGrams.toFixed(0) + "g (" + ((proteinCalories / targetCalories) * 100).toFixed(1) + "%)";
resultsHTML += "
Fat: " + fatGrams.toFixed(0) + "g (" + ((fatCalories / targetCalories) * 100).toFixed(1) + "%)";
resultsHTML += "
Note: Net carbs are typically kept below 20-50g for ketosis. Protein is set at 1.2g/kg body weight. Fat makes up the remaining calories.";
resultDiv.innerHTML = resultsHTML;
}
Understanding Your Keto Calculator Results
The ketogenic diet is a low-carb, moderate-protein, high-fat eating plan that aims to shift your body's metabolism from burning carbohydrates for fuel to burning fat, a state known as ketosis. This calculator provides estimates to help you achieve or maintain ketosis based on your individual needs.
Key Terms Explained:
- Basal Metabolic Rate (BMR): This is the number of calories your body burns at rest to maintain basic bodily functions like breathing, circulation, and cell production. It's the minimum energy required to keep you alive.
- Total Daily Energy Expenditure (TDEE): Your TDEE is your BMR plus the calories you burn through physical activity and digestion. It represents the total number of calories your body expends in a 24-hour period.
- Target Daily Calories: This is your TDEE adjusted for your specific goal (weight loss, maintenance, or gain). For weight loss, a deficit is created; for weight gain, a surplus.
- Net Carbs: In a ketogenic diet, net carbs are the total carbohydrates minus fiber and sugar alcohols (if they don't impact blood sugar). Keeping net carbs very low (typically 20-50g per day) is crucial for entering and maintaining ketosis.
- Protein: Protein intake on keto is moderate. Too little can lead to muscle loss, while too much can be converted into glucose (gluconeogenesis), potentially hindering ketosis. The calculator uses a common guideline of 1.2g per kg of body weight.
- Fat: Fat is the primary energy source on a ketogenic diet. Once your carb and protein targets are met, the remaining calories come from fat to reach your target daily caloric intake.
How to Use These Numbers:
These numbers are a starting point. Listen to your body, monitor your progress, and adjust your intake as needed. For example, if you're not losing weight on a deficit, you might need to slightly reduce your fat intake. If you're feeling sluggish, you might need to slightly increase your fat or ensure you're getting enough electrolytes.
Always consult with a healthcare professional or a registered dietitian before making significant changes to your diet, especially if you have underlying health conditions.