# What is the mathematical formula for proficiency bonus vs level/CR?

I'm programming a database for our homebrew setting and I would really like to be able to mathematically calculate proficiency bonus from a monster's CR, but try as I might, I can't find a formula that fits.

One of the answers to this question suggested that it was 1 + (level/4) rounded up, but that's wrong. For example, that formula would give a proficiency bonus of 2 for a level/CR 5 creature, when it's supposed to be 3.

• 1 + (level/4) rounded up gives 3 for a level 5 creature, are you sure it is wrong? – kviiri Dec 11 '19 at 19:53
• more correctly would be probably CEIL (1+(level/4)) ,, that takes care of "rounding up" as in his case – eagle275 Dec 12 '19 at 7:54

## Yes, it follows 1 + level/4 rounded up

While not actually given anywhere, the class (and multiclassing) tables and the monster proficiency tables (Monster Manual p. 8 and Dungeon Master's Guide p. 274) follow this pattern. CR 0 creates an exception to this which doesn't usually matter and which isn't neatly handled, so a full mathematical formula is:

$$\text{Proficiency Bonus} = \begin{cases} 2, & \text{if CR = 0} \\ 1+\left\lceil\frac{\text{CR}}{4}\right\rceil, & \text{if CR > 0} \end{cases}$$

As for your example calculation; for a level (or CR) 5 creature, the equation would give $$1 + \frac{5}{4} \text{ rounded up} = 3$$

Note that is uses round up which means it always rounds up to the next, greater integer which is different to normal rounding.

• The symbol you are using is actually the one for ceiling, "rounding as a concept" isn't well defined (en.wikipedia.org/wiki/…). Ceiling, however is well defined (it's the smallest integer, m, that is greater than or equal to the number you are applying the function to, x). – illustro Dec 12 '19 at 14:14
• @illustro how does ceiling and round up differ here? If someone had asked me to define "rounding up", I probably would have come up with something very close to what you describe as "ceiling" – Alexandre d'Entraigues Dec 12 '19 at 15:26
• @Alexandred'Entraigues The table in the link from my comment shows the ambiguity better than I can in this comment, but broadly you need to define what you are "rounding" from/to when you talk about doing any sort of rounding. In particular when you try to apply the same rules for negative numbers what counts as "up"? EG +2.2 rounds "up" to 3 in general, but does -2.2 round "up" to -2 or -3? When "rounding up", does "up" mean "away from zero", or "towards +infinity"? – illustro Dec 12 '19 at 15:36
• @illustro Thanks, I understand – did not have in mind all these type of rounding. From the table in the article, "rounding up" (which is the term used by @Someone_Evil) seems to be usually defined as "rounding towards +∞" which I understand is the exact same thing as ceiling. In any case, since we are talking about levels (natural numbers), I don't think any confusion is possible in this case. – Alexandre d'Entraigues Dec 13 '19 at 14:17

# As mentioned elsewhere the DMG tablulates this in the "Making a Monster" section, but there is a precise formula you can use

The precise mathematical formula for this is:

$$2 + sgn(\text{CR}-1)*\left\lfloor\frac{|\text{CR}-1|}{4}\right\rfloor$$

where:

$$sgn(x) = \begin{cases} -1, & \text{if x\lt 0} \\ 0, & \text{if x= 0} \\ 1, & \text{if x\gt 0} \\ \end{cases}$$ is the sign (or signum) function.

$$|x| = x*sgn(x)$$ is the absolute value of x.

$$\left\lfloor x \right\rfloor = max(m \in \mathbb{Z}| m \le x)$$ is the floor of x. The precise definition of this formula, in words, is "the maximum integer, m, that is less than or equal to x".

This formula works for all CRs in the game (it also works for calculating a character's proficiency bonus if you substitute total character level for CR in the formula).

Taking your example of a CR 2 creature and working through it we get: $$2 + sgn(3-1)*\left\lfloor\frac{|3-1|}{4}\right\rfloor$$ $$= 2 + sgn(2)*\left\lfloor\frac{|2|}{4}\right\rfloor$$ $$= 2 + (+1)*\left\lfloor \frac{2}{4} \right\rfloor$$ $$= 2 + (+1)*0$$ $$= 2$$

If instead we look at a $$\\text{CR} = \frac{1}{8}\$$ creature we get: $$2 + sgn(\frac{1}{8}-1)*\left\lfloor\frac{|\frac{1}{8}-1|}{4}\right\rfloor$$ $$= 2 + sgn(-\frac{7}{8})*\left\lfloor\frac{|\frac{-7}{8}|}{4}\right\rfloor$$ $$= 2 + sgn(-\frac{7}{8})*\left\lfloor\frac{\frac{7}{8}}{4}\right\rfloor$$ $$= 2 + (-1)*\left\lfloor\frac{7}{8} * \frac{1}{4}\right\rfloor$$ $$= 2 + (-1)*\left\lfloor \frac{7}{32} \right\rfloor$$ $$= 2 + (-1)*0$$ $$= 2$$

• The symbols used in my answer are the symbols for floor (there is no defined symbol for rounding in any direction because rounding is not well defined, from a mathematical perspective without an additional axiom). – illustro Dec 12 '19 at 15:47
• @Medix2 the sign function is there, in part because I need to explain it to define |x| precisely, and in part because I wanted to be consistent with my usage of signs from a dimensional perspective (I'm a physicist by training and an actuary by profession, and signs matter) – illustro Dec 12 '19 at 15:56
• Comments removed, thanks for the explanations, apologies if that all came across poorly – Medix2 Dec 12 '19 at 16:10
• @Medix2 no need to apologise :) The discussion was interesting to me at least :) – illustro Dec 12 '19 at 16:12

floor( (level+3)/4 ) is, to me, the easiest way to think about it. Or 2 at level 1, plus 1 for every 4 levels above. Floor means "round down".

This also works for creatures at or above CR 1; CR 1/2, 1/4, 1/8 and 0 creatures keep the same proficiency bonus as CR 1 creatures.

This is equivalent to the 1 + round up(level/4) formula -- rounding 5/4 up is 2, not 1 -- for CR > 0.