Calculating nutrition facts for a food product or recipe comes down to three steps: identify the nutrients in each ingredient, adjust for cooking changes, and convert everything to a per-serving basis. Whether you’re developing a product label or figuring out the macros in a homemade dish, the math is straightforward once you understand where the numbers come from.
Start With a Nutrient Database
The foundation of any nutrition calculation is knowing the nutrient content of each raw ingredient. The USDA’s FoodData Central is the standard reference, offering detailed nutrient profiles for thousands of foods. It includes two main data sets: Foundation Foods, which contains analytical data on commodity and minimally processed foods (updated twice a year), and SR Legacy Foods, a historical archive of nutrient data derived from lab analyses and published literature.
To use it, search for each ingredient in your recipe and record the nutrient values per 100 grams. Then scale those values to match the actual weight of each ingredient. If your recipe calls for 200 grams of chicken breast and the database lists 31 grams of protein per 100 grams, your chicken contributes 62 grams of protein. Do this for every nutrient you need across every ingredient, then add them up to get totals for the full recipe.
This database approach is reliable for the nutrients that matter most on a label. Research comparing database calculations to laboratory analysis found no significant differences for calories, protein, or fat. Carbohydrates and fiber showed more variation, with lab-measured fiber values coming in at roughly 172% to 176% of the database-calculated values in one study. For most purposes, though, database calculations are accurate enough and far cheaper than sending samples to a lab.
How Calories Are Calculated
Calories aren’t measured directly from a database. They’re derived from the three macronutrients using a set of conversion factors known as the Atwater system:
- Protein: 4 calories per gram
- Carbohydrates: 4 calories per gram
- Fat: 9 calories per gram
- Alcohol: 7 calories per gram
So if one serving of your recipe contains 10 grams of protein, 30 grams of carbohydrate, and 8 grams of fat, the calorie count would be: (10 × 4) + (30 × 4) + (8 × 9) = 40 + 120 + 72 = 232 calories. This is the same method used by food manufacturers and regulatory agencies worldwide.
Accounting for Cooking Changes
Raw ingredient data doesn’t tell the whole story. Cooking changes both the weight of food (through moisture loss or fat absorption) and the amount of certain nutrients retained. A chicken breast that weighs 200 grams raw might weigh 150 grams after grilling, concentrating its nutrients per gram while also destroying some heat-sensitive vitamins.
The USDA publishes nutrient retention factors to handle this. The standard formula, called the True Retention method, works like this:
% True Retention = (nutrient per gram of cooked food × grams of cooked food) ÷ (nutrient per gram of raw food × grams of raw food) × 100
You need four pieces of information: the weight of the food before and after cooking, and the nutrient content per gram in both the raw and cooked states. When you don’t have cooked weights available, you can compare nutrient values on a dry-weight basis instead, which strips out the effect of water loss.
In practice, most home cooks and small-scale producers simplify this by using the cooked nutrient profiles already available in FoodData Central rather than calculating retention from scratch. The database includes entries for many common foods in their cooked forms, like “chicken breast, roasted” or “broccoli, boiled.” Using these entries saves considerable effort.
Breaking Down Carbohydrates
Total carbohydrate on a nutrition label isn’t a single number. It includes dietary fiber, total sugars, added sugars, and sometimes sugar alcohols. The FDA requires all of these to be listed as sub-components under total carbohydrate, with dietary fiber and added sugars also showing a percent Daily Value.
The concept of “net carbs,” popular in low-carb dieting, isn’t an official FDA term. It typically means total carbohydrates minus fiber and sugar alcohols, based on the reasoning that fiber isn’t digested in the small intestine and sugar alcohols are only partially absorbed. If you’re calculating net carbs for personal tracking, subtract fiber and any sugar alcohols from total carbohydrate. If you’re building a label for a commercial product, you list total carbohydrate and its sub-components as the FDA defines them.
Calculating Percent Daily Value
The %DV column on a nutrition label tells consumers how much of a nutrient one serving provides relative to the recommended daily intake. The formula is simple: divide the amount of the nutrient in one serving by its Daily Value, then multiply by 100.
If one serving of your product contains 460 mg of sodium, and the Daily Value for sodium is 2,300 mg, the %DV is (460 ÷ 2300) × 100 = 20%.
Here are the Daily Values for the nutrients most commonly calculated:
- Total fat: 78 g
- Saturated fat: 20 g
- Cholesterol: 300 mg
- Sodium: 2,300 mg
- Total carbohydrate: 275 g
- Dietary fiber: 28 g
- Added sugars: 50 g
- Protein: 50 g
- Vitamin D: 20 mcg
- Calcium: 1,300 mg
- Iron: 18 mg
- Potassium: 4,700 mg
These values are set by the FDA and apply to adults and children ages 4 and older. Round the final percentage according to FDA rounding rules: increments of 1% below 10%, and increments of 2% from 10% to 50%.
Determining Serving Size
Serving sizes on commercial labels aren’t arbitrary. They’re based on Reference Amounts Customarily Consumed (RACC), which the FDA derived from national food consumption surveys. Each food category has a designated reference amount reflecting how much people typically eat in one sitting. Crackers, for example, have a different RACC than ice cream or soup.
You find the RACC for your product’s food category, then convert that amount into a household measure that makes sense for your specific product, like “about 12 crackers” or “2/3 cup.” For products that require preparation, such as dry pasta or cake mix, the reference amount is based on the unprepared quantity needed to yield one serving of the finished food. If your product is a substitute or “light” version of an existing food, your serving size must match the original product’s serving size.
For personal recipe calculations, serving size is simpler. Weigh the total finished recipe, divide by the number of servings you want, and use that weight as your per-serving basis. All your nutrient totals then get divided by the same number of servings.
When You Need Lab Testing
Database calculations work well for recipes made from whole, recognizable ingredients. But if you’re manufacturing a packaged food product, you may need laboratory analysis to verify your numbers, especially for products with proprietary ingredients, fortified nutrients, or complex processing steps.
Lab testing uses a method called proximate analysis, which measures each major component separately. Moisture is determined by drying a sample at 105°C for at least 12 hours and measuring the weight difference. Protein is measured by digesting the sample in acid and quantifying total nitrogen content. Fat is extracted using a solvent over several hours. Fiber is isolated through a series of acid and alkaline digestions. Ash (total mineral content) is measured by incinerating a sample in a furnace at 550°C for 12 hours. The results from these tests replace or confirm the values you calculated from databases.
Lab testing typically costs several hundred dollars per sample and takes days to complete. For most small producers, it’s worth running at least one lab analysis on a representative batch to validate database-derived calculations, then rechecking whenever you change ingredients or processing methods significantly.
Putting It All Together
The full workflow for calculating nutrition facts looks like this: list every ingredient by weight, look up each one in FoodData Central, multiply nutrient values to match your actual quantities, apply retention factors or use cooked-food database entries if the recipe involves cooking, sum everything across all ingredients, divide by the number of servings, calculate calories using the Atwater factors, and compute %DV for each required nutrient. For a commercial label, match your serving size to the appropriate RACC and format the panel according to FDA guidelines.
Software tools like Nutritionix, CalorieKing, or dedicated label-making platforms like ReciPal and Nutritional automate most of these steps by pulling from the same USDA databases and applying the conversion factors automatically. They’re especially useful for multi-ingredient recipes where doing the math by hand across dozens of nutrients gets tedious quickly.

