BrewForge Docs

How style matching works

How BrewForge checks a recipe's OG, FG, ABV, IBU and color against beer style ranges and ranks the styles that fit a recipe best.

BrewForge compares five recipe values with a style's ranges: OG, FG, ABV, IBU and color. For each value it decides whether the recipe is in range, close or out of range, and uses that to rank styles by how well they fit. The same rules apply to library styles and your custom styles.

All comparisons use the stored units: SG for gravity, % ABV, IBU and SRM for color. Your display units (°P, EBC) don't change the result.

In range, close, out of range

Status of one value

tolerance = (max − min) × 0.1

  • in range: min ≤ value ≤ max
  • close: outside the range, but min − tolerance ≤ value ≤ max + tolerance
  • out of range: further away than the tolerance
  • unknown: the style has no minimum or no maximum for this value

Example: American IPA allows 40–70 IBU. The tolerance is (70 − 40) × 0.1 = 3 IBU. A recipe with 72 IBU is close (up to 73 counts as close), one with 75 IBU is out of range.

So "close" means within 10 % of the range width outside the range. A narrow range has a small tolerance: for an FG range of 1.008–1.014 it's only 0.0006.

Distance outside the range

To tell apart two styles that both miss a value, BrewForge measures how far outside the range the value lies, in range widths.

Normalized distance

distance = (min − value) / (max − min) when the value is below the range

distance = (value − max) / (max − min) when it's above

The distance is 0 for a value in range or unknown. If a range has the same minimum and maximum, BrewForge divides by 1 % of that value instead (or by 1 if it's 0).

Example: 72 IBU against 40–70 IBU gives (72 − 70) / 30 = 0.067. 64 IBU against English IPA's 40–60 IBU gives (64 − 60) / 20 = 0.2.

A style's total distance is the sum over all values that are close or out of range.

Ranking styles

Order of styles, best first
  1. more values in range,
  2. then more values close,
  3. then the smaller total distance,
  4. then the style name (alphabetical), so the order is always the same.

A value the style has no range for is unknown. It doesn't count as a fit, but it doesn't add distance either, so a style with a missing range ranks above one that clearly misses that value. A style where no value is in range or close isn't a fit at all.

Example

A recipe with OG 1.066, FG 1.012, 7.0 % ABV, 64 IBU and 6.5 SRM, compared with the BJCP library:

RankStyleIn rangeCloseOutDistanceWhy
1American IPA5000All five values fit.
2Belgian IPA5000All five fit too; sorted by name.
3Rye IPA5000All five fit too; sorted by name.
4Hazy IPA4010.11464 IBU is above 25–60: (64 − 60) / 35.
5Double IPA4010.27.0 % is below 7.5–10 %: (7.5 − 7.0) / 2.5.
6English IPA4010.264 IBU is above 40–60: (64 − 60) / 20. Same distance as Double IPA, so the name decides.

Source: lib/brewing/style-match.ts and getStyleConformity in lib/brewing/recipe-checks.ts.

On this page