Nutrition and Ingredient Label Generator: One Recipe, Both Panels

A nutrition and ingredient label generator has to produce two things that are easy to get wrong separately and easy to get out of step together: the Nutrition Facts panel and the ingredient statement. If you build them from two different lists, a recipe change updates one and not the other, and the label is wrong the moment the recipe moves. This guide explains how a generator that builds both from a single recipe works, shows the output for a small worked example, and lists what to check before you print.
- Both panels should come from one ingredient list, so a recipe edit changes both at once.
- The ingredient statement is ordered by weight, heaviest first, and the Contains line is built from the same list.
- Nutrition values are summed per recipe, divided by servings, then rounded under 21 CFR 101.9 before they appear on the panel.
- A generator's output is a draft: confirm weights, serving size and any ingredient the source did not match.
Why one list is the whole point
Most label mistakes are not arithmetic errors. They are drift: the ingredient statement was written for last year's recipe, the sodium figure came from a different brand of stock, and nobody reran the panel after the flour changed. A generator that reads both panels from one recipe removes the second copy of the list, which is the copy that goes stale. The ingredient names feed the nutrient lookup, the weights set the ingredient order, and the allergen screen reads the same names, so a single edit flows through all three.
Mealary works this way. You enter a recipe in plain language, such as 100 g cheddar cheese, and the engine matches each line to a USDA FoodData Central record, converts the quantity to grams, sums the nutrients, and writes the label from that single set of matches. The nutrition label generator is where that happens; this guide explains what it is doing so you can check its output rather than trust it blindly.
A worked example: one recipe, two outputs
Take a two-serving cheese toast: 100 g cheddar and 200 g white bread. The values below come from the engine's offline test fixture for these two foods, which is the same code path the live USDA lookup feeds. They are not a live USDA query, so treat them as an illustration of the method and check your own ingredients against FoodData Central before you print anything.
The engine adds the two foods together for the whole recipe, then divides by two. Calories come to 932 for the recipe, or 466 per serving, which the calorie rule rounds to 470. Sodium is 1,601 mg for the recipe, or 800.5 mg per serving, which rounds to 800 mg because sodium above 140 mg rounds to the nearest 10. Total fat is 39.4 g for the recipe, or 19.7 g per serving, which rounds to 20 g and shows as 25% Daily Value.
| Nutrient | Per serving (raw) | Panel value | % Daily Value |
|---|---|---|---|
| Calories | 466 | 470 | not applicable |
| Total fat | 19.7 g | 20 g | 25% |
| Saturated fat | 10.5 g | 11 g | 53% |
| Sodium | 800.5 mg | 800 mg | 35% |
| Total carbohydrate | 49 g | 49 g | 18% |
| Dietary fiber | 2.7 g | 3 g | 10% |
| Protein | 21.5 g | 22 g | 43% |
Per-serving panel values for the cheese toast example, before and after FDA rounding
The ingredient statement comes from the same matches, sorted by weight. Bread weighs 200 g and cheddar 100 g, so bread comes first. The generator writes the USDA descriptions, which reads as 'bread, white, commercially prepared, cheese, cheddar'. That is accurate but not label language, and you would edit it to 'Wheat flour bread, cheddar cheese' before printing. The Contains line is built from the allergens detected across the same matches and reads 'Contains: Milk, Wheat.'
Why the rounding rules matter for the panel
Under 21 CFR 101.9(c), calories below 50 round to the nearest 5 and above 50 to the nearest 10. Fats under 5 g round to the nearest 0.5 g and 5 g and above to the nearest 1 g. Sodium at or below 140 mg rounds to the nearest 5 mg and above that to the nearest 10 mg. A generator that rounds these itself, rather than leaving them to a spreadsheet, is removing one of the most common hand-calculation errors. The Daily Value percentages are calculated from the unrounded amount, which is why 19.7 g of fat shows 25% rather than a figure worked back from 20 g.
What the generator cannot know for you
A generator is only as accurate as its inputs. Three things stay with you. First, weights: if you enter '1 cup of flour' without a food density, the engine assumes water density and flags the line, so measure by weight where you can. Second, serving size: the number of servings is a claim you make, and the panel divides by whatever you enter, so the serving size has to match how a customer will actually portion the product. Third, unmatched lines: an ingredient the USDA match cannot resolve is excluded from the totals and reported as a warning. A panel with a warning is not finished, because the excluded ingredient is missing from both the nutrition figures and the statement.
- Confirm every line matched the USDA record you intended, and that the match is not a different preparation (raw versus cooked, for example).
- Check the serving size against the portion your customer will eat, and confirm the number of servings.
- Clear every warning before printing; an excluded ingredient silently changes the panel if you ignore it.
- Rewrite the ingredient statement into your own label language rather than printing USDA descriptions unchanged.
- Regenerate both panels together after any recipe change, so the statement and the numbers never disagree.
Where this sits in the wider label process
The panel and the statement are two parts of one package. The ingredient label requirements cover the order, the big 9 allergens and the Contains wording in detail, and the nutrition facts label guide explains every line of the panel. If you are reading the panel rather than writing one, the how to read a nutrition label guide covers what each figure means for a shopper.
It should. Both depend on the same ingredient list and the same weights. If they are built separately, a recipe change can update one and leave the other out of date, which is a common source of labelling errors.
By weight in the finished product, heaviest first. The generator sorts its matched ingredients by grams, so the order follows the quantities you entered rather than the order you typed them.
Yes, under the 21 CFR 101.9 rules for calories, fats, sodium and the other nutrients. Daily Value percentages are calculated from the unrounded amounts before rounding.
Not without review. The statement uses USDA food descriptions, which are accurate but often not the wording a label should use. Edit the names into your own ingredient language and check the allergen line before you print.
Stop calculating nutrition by hand
Mealary turns any recipe into per-serving nutrition and a print-ready FDA Nutrition Facts label. It's computed from USDA FoodData Central, with the rounding and %DV done for you and every value cited to its source.