> For the complete documentation index, see [llms.txt](https://docs.foodcore.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.foodcore.io/recipes/how-costing-works.md).

# How recipe costing works

FoodCore calculates recipe costs automatically from your ingredient data. Understanding how the maths works helps you spot mistakes quickly and trust your numbers when they look right.

## The basic calculation

Every ingredient line in a recipe uses this formula:

```
Line cost = quantity used × (cost per pack ÷ pack size)
```

In other words: FoodCore works out how much the ingredient costs per gram (or per unit), then multiplies by how much you're using.

**Example:** you have butter at £2.80 per 500g pack.

* Cost per gram = £2.80 ÷ 500 = £0.0056 per gram
* You use 250g in a recipe
* Line cost = 250 × £0.0056 = **£1.40**

All ingredient line costs are added together to give the **batch cost** — the total cost to make one batch of this recipe.

```
Batch cost = sum of all ingredient line costs
```

The batch cost is then divided by the servings count you set on the recipe:

```
Cost per serving = batch cost ÷ servings
```

**Example:** your batch of 24 shortbread biscuits costs £3.60 to make.

* Cost per serving = £3.60 ÷ 24 = **£0.15 per biscuit**

That's it. The system handles the arithmetic — your job is to make sure the input data is correct.

## The most common costing mistakes

### Wrong pack size

This is far and away the most common mistake. If you enter a pack size of 1 when the pack is actually 1000g, FoodCore thinks you're paying your pack price per gram — which makes everything 1000× more expensive than it is.

**Check:** open any ingredient, go to Purchasing, and look at the cost per gram shown. For plain flour bought at £1.50 per kg, that should be around £0.0015/g. If it says £1.50/g, the pack size is set to 1 instead of 1000.

Always enter pack size in the same unit as the ingredient's unit. If the ingredient unit is grams, enter pack size in grams (e.g. 1000 for a 1kg bag, 500 for a 500g pack, 2500 for a 2.5kg sack).

### Wrong unit on a recipe line

If an ingredient is set up in grams but you add it to a recipe in kilograms and forget to change the unit selector, FoodCore may interpret it as 500 grams when you meant 500 kilograms — or vice versa. Always check the unit dropdown alongside the quantity when adding ingredients to a recipe.

### Missing ingredient costs

If an ingredient has no cost per pack entered, FoodCore shows £0.00 for that line. This makes the recipe's total cost appear lower than it actually is. Any ingredient showing £0.00 in your recipe is likely missing its purchasing data.

To fix this: click through to the ingredient, open the Purchasing tab, and enter the cost per pack and pack size. Then recompute the recipe.

### Missing ingredients entirely

If a recipe is missing an ingredient — perhaps a small addition like a pinch of salt or a squeeze of lemon that wasn't worth adding at the time — the total cost will be understated. For home cooking this doesn't matter, but for accurate margin tracking it's worth adding everything, even inexpensive items.

## The Recompute button

Changing an ingredient's cost does not automatically refresh the recipes that use it. You need to trigger a recalculation manually using the **Recompute** button.

To recompute a single recipe:

1. Open the recipe.
2. Click **Recompute** near the cost summary.
3. The batch cost, cost per serving, and margin all update instantly.

To recompute multiple recipes at once:

1. Go to **Recipes**.
2. **Tick** the recipes you want to refresh.
3. Click **Recompute** in the action bar.

Get into the habit of recomputing after any ingredient price update. It only takes a moment and keeps your margin data accurate.

## Checking whether your costs look right

If a recipe cost looks unexpectedly high or low, the best approach is to work through it ingredient by ingredient:

1. Open the recipe and look at each line cost in the ingredients list.
2. Find the line that looks wrong — either too high, too low, or showing £0.00.
3. Click through to that ingredient and check the Purchasing tab.
4. Correct the cost per pack and/or pack size.
5. Save the ingredient and recompute the recipe.

A recipe costed incorrectly at the pack size level will always have one or two lines that look obviously out of proportion to the rest. That's usually where to start.

## What's next

* [Update an ingredient price](https://docs.foodcore.io/ingredients/update-price.md)
* [Review profit margins and selling prices](https://github.com/CharliesGFTreats/foodcore-docs/blob/master/recipes/profit-margin.md)
* [Create a recipe](https://docs.foodcore.io/recipes/create-recipe.md)
* [Fix missing data on a recipe](https://docs.foodcore.io/recipes/missing-data.md)
