How Our Calculators Work

Last updated:

This page sets out every formula, unit factor and rounding rule used by the Recipe & Food Cost Calculator, the Menu Price Calculator and the Food Cost Percentage Calculator. All three use the same calculation code, and all calculations run in your browser.

Formulas

Percentages are entered as whole numbers (30 means 30%) and divided by 100 inside the formula.

Ingredient cost(purchase price ÷ purchase quantity) × quantity used in purchase units ÷ (yield % ÷ 100)

Recipe costsum of ingredient costs

Cost per servingrecipe cost ÷ number of servings

Food cost %cost ÷ menu price × 100

Suggested pricecost ÷ (target food cost % ÷ 100)

Gross profit per platemenu price − cost

Gross margin %(menu price − cost) ÷ menu price × 100

Markup %(menu price − cost) ÷ cost × 100

Cost of goods sold (period)beginning inventory + purchases − ending inventory

Food cost % (period)cost of goods sold ÷ food sales × 100

Gap to targetactual food cost % − target food cost % (in percentage points)

The recipe amount is the usable (edible-portion) amount, which is why the cost is divided by the yield. Yield must be more than 0 and no more than 100%; a blank yield means 100%.

Examples these formulas produce (also used in our automated tests): 6 oz of chicken at $3.49 per lb costs $1.31, or $1.75 at a 75% yield; a $3.00 cost at a $10.00 price gives a 30.0% food cost, 70.0% gross margin and 233.3% markup; a $2.735 cost at a 30% target gives a $9.12 suggested price; and the period example on our food cost percentage guide gives 31.3%.

Results and status labels

  • Loss: the cost per serving is higher than the menu price, so gross profit is negative and food cost % is over 100%.
  • Above target / Below target / On target: the gap to target is more than zero, less than zero, or exactly zero.
  • Markup "Not applicable": markup cannot be calculated when the cost is zero.

Units and conversion factors

Units convert only within the same kind: weight to weight, volume to volume, count to count. Weight converts through grams and volume through milliliters.

  • 1 pound (avoirdupois) = 453.59237 grams, and 1 ounce = 1/16 pound.
  • 1 US gallon = 231 cubic inches = 3.785411784 liters. 1 US fluid ounce = 1/128 gallon.
  • US cooking measures are defined from the fluid ounce: 1 cup = 8 fl oz, 1 tablespoon = 1/2 fl oz, 1 teaspoon = 1/6 fl oz. A quart is 1/4 gallon and a pint is 1/8 gallon.
  • 1 dozen = 12 each.

The pound, gallon and fluid ounce values are from NIST Handbook 44, Appendix C (see sources).

Weight units (in grams)
UnitEquals (grams)
grams (g)1
kilograms (kg)1,000
ounces (oz, weight)28.349523
pounds (lb)453.59237
Volume units (in milliliters)
UnitEquals (milliliters)
milliliters (ml)1
liters (L)1,000
teaspoons (tsp)4.928922
tablespoons (tbsp)14.786765
fluid ounces (fl oz)29.57353
cups (US)236.588237
pints (US)473.176473
quarts (US)946.352946
gallons (US)3,785.411784
Count units (in each)
UnitEquals (each)
each / pieces1
dozen12

Values in these tables are shown to 6 decimal places; the calculators use the exact definitions above.

Why weight and volume are not mixed

Converting between weight and volume needs the density of the specific ingredient, and published figures for the same ingredient can differ depending on how it is measured. To avoid giving you a precise-looking but wrong answer, the calculators do not include any built-in density values and will not convert between weight and volume. They also never convert count units (each, dozen) to weight or volume. Use the same kind of unit for what you bought and what the recipe uses.

Rounding

  • Calculations retain unrounded values through the calculation steps. Money calculations use exact decimal-fraction arithmetic internally to avoid binary floating-point errors at half-cent boundaries.
  • Money is rounded to the nearest cent only for display. Exact half-cent values are rounded away from zero: positive amounts round up, and negative amounts round down (away from zero).
  • Examples: $11.205 displays as $11.21; a loss of -$0.005 displays as -$0.01; and -$0.004 displays as $0.00.
  • Percentages are rounded to one decimal place only for display.

The calculation engine uses exact decimal fractions for money operations and converts the result back to a JavaScript number for its public interface. The display-rounding rule is applied to the decimal value represented by that number. This prevents common binary floating-point errors from changing a half-cent result. It does not mean every displayed percentage or unit-table value is exact to unlimited decimal places.

Input checks

Amounts must be numbers. Prices, quantities used and inventory values cannot be negative. Purchase quantity, servings, menu price, food sales and yield must be more than zero. Yield cannot be more than 100%. A target food cost % must be more than 0 and less than 100. Ending inventory cannot be larger than beginning inventory plus purchases. When a check fails, the calculator shows a message next to the field and does not show a result.

What the calculators do not include

The calculators work with ingredient costs only. They do not include labor, rent, utilities, taxes, payment processing fees or any other operating expense, so they do not tell you whether a dish or a business is profitable overall. Results are estimates based on the numbers you enter. See our disclaimer.

How we check the calculations

The calculation code has automated tests that compare its results with examples worked out by hand, including the examples on this page, unit conversions, yield, rounding and every input check. The calculators on each page call that same tested code; the pages themselves do not contain separate formulas.

Sources