KETO Calculator

https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js https://www.gstatic.com/charts/loader.js // google charts google.charts.load("current", {'packages':['corechart']}); // variables used var heightIn; var heightCm; var gender; var age; var weightKg; var weightLbs; var activity; var tdee; var carbs = 50; var protein; var fat; var selectedWLType; var customCarbs; var customProtein; var customFat; // grab variables from their fields var getVars = function() { heightIn = Number($("#height-in").val()) + Number($("#height-feet").val()) * 12; heightCm = Number($("#height-cm").val()); gender = $("#gender").val(); age = Number($("#age").val()); weightKg = Number($("#weight-kg").val()); weightLbs = Number($("#weight-lbs").val()); activity = $("input[name='activity']:checked").val(); tdee = getTdee(); carbs = getCarbs(); protein = getProtein(); fat = getFat(); selectedWLType = $(".wl-type.active"); wlTypeIsSelected = (selectedWLType.length != 0); selectedCarbs = getSelectedCarbs(); selectedProtein = getSelectedProtein(); selectedFat = getSelectedFat(); selectedTdee = getSelectedTdee(); customCarbs = Number($("#custom-carbs").val()); customProtein = Number($("#custom-protein").val()); customFat = Number($("#custom-fat").html()); } // conversions var kgToLbs = function() { getVars(); $("#weight-lbs").val((weightKg * 2.20462).toFixed(1)); } var lbsToKg = function() { getVars(); $("#weight-kg").val((weightLbs / 2.20462).toFixed(1)); } var inToCm = function() { getVars(); $("#height-cm").val((heightIn * 2.54).toFixed(1)); } var cmToIn = function() { getVars(); $("#height-in").val(((heightCm / 2.54) % 12).toFixed(1)); $("#height-feet").val((Math.trunc(heightCm / 12 / 2.54))); } // get the tdee by either calculating it or grabbing the custom tdee var getTdee = function() { if(activity === "custom") { return Number($("#custom-tdee").val()); } else { return calcTdee(); } } var calcBmr = function() { if (gender === "male") { return 10 * weightKg + 6.25 * heightCm - 5 * age + 5; } else if (gender === "female") { return 10 * weightKg + 6.25 * heightCm - 5 * age - 161; } } var calcTdee = function() { var mult; switch (activity) { case "sedentary": mult = 1.2; break; case "lightly": mult = 1.375; break; case "moderately": mult = 1.55; break; case "very": mult = 1.725 break; case "extremely": mult = 1.9 break } return Math.floor(calcBmr() * mult); } // get various macros var getCarbs = function() { return 50; } var getProtein = function() { return Math.floor(weightKg); } var getFat = function() { return Math.floor((tdee - (carbs + protein) * 4) / 9); } // update output var updateOutput = function() { updateExampleOutputs(); updateResults(); updateEstimates(); } // update example outputs var updateExampleOutputs = function() { $(".wl-type").each(function(idx) { var mult = 1; switch($(this).attr('id')) { case "slow": mult = 0.9; break; case "fast": mult = 0.8; break; } $(this).find("#carbs-out").html(Math.floor(carbs*mult)); $(this).find("#protein-out").html(Math.floor(protein*mult)); $(this).find("#fat-out").html(Math.floor(fat*mult)); $(this).find("#tdee-out").html(Math.floor(tdee*mult)); $(this).find("#wl-out").html((tdee*(1 - mult)/500).toFixed(1)); }); } // update results var updateResults = function() { getVars(); $("#carbs-result").html(customCarbs); $("#protein-result").html(customProtein); $("#fat-result").html(customFat); $("#tdee-result").html(selectedTdee); drawChart(); } // update food estimates var updateEstimates = function() { getVars(); $("#carbs-out-e").html(customCarbs); $("#protein-out-e").html(customProtein); $("#fat-out-e").html(customFat); $("#protein-ounces-out").html((customProtein/7).toFixed(1)); $("#protein-grams-out").html((customProtein/7*28).toFixed(1)); $("#fat-tablespoons-out").html((fat/13).toFixed(1)); } // draw chart var drawChart = function() { getVars(); var data = google.visualization.arrayToDataTable([ ['Macronutrient', 'Grams per day'], ['Carbs', customCarbs], ['Protein', customProtein], ['Fat', customFat], ]); var options = { title: "Daily Macronutrient Breakdown", height: 400, width: 500 }; var chart = new google.visualization.PieChart(document.getElementById("chart")); chart.draw(data, options); } // get various things from selected wl type var getSelectedCarbs = function() { return Number(selectedWLType.find("#carbs-out").html()); } var getSelectedProtein = function() { return Number(selectedWLType.find("#protein-out").html()); } var getSelectedFat = function() { return Number(selectedWLType.find("#fat-out").html()); } var getSelectedTdee = function() { return Number(selectedWLType.find("#tdee-out").html()); } // set the custom values when the selected WL type changes var setCustom = function() { $("#custom-carbs").val(selectedCarbs); $("#custom-protein").val(selectedProtein); $("#custom-fat").html(selectedFat); customCarbs = selectedCarbs; customProtein = selectedProtein; customFat = selectedFat; } // automatically adjust macro values when the other is adjusted var fixFat = function() { getVars(); $("#custom-fat").html(Math.floor((selectedTdee - (customCarbs * 4) - (customProtein * 4))/9)); } // form updated var onFormChange = function() { // sanitize(); getVars(); updateOutput(); } // set up page var setup = function() { $("#calculator").change(onFormChange); $("#weight-kg").change(kgToLbs); $("#weight-lbs").change(lbsToKg); $("#height-in").change(inToCm); $("#height-feet").change(inToCm); $("#height-cm").change(cmToIn); $(".wl-type").click(function() { $(".wl-type").removeClass("active"); $(this).addClass("active"); getVars(); setCustom(); updateOutput(); }); $("#custom-carbs").change(fixFat); $("#custom-protein").change(fixFat); getVars(); updateOutput(); } $(document).ready(setup); #calculator { font-size: 14pt; } #calculator .row { width: 100%; margin-bottom: 10px; } #calculator label { display: inline-block; float: left; width: 200px; } #calculator select { width: 10ch; } #calculator input { width: 10ch; } #calculator .in-sm { width: 6ch; } #calculator .right { display: inline; float: left; } #calculator .column-2 { display: inline-block; vertical-align: top; width: calc(50% - 25px); } #calculator .column-2:nth-of-type(2n+1) { margin-right: 10px; } #calculator .column-2:nth-of-type(2n) { margin-left: 10px; } #calculator .column-3 { display: inline-block; vertical-align: top; width: 30%; } #calculator .column-3:nth-of-type(2n) { margin-left: 10px; margin-right: 10px; } #calculator .activity input { width: 13px; } #calculator .activity input#custom-tdee { width: 10ch; } #calculator .wl-type { display: inline-block; border: 1px solid black; padding: 0.5em .75em; cursor: pointer; width: calc(100% - 2 * .75em + 5px); } #calculator .wl-type.active { border: 3px solid green; } #calculator .description { margin-top: 1em; margin-bottom: 1em; } #calculator #chart { width: 500px; } @media(max-width: 800px) { #calculator .column-2 { width: 100%; margin-left: 0px !important; margin-right: 0px !important; } #calculator .column-3 { width: 100%; margin-left: 0px !important; margin-right: 0px !important; } #calculator .wl-type { width: calc(100% - 50px); margin-bottom: 10px; } #calculator #chart { margin-left: -80px; } }

