{
  "id": "food-calorie",
  "version": "0bcabd7a286b",
  "status": "published",
  "name": "Food Calorie Calculator",
  "question": "How many food calories am I eating?",
  "summary": "Computes the calories (kcal and kJ) in a portion or a weight of 154 common foods, from the energy values of the USDA SR Legacy food composition database.",
  "category": "food",
  "subcategory": "cooking",
  "url": "https://www.acalculator.org/food/food-calorie-calculator",
  "markdown": "https://www.acalculator.org/food/food-calorie-calculator.md",
  "kind": "function",
  "method": "calories (kcal) = energy per 100 g × grams eaten ÷ 100; grams eaten = portions × portion weight, or the typed weight; kJ = kcal × 4.184.",
  "assumptions": [
    "Energy values and portion weights are from USDA SR Legacy (April 2018), the final release of the USDA National Nutrient Database for Standard Reference; it is frozen, so the values do not change.",
    "The list holds 154 common foods. Values are averages for the food as described (raw, cooked, drained); a brand or recipe can differ.",
    "Portions are the household measures in SR Legacy, such as 1 medium banana (118 g). Weights are of the food as eaten.",
    "Calories here are kilocalories, the unit food labels call Calories; 1 kcal = 4.184 kJ."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "g": {
        "title": "Food group",
        "description": "The group the food is listed under.",
        "type": "string",
        "enum": [
          "fruit",
          "veg",
          "grain",
          "bread",
          "dairy",
          "meat",
          "fish",
          "nuts",
          "sweet",
          "snack",
          "drink"
        ]
      },
      "fruit": {
        "title": "Food",
        "description": "The food, from the group fruits and juices.",
        "type": "string",
        "enum": [
          "9003",
          "9040",
          "9200",
          "9316",
          "9132",
          "9050",
          "9326",
          "9266",
          "9176",
          "9236",
          "9252",
          "9037",
          "9070",
          "9148",
          "9298",
          "9206",
          "9016"
        ]
      },
      "veg": {
        "title": "Food",
        "description": "The food, from the group vegetables.",
        "type": "string",
        "enum": [
          "11090",
          "11124",
          "11674",
          "11508",
          "11529",
          "11252",
          "11457",
          "11205",
          "11282",
          "11167",
          "11304",
          "11333",
          "11260",
          "11135",
          "11143",
          "11109",
          "11233",
          "11477",
          "11052",
          "11011",
          "11212"
        ]
      },
      "grain": {
        "title": "Food",
        "description": "The food, from the group grains, rice and cereal.",
        "type": "string",
        "enum": [
          "20045",
          "20037",
          "20121",
          "20310",
          "20137",
          "20029",
          "8120",
          "8013",
          "8037"
        ]
      },
      "bread": {
        "title": "Food",
        "description": "The food, from the group bread and baked goods.",
        "type": "string",
        "enum": [
          "18069",
          "18075",
          "18060",
          "18001",
          "18437",
          "18350",
          "18364",
          "18363",
          "18239",
          "18228",
          "18293",
          "18367",
          "18250",
          "18159",
          "18301",
          "18101"
        ]
      },
      "dairy": {
        "title": "Food",
        "description": "The food, from the group dairy and eggs.",
        "type": "string",
        "enum": [
          "1077",
          "1079",
          "1085",
          "1009",
          "1026",
          "1032",
          "1040",
          "1019",
          "1017",
          "1016",
          "1116",
          "1256",
          "1001",
          "1053",
          "1049",
          "1123",
          "1129",
          "1128",
          "1132"
        ]
      },
      "meat": {
        "title": "Food",
        "description": "The food, from the group meat and poultry.",
        "type": "string",
        "enum": [
          "5064",
          "5098",
          "5069",
          "5106",
          "5220",
          "23570",
          "13455",
          "10216",
          "10862",
          "7029",
          "7081",
          "7945",
          "7064",
          "7071",
          "17022"
        ]
      },
      "fish": {
        "title": "Food",
        "description": "The food, from the group fish and seafood.",
        "type": "string",
        "enum": [
          "15237",
          "15121",
          "15016",
          "15271",
          "15262",
          "15088",
          "15140"
        ]
      },
      "nuts": {
        "title": "Food",
        "description": "The food, from the group beans, nuts and seeds.",
        "type": "string",
        "enum": [
          "16015",
          "16057",
          "16070",
          "16033",
          "16426",
          "16158",
          "16167",
          "16390",
          "12061",
          "12155",
          "12085",
          "12152",
          "12037",
          "12006"
        ]
      },
      "sweet": {
        "title": "Food",
        "description": "The food, from the group oils, sweets and sauces.",
        "type": "string",
        "enum": [
          "4053",
          "4582",
          "4025",
          "19335",
          "19296",
          "19353",
          "19297",
          "19120",
          "19904",
          "19095",
          "11935",
          "6164"
        ]
      },
      "snack": {
        "title": "Food",
        "description": "The food, from the group snacks and fast food.",
        "type": "string",
        "enum": [
          "19411",
          "19056",
          "19034",
          "19047",
          "19015",
          "21224",
          "21107",
          "21089",
          "21469",
          "21082",
          "21060",
          "21130",
          "22970"
        ]
      },
      "drink": {
        "title": "Food",
        "description": "The food, from the group drinks.",
        "type": "string",
        "enum": [
          "14148",
          "14144",
          "14209",
          "14355",
          "14003",
          "14096",
          "14106",
          "14037",
          "14091",
          "16120",
          "14555"
        ]
      },
      "by": {
        "title": "Measure by",
        "description": "Count household portions (such as 1 medium banana) or type a weight.",
        "type": "string",
        "enum": [
          "portion",
          "weight"
        ]
      },
      "n": {
        "title": "Number of portions",
        "description": "How many of the food’s household portions you eat; fractions such as 0.5 are fine.",
        "type": "number",
        "minimum": 0,
        "maximum": 100
      },
      "w": {
        "title": "Weight eaten",
        "description": "The weight of the food you eat, as eaten (cooked foods are weighed cooked).",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "mass",
        "minimum": 0,
        "maximum": 10
      }
    }
  },
  "outputs": {
    "calories": {
      "label": "Calories",
      "description": "Energy in kilocalories (the Calories on a food label): kcal per 100 g × grams eaten ÷ 100.",
      "format": "number"
    },
    "kj": {
      "label": "Energy in kilojoules",
      "description": "The same energy in kilojoules: kcal × 4.184.",
      "format": "number"
    },
    "per100": {
      "label": "Calories per 100 g",
      "description": "The food’s energy per 100 grams in USDA SR Legacy.",
      "format": "number"
    },
    "grams": {
      "label": "Grams eaten",
      "description": "The weight eaten: portions × the portion weight, or the typed weight.",
      "format": "number"
    },
    "eaten": {
      "label": "Amount",
      "description": "What the calories are for: the portions with their weight, or the weight in grams.",
      "format": "text"
    },
    "food": {
      "label": "Food",
      "description": "The food’s short name.",
      "format": "text"
    },
    "ndb": {
      "label": "USDA NDB number",
      "description": "The food’s number in USDA SR Legacy, to look it up in FoodData Central.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "g": "fruit",
      "fruit": "9040",
      "veg": "11090",
      "grain": "20045",
      "bread": "18069",
      "dairy": "1077",
      "meat": "5064",
      "fish": "15237",
      "nuts": "16015",
      "sweet": "4053",
      "snack": "19411",
      "drink": "14148",
      "by": "portion",
      "n": 1,
      "w": 0.1
    },
    "outputs": {
      "calories": 105.02,
      "kj": 439.40368,
      "per100": 89,
      "grams": 118,
      "eaten": "1 medium banana (118 g)",
      "food": "Banana, raw",
      "ndb": "09040"
    },
    "text": "Banana, raw: 1 medium banana (118 g) has about 105 calories."
  },
  "examples": [
    {
      "given": {
        "g": "fruit",
        "fruit": "9040",
        "by": "portion",
        "n": 1
      },
      "expect": {
        "calories": 105.02,
        "per100": 89,
        "grams": 118,
        "eaten": "1 medium banana (118 g)",
        "ndb": "09040"
      },
      "source": "USDA FoodData Central, SR Legacy 09040 Bananas, raw: 89 kcal per 100 g; 1 medium (7\" to 7-7/8\" long) = 118 g, https://fdc.nal.usda.gov/fdc-app.html#/food-details/173944/nutrients; hand calculation in content.mdx: 89 × 118 ÷ 100 = 105.02"
    },
    {
      "given": {
        "g": "dairy",
        "dairy": "1123",
        "by": "portion",
        "n": 2
      },
      "expect": {
        "calories": 143,
        "kj": 598.312,
        "grams": 100,
        "eaten": "2 × 1 large egg (50 g)"
      },
      "source": "USDA FoodData Central, SR Legacy 01123 Egg, whole, raw, fresh: 143 kcal per 100 g; 1 large = 50 g, https://fdc.nal.usda.gov/fdc-app.html#/food-details/171287/nutrients; hand calculation in content.mdx: 143 × 100 ÷ 100 = 143 kcal = 598.312 kJ"
    },
    {
      "given": {
        "g": "grain",
        "grain": "20045",
        "by": "weight",
        "w": 0.25
      },
      "expect": {
        "calories": 325,
        "grams": 250,
        "eaten": "250 g"
      },
      "source": "USDA FoodData Central, SR Legacy 20045 Rice, white, long-grain, regular, enriched, cooked: 130 kcal per 100 g, https://fdc.nal.usda.gov/fdc-app.html#/food-details/168878/nutrients; hand calculation in content.mdx: 130 × 250 ÷ 100 = 325"
    },
    {
      "given": {
        "g": "nuts",
        "nuts": "12061",
        "by": "portion",
        "n": 1.5
      },
      "expect": {
        "calories": 246.21975,
        "grams": 42.525,
        "eaten": "1.5 × 1 oz (23 almonds) (28.35 g)"
      },
      "source": "USDA FoodData Central, SR Legacy 12061 Nuts, almonds: 579 kcal per 100 g; 1 oz (23 whole kernels) = 28.35 g, https://fdc.nal.usda.gov/fdc-app.html#/food-details/170567/nutrients; hand calculation in content.mdx: 579 × 42.525 ÷ 100 = 246.21975"
    }
  ],
  "sources": [
    "U.S. Department of Agriculture, Agricultural Research Service. FoodData Central: SR Legacy, April 2018 (energy, nutrient 1008, kcal per 100 g; household portion weights). Public domain. https://fdc.nal.usda.gov/",
    "USDA FoodData Central, Download Datasets (SR Legacy, April 2018, CSV). https://fdc.nal.usda.gov/download-datasets/",
    "NIST Special Publication 811, Guide for the Use of the International System of Units, Appendix B (calorie, thermochemical = 4.184 J exactly). https://www.nist.gov/pml/special-publication-811"
  ],
  "related": [
    "abv",
    "bmr",
    "calorie"
  ],
  "changelog": []
}
