{
  "id": "keto",
  "version": "3e4750a310f1",
  "status": "published",
  "name": "Keto Calculator",
  "question": "What are my keto macros?",
  "summary": "Works out daily keto macros: a fixed number of grams of carbs, a share of protein and the rest as fat, from typed calories or from your BMR, activity and goal, checked against ketogenic diet ranges.",
  "category": "health",
  "subcategory": "nutrition",
  "url": "https://www.acalculator.org/health/keto-calculator",
  "markdown": "https://www.acalculator.org/health/keto-calculator.md",
  "kind": "function",
  "method": "Carbs (g) as typed; protein (g) = calories × protein share ÷ 4; fat (g) = (calories − carbs × 4 − protein calories) ÷ 9. Calories are typed, or TDEE (BMR × activity factor) − the goal.",
  "assumptions": [
    "Protein and carbohydrate give 4 calories per gram and fat gives 9 (21 CFR 101.9).",
    "The keto ranges are from StatPearls: 20 to 50 g of carbohydrate a day; about 55–60% of calories from fat, 30–35% from protein and 5–10% from carbohydrate.",
    "Worked-out calories use Mifflin-St Jeor or the revised Harris-Benedict, the activity factors 1.2 to 1.9, and 500 calories a day per pound a week.",
    "This is an estimate for planning, not medical advice; talk to a doctor before a ketogenic diet, especially with diabetes, kidney disease or pregnancy."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "known": {
        "title": "Daily calories",
        "description": "Whether to work out your daily calories from your body and goal, or type them in.",
        "type": "string",
        "enum": [
          "body",
          "calories"
        ]
      },
      "calories": {
        "title": "Calories a day",
        "description": "The calories you plan to eat each day.",
        "type": "number",
        "minimum": 500,
        "maximum": 10000
      },
      "sex": {
        "title": "Sex",
        "description": "Sex at birth, which the body formulas use.",
        "type": "string",
        "enum": [
          "male",
          "female"
        ]
      },
      "age": {
        "title": "Age",
        "description": "Your age in whole years.",
        "type": "integer",
        "minimum": 18,
        "maximum": 100
      },
      "height": {
        "title": "Height",
        "description": "Your height without shoes.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.9,
        "maximum": 3
      },
      "weight": {
        "title": "Weight",
        "description": "Your body weight.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "mass",
        "minimum": 25,
        "maximum": 700
      },
      "activity": {
        "title": "Activity",
        "description": "How active you are in a usual week, which sets the multiplier on your BMR.",
        "type": "string",
        "enum": [
          "sedentary",
          "light",
          "moderate",
          "very",
          "extra"
        ]
      },
      "goal": {
        "title": "Goal",
        "description": "Keep or lose weight, which takes from your daily calories.",
        "type": "string",
        "enum": [
          "maintain",
          "lose05",
          "lose1",
          "lose2"
        ]
      },
      "carbs": {
        "title": "Carbs (g a day)",
        "description": "Grams of carbohydrate a day; a ketogenic diet usually keeps this at 20 to 50 g.",
        "type": "number",
        "minimum": 0,
        "maximum": 300
      },
      "protein": {
        "title": "Protein",
        "description": "The share of calories from protein; about 30% to 35% on a ketogenic diet. Fat gets the rest.",
        "type": "number",
        "x-unit": "percent",
        "minimum": 0,
        "maximum": 100
      },
      "formula": {
        "title": "BMR formula",
        "description": "The equation for basal metabolic rate: Mifflin-St Jeor (1990) or the revised Harris-Benedict (1984).",
        "type": "string",
        "enum": [
          "mifflin",
          "harris"
        ]
      }
    }
  },
  "outputs": {
    "fat": {
      "label": "Fat a day",
      "description": "Grams of fat a day: the calories carbs and protein leave, ÷ 9.",
      "format": "quantity",
      "unit": "g"
    },
    "protein": {
      "label": "Protein a day",
      "description": "Grams of protein a day: calories × protein share ÷ 4.",
      "format": "quantity",
      "unit": "g"
    },
    "carbs": {
      "label": "Carbs a day",
      "description": "Grams of carbohydrate a day, as typed.",
      "format": "quantity",
      "unit": "g"
    },
    "calories": {
      "label": "Calories a day",
      "description": "The daily calories the grams are worked out from.",
      "format": "number"
    },
    "fatShare": {
      "label": "Fat share",
      "description": "The share of calories from fat.",
      "format": "percent"
    },
    "proteinShare": {
      "label": "Protein share",
      "description": "The share of calories from protein, as typed.",
      "format": "percent"
    },
    "carbsShare": {
      "label": "Carbs share",
      "description": "The share of calories from carbs: carbs × 4 ÷ calories.",
      "format": "percent"
    },
    "fatKcal": {
      "label": "Calories from fat",
      "description": "Fat grams × 9.",
      "format": "number"
    },
    "proteinKcal": {
      "label": "Calories from protein",
      "description": "Protein grams × 4.",
      "format": "number"
    },
    "carbsKcal": {
      "label": "Calories from carbs",
      "description": "Carb grams × 4.",
      "format": "number"
    },
    "ranges": {
      "label": "Against keto ranges",
      "description": "Whether carbs are 20 to 50 g a day and each share is in the usual keto range: fat 55–60%, protein 30–35%, carbs 5–10%.",
      "format": "text"
    },
    "limit": {
      "label": "Note",
      "description": "A warning when the calories fall below the lowest intake the weight-loss guideline suggests.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "known": "body",
      "calories": 2000,
      "sex": "female",
      "age": 30,
      "height": 1.651,
      "weight": 68.0388555,
      "activity": "light",
      "goal": "maintain",
      "carbs": 25,
      "protein": 35,
      "formula": "mifflin"
    },
    "outputs": {
      "fat": 0.1280421446979167,
      "protein": 0.1685895214609375,
      "carbs": 0.025,
      "calories": 1926.737388125,
      "fatShare": 59.809879093210796,
      "proteinShare": 35,
      "carbsShare": 5.19012090678921,
      "fatKcal": 1152.3793022812501,
      "proteinKcal": 674.35808584375,
      "carbsKcal": 100,
      "ranges": "All inside the usual keto ranges."
    },
    "text": "At 1,927 calories a day, eat about 128 g of fat, 169 g of protein and 25 g of carbs."
  },
  "examples": [
    {
      "given": {
        "known": "body",
        "sex": "female",
        "age": 30,
        "height": 1.651,
        "weight": 68.0388555,
        "activity": "light",
        "goal": "maintain",
        "carbs": 25,
        "protein": 35,
        "formula": "mifflin"
      },
      "expect": {
        "calories": 1926.737388125,
        "fat": 0.1280421446979167,
        "protein": 0.1685895214609375,
        "fatShare": 59.809879093210796,
        "ranges": "All inside the usual keto ranges."
      },
      "source": "Masood W, Annamaraju P, Khan Suheb MZ, Uppaluri KR. Ketogenic Diet. StatPearls, 2023 (https://www.ncbi.nlm.nih.gov/books/NBK499830/, retrieved 2026-10-01); Mifflin et al. 1990; 4, 4 and 9 calories per gram (21 CFR 101.9); Python 3 cross-check"
    },
    {
      "given": {
        "known": "body",
        "sex": "male",
        "age": 35,
        "height": 1.778,
        "weight": 81.6466266,
        "activity": "moderate",
        "goal": "lose1",
        "carbs": 30,
        "protein": 30,
        "formula": "mifflin"
      },
      "expect": {
        "calories": 2224.4602123,
        "fat": 0.15968023873444442,
        "protein": 0.1668345159225
      },
      "source": "Mifflin et al. 1990; 500 calories a day for 1 lb a week (Wishnofsky 1958); hand calculation in content.mdx"
    },
    {
      "given": {
        "known": "calories",
        "calories": 2000,
        "carbs": 20,
        "protein": 30
      },
      "expect": {
        "fat": 0.14666666666666667,
        "protein": 0.15,
        "carbsShare": 4,
        "ranges": "Fat 66% is over the 55% to 60% range. Carbs 4% is under the 5% to 10% range."
      },
      "source": "Masood W et al. Ketogenic Diet, StatPearls 2023 (fat 55–60%, protein 30–35%, carbs 5–10%, carbs 20–50 g a day); hand calculation in content.mdx"
    }
  ],
  "sources": [
    "Masood W, Annamaraju P, Khan Suheb MZ, Uppaluri KR. Ketogenic Diet. In: StatPearls. StatPearls Publishing; 2023 (carbohydrate 20 to 50 g a day; about 55% to 60% fat, 30% to 35% protein and 5% to 10% carbohydrate). https://www.ncbi.nlm.nih.gov/books/NBK499830/ (retrieved 2026-10-01)",
    "U.S. Code of Federal Regulations, 21 CFR 101.9(c)(1)(i)(C): general factors of 4, 4 and 9 calories per gram for protein, total carbohydrate and total fat. https://www.ecfr.gov/current/title-21/chapter-I/subchapter-B/part-101/subpart-A/section-101.9",
    "Mifflin MD, St Jeor ST, Hill LA, Scott BJ, Daugherty SA, Koh YO. A new predictive equation for resting energy expenditure in healthy individuals. Am J Clin Nutr. 1990;51(2):241-247. https://doi.org/10.1093/ajcn/51.2.241",
    "Roza AM, Shizgal HM. The Harris Benedict equation reevaluated: resting energy requirements and the body cell mass. Am J Clin Nutr. 1984;40(1):168-182. https://doi.org/10.1093/ajcn/40.1.168",
    "Wishnofsky M. Caloric equivalents of gained or lost weight. Am J Clin Nutr. 1958;6(5):542-546. https://doi.org/10.1093/ajcn/6.5.542",
    "Jensen MD, Ryan DH, Apovian CM, et al. 2013 AHA/ACC/TOS Guideline for the Management of Overweight and Obesity in Adults. Circulation. 2014;129(25 Suppl 2):S102-S138 (lowest diets of 1,200 and 1,500 calories a day). https://pmc.ncbi.nlm.nih.gov/articles/PMC5819889/"
  ],
  "related": [
    "macro",
    "calorie",
    "tdee",
    "protein"
  ],
  "changelog": []
}
