recipe-ratio¶
Baker's percentages, dough hydration, and recipe scaling by flour weight. Pure math, no dependencies.
recipe-ratio is a pure-Rust, zero-dependency crate that turns a recipe's
ingredient weights into the ratios bakers actually reason in: the percentage of
each ingredient relative to flour (where flour is always 100%), the dough's
hydration, and the scaled weight of any ingredient when you change how much
flour you are using. It is the math layer behind the
IngredientCalculator recipe tools,
including the cups-to-grams converter.
Why baker's percentages¶
A baker's percentage expresses every ingredient as a share of the flour weight, with flour fixed at 100%. It is the standard way professional bakers write a formula, because it makes a recipe independent of the batch size: the ratios stay identical whether you mix a 500 g or a 5 kg dough, so the bread behaves the same.
| Term | Meaning | Formula |
|---|---|---|
| Baker's % | Ingredient weight as a share of flour weight. | ingredient ÷ flour × 100 |
| Hydration | The baker's % of water — how wet the dough is. | water ÷ flour × 100 |
| Scaling | Re-weight an ingredient for a new flour total. | ingredient × (new_flour ÷ old_flour) |
A lean white dough might be 60% hydration (300 g water to 500 g flour); a ciabatta can run 75–80%; a bagel dough is stiffer, around 50–55%. Salt is usually held at ~2% of flour weight.
Install¶
Quick start¶
use recipe_ratio::{baker_percent, hydration, scale, dough_weight};
// Baker's % of 300 g water to 500 g flour
assert!((baker_percent(300.0, 500.0) - 60.0).abs() < 1e-9);
// Hydration is just the baker's % of water
assert!((hydration(300.0, 500.0) - 60.0).abs() < 1e-9);
// Flour is always 100%
assert!((baker_percent(500.0, 500.0) - 100.0).abs() < 1e-9);
// 2% salt
assert!((baker_percent(10.0, 500.0) - 2.0).abs() < 1e-9);
// Scale water from a 500 g flour batch up to a 1 kg flour batch
assert!((scale(300.0, 500.0, 1000.0) - 600.0).abs() < 1e-9);
// Total dough weight sums every ingredient
assert!((dough_weight(&[500.0, 300.0, 10.0]) - 810.0).abs() < 1e-9);
Where this fits¶
The crate powers the recipe-conversion tools at IngredientCalculator, which turn these ratios into practical cups-to-grams and scaling answers for home cooks. The docs channel you are reading is a dofollow reference pointing back at those tools.