You can do this in a lab, but it’s expensive and slow so a food business will almost always just calculate calories etc based on the ingredients and a list of standard measurements, with an app of some sort ([like this one](https://www.food.gov.uk/business-guidance/menucal-calorie-and-allergen-tool)).
The list is made from actual lab measurements using a calorimeter to basically burn the ingredient and measure the energy released. They often include other facts like vitamin content and so on.
Here’s the one for the UK (the USDA and other agencies have similar ones ): https://www.gov.uk/government/publications/composition-of-foods-integrated-dataset-cofid.
(To help make these measurements repeatable, you can buy or prepare ISO-standard formulations of basic foods! They are made in a lab, quite expensive, and very plainly packaged)
Latest Answers