# Formula to calculate Pokemon Go CP and HP?

Assuming I know the Pokemon type, its attack, defense and stamina IVs (between 0 and 15), and the Pokemon level, how can I calculate its exact combat and health points?

It seems the formula has been cracked down by now, but I could not find it on the web. More specifically, here are my current conclusions:

• As far as I can tell, Pokeassistant that calculates IVs (from CP, HP and dust to power up) knows the correct formula, including all the rounding issues: Inputting any parameters obtained from the game always gave me possible results for IVs, and when making a typo in a number, it often told me there were no possible IVs.

• The website above actually gives explicit formulas:

HP = (Base Stam + Stam IV) * Lvl(CPScalar)

CP = (Base Atk + Atk IV) * (Base Def + Def IV)^0.5 * (Base Stam + Stam IV)^0.5 * Lvl(CPScalar)^2 / 10

Unfortunately, they don't explain what `Lvl(CPScalar)` is. I tried to deduce its definition by matching this formula with one found on other websites (`0.095*Level^0.5`), but that did not work.

• CPScalar is also know as TotalCpMultiplier. I don't know how reliable Reddit is, but take a look here and here – pinckerman Aug 7 '16 at 3:42

"CPScalar" is an incidental constant which varies by level range. Breaking this particular value out from its exponent and level coefficient (as per `level*(CPScalar)^2`) isn't actually productive, it's just a bit of unsimplified work showing through from how the value was reverse engineered.

In truth, that component of the formula can be consolidated in a piecemeal function of level. As per reddit user `__isitin__` (whom your linked article also cites), the definitions for this function appear to be:

• At levels 1-10: `f(lvl) = ( 0.01885225 * level ) - 0.01001625`
• At levels 11-20: `f(lvl) = ( 0.01783805 * ( level - 10 ) ) + 0.17850625`
• At levels 21-30: `f(lvl) = ( 0.01784981 * ( level - 20 ) ) + 0.35688675`
• At levels 31-40: `f(lvl) = ( 0.00891892 * ( level - 30 ) ) + 0.53538485`

Keep in mind that pokemon get two increments for every player level, so a level input of, say, 11.5, for example, is legitimate.

This function should fit into the CP formula like so:

`Attack * sqrt{Defense} * sqrt{Stamina} * f(lvl) / 10`

I'm certain there are some imprecise breakpoints in there where I've discounted rounding steps or added my own. I wouldn't be surprised if the underlying function is actually founded on different (but similar) ratios, either. But unless I've made a mistake, these numbers should be accurate to the greatest practical degree.

• Isn't it `f(lvl) = (0.01783805 * (level-10)) + 0.17850625` and so on, so that the function is continuous at levels 10, 20 and 30? – Tony Aug 10 '16 at 1:11
• @Tony Yes, I do believe you're right. I'll correct that mistake when I'm sitting at a keyboard. – Eikre Aug 10 '16 at 1:14

CP multipliers are values that appear directly in the game code, though only whole number levels are listed in the code. To calculate the half level values, you can use the formula from this GamePress article. I doubt that any IV checkers actually calculate the values, instead, they likely look them up from a table.

Knowing that Dragonite's max CP is 3608, I created this formula:

``````name = Dragonite
BaseAtk = 134
BaseDef = 95
BaseSta = 91

CPForm = ((134 + 15) * ((95 + 15)**0.5) * ((91 + 15)**0.5) * (0.00891892(40-30) + 0.53538485)) / 10
= 1004.8922
``````

1004.8922 is no where near 3608

• Where did you get the base values? BrunnerLivio's github repo, as far as I know, is the most recent decoded data file which contains the base stats. – Jerry Mar 29 '17 at 4:24