Step 1 - Enter Your Personal Information

Female Male
feet inches
Ideal weight is the weight you would like to be. If you only started gaining weight as an adult, your weight at age 18 or 20 might be your "ideal weight".

Select your activity level

Sedentary: Little to no exercise
Lightly active: light exercise or sports 1-3 days each week
Moderately active: moderate exercise or sports 3-5 days each week
Very active: hard exercise or sports 6-7 days eachs week
Extremely active: very hard exercise or sports 6-7 days each week and a physical job
Custom: enter a custom total daily energy expenditure

Step 2 - Select Your Weight Loss Rate

Maintenance

Carbs: grams
Protein: grams
Fat: grams
TDEE: calories
Estimated weight loss per week: pounds

Slow Weight Loss

Carbs: grams
Protein: grams
Fat: grams
TDEE: calories
Estimated weight loss per week: pounds

Fast Weight Loss

Carbs: grams
Protein: grams
Fat: grams
TDEE: calories
Estimated weight loss per week: pounds
You may use one of the above suggestions, or pick one of the suggestions and customize your carb and protein amounts in step 3.

Step 3 - Customize Your Macronutrients (optional)

grams
grams
grams
Customize your carb and protein macronutrients here.
For helping with reversing diabetes or pre-diabetes, it is suggested to limit carbs to less than 20g and protein to less than 60g.

Your Results

Carbs: grams
Protein: grams
Fat: grams
TDEE: calories
TDEE: The amount of calories you burn during a normal day

Food Estimates

Your daily Total Carb intake is grams. It should mainly come from leafy vegetables. Refer to the LCHF Food List for some suggestions.
Your daily Protein intake is grams. That is approximately ounces or grams of meat or seafood. One palm size estimate is about 3 ounces. Refer to the image below for a visual estimation.
Your daily Fat intake is grams. That is about tablespoons of oil or butter.

portion sizeEnjoy this Low Carb High Fat Ketogenic Lifestyle!

More questions? Check out the LCHF Keto FAQ!