As a result of working on upgrades for this Pokémon Effort Value Calculator, math has been a pretty big part of my life for the past few months, as I’ve been rearranging the games’ formulas for stat and damage calculation to make my own that fit my needs.

One such formula was the ** EVs needed** one, which gives you

**the amount of EVs you need to invest to raise a stat by**. Everyone knows that at Level 100, you get 1 stat point for every 4 EV points you invest; but what happens when you’re

*n*points*not*at Level 100, or when you factor in stat modifiers like Nature, or item and ability boosts?

Don’t know what effort values are? Start with this article from Bulbapedia. Don’t play the mainline Pokémon games? Then you should start with these.

## The stat formula

A good starting point for this would be the stat formulas below — they determine a Pokémon’s stat at any given time. The formula for determining the HP stat is slightly different from the other stats.

$\mathrm{Stat}=\lfloor (\lfloor \frac{\mathrm{(2\; \times \; Base\; +\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor )\; \times \; Level}}{\mathrm{100}}\rfloor +5)\times \mathrm{Nature}\rfloor $ $\mathrm{HP}=\lfloor \frac{\mathrm{(2\; \times \; Base\; +\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor )\; \times \; Level}}{\mathrm{100}}\rfloor +\mathrm{Level}+\mathrm{10}$As an aside, it’s interesting to note that the HP stat formula can be simplified into this:

$\mathrm{HP}=\lfloor \frac{\mathrm{(2\; \times \; Base\; +\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor \mathrm{+\; 100})\; \times \; Level}}{\mathrm{100}}\rfloor \overline{)+\mathrm{Level}}+\mathrm{10}$This reorganisation makes the formula harder to read, but can actually allow your code to be more concise, because this makes it possible to combine both stat formulas:

$\mathrm{Stat}=\lfloor (\lfloor \frac{\mathrm{(2\; \times \; Base\; +\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor \mathrm{+\; A})\; \times \; Level}}{\mathrm{100}}\rfloor \mathrm{+\; B})\times \mathrm{Nature}\rfloor $ $\mathit{where\; A\; =\; 100,\; B\; =\; 10\; for\; HP\; stat;}$ $\mathit{and\; A\; =\; 0,\; B\; =\; 5\; for\; all\; other\; stats}$Article continues after the advertisement:

## Pulling out the EV portion

The math that we were doing above actually have nothing to do with calculating needed EVs to raise a stat — it was just some interesting trivia. Let’s get to what you came here for.

First, let’s reorganise the fractional part of the stat formulas, so it becomes clear how the Base, IVs and EVs affect the stat:

$\frac{\mathrm{(2\; \times \; Base\; +\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor )\; \times \; Level}}{\mathrm{100}}=\mathrm{(2\; \times \; Base\; +\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor )\; \times}\frac{\mathrm{Level}}{\mathrm{100}}$ $=(2\times \mathrm{Base}\times \frac{\mathrm{Level}}{\mathrm{100}})+(\mathrm{IV}\times \frac{\mathrm{Level}}{\mathrm{100}})+(\lfloor \frac{\mathrm{EV}}{4}\rfloor \times \frac{\mathrm{Level}}{\mathrm{100}})$Since we are most concerned about the EVs, let’s examine that portion first and add in the rest of the formula as we go along:

$\mathrm{Stat}=\lfloor \frac{\mathrm{EV}}{4}\rfloor \times \frac{\mathrm{Level}}{\mathrm{100}}$We have to reorganise the formula so that `EV`

alone ends up on one side.

We need to break the floor operation to isolate `EV`

on the right-hand side, which is tricky. Let’s ignore the floor operation for a moment:

The floor operation basically makes it so that any remainder of the EV value after being divided by 4 is discarded. This means that, to move the floor operation to the other side, we have to round the result up to the nearest multiple of 4:

$\lceil (\mathrm{Stat}\times \frac{\mathrm{100}}{\mathrm{Level}}\times 4)\xf74\rceil \times 4=\mathrm{EV}$Cleaning up our formula and making it more presentable:

$\mathrm{EVs\; needed}=\lceil \left(\frac{\mathrm{Stat\; \times \; 400}}{\mathrm{Level}}\right)\xf74\rceil \times 4$## Factoring in IV contributions

If you’re a competitive Pokémon player, you might be aware of this little quirk when it comes to EV-ing Level 50 Pokémon (all Pokémon have their Levels set to 50 in a competitive match). **If a stat has 31 IVs, it takes 4 EVs to raise the stat by 1 point, then 8 EVs for every subusequent point.**

IV stands for **Individual Values**. You can find out more about what they are in this Bulbapedia article.

**This quirk exists because IVs affect how many EVs you need to raise a stat,** as we see when we reorganise the stat formula above.

At Level 50, with 31 IVs, you will get the following stat contribution:

$\mathrm{IV\; stat\; contribution}=\mathrm{31}\times \frac{\mathrm{50}}{\mathrm{100}}=\mathrm{15.5}$If you refer to the stat formula again, **you’ll see that the stat total is not rounded down until the base stat, IVs and EVs are totalled.** That means that the decimal portion of the IV reduces the amount of EVs you’ll normally need to raise the stat.

Let’s rewrite this so that we can see their stat contributions more clearly:

$\mathrm{IV\; and\; EV\; stat\; contribution}=\mathrm{(\; IV\; +\lfloor \frac{\mathrm{EV}}{4}\rfloor )}\times \frac{\mathrm{Level}}{\mathrm{100}}$At Level 50, with 31 IVs and (for example) 12 EVs invested, we will get the following:

$\mathrm{(\; 31\; +\lfloor \frac{\mathrm{12}}{4}\rfloor )}\times \frac{\mathrm{50}}{\mathrm{100}}=\mathrm{15.5}+\mathrm{1.5}$Essentially, 12 EVs give us 1.5 points of stats, which total up with the stats from 31 IVs (15.5) to give us 17 points of stats. **If we don’t fill up the .5 stat from the 31 IVs with EVs, it will be rounded down and wasted.** This is why the calculator often recommends a spread of 244 HP / 4 Def / 4 SpD instead of 252 HP — you are essentially getting your first stat point at half the EV cost.

**How do we factor this into our EVs needed formula?** Remember that we only care about the fractional part of the IV contribution (i.e. the part

*after*the decimal point).

**Note:** { and } in the formula mean we only take the fractional part. For e.g. { 4.5 } = 0.5.

Article continues after the advertisement:

## Factoring in base stat contribution

**Your Pokémon species’ base stat actually affects your EV cost too, similar to how IVs do.** It’s just that at Level 50, the formula always works out in such a way that base stats always end up without any fractional part.

At Levels outside of 50 and 100, however, the base stat contribution *can* create a fractional part. For example, at Level 32 with a base stat of 70:

Which means we have to factor this into our formula too.

$\mathrm{EVs\; needed}=\lceil \left(\frac{\mathrm{(\; Stat\; \u2013\; \{\; 2\; \times \; Base\; \times \frac{\mathrm{Level}}{\mathrm{100}}+\; IV\; \times \frac{\mathrm{Level}}{\mathrm{100}}\}\; )\; \times \; 400}}{\mathrm{Level}}\right)\xf74\rceil \times 4$**Fun fact:** There have been official online Pokémon tournaments that were held with Pokémon set to Levels outside of 50 and 100; but it was a long time ago.

## Factoring in existing EV contribution

If you’ve already got existing EV investment in a stat, you’ve got to factor that in too. You should know the drill by now.

$\mathrm{EVs\; needed}=\lceil \left(\frac{\mathrm{(\; Stat\; \u2013\; \{\; 2\; \times \; Base\; \times \frac{\mathrm{Level}}{\mathrm{100}}+\; IV\; \times \frac{\mathrm{Level}}{\mathrm{100}}+\; \lfloor \frac{\mathrm{EV}}{4}\rfloor \; \times \frac{\mathrm{Level}}{\mathrm{100}}\}\; )\; \times \; 400}}{\mathrm{Level}}\right)\xf74\rceil \times 4$Since the formula is getting a little unwieldy, let’s also reorganise and simplify it:

$\mathrm{EVs\; needed}=\lceil \left(\frac{\mathrm{(\; Stat\; \u2013\; \{\; D\; \}\; )\; \times \; 400}}{\mathrm{Level}}\right)\xf74\rceil \times 4$ $\mathrm{Where\; D\; =\; \{\; 2\; \times \; Base\; \times \frac{\mathrm{Level}}{\mathrm{100}}+\; IV\; \times \frac{\mathrm{Level}}{\mathrm{100}}+\; \lfloor \frac{\mathrm{EV}}{4}\rfloor \; \times \frac{\mathrm{Level}}{\mathrm{100}}\}}$ $\mathrm{=\; \{\; (2\; \times \; Base\; +\; IV\; +\; \lfloor \frac{\mathrm{EV}}{4}\rfloor \; )\; \times \frac{\mathrm{Level}}{\mathrm{100}}\}}$## Factoring in nature and other modifiers

If a stat is affected by Nature or other modifiers, you are going to have work that into the formula too. It may sound complicated, but since stat modifiers *multiply* into the stat, we just have to *divide* them from the stat in the formula.

We also have to round the result of the division ** up**, since stats are normally rounded down after modifiers are applied.

## The final formula

Here is the final formula for calculating how many EVs you need to raise a stat by a specific number of points.

$\mathrm{EVs\; needed}=\lceil \left(\frac{\mathrm{(\; \lceil \; Stat\; \xf7\; Modifiers\; \rceil \; \u2013\; \{\; D\; \}\; )\; \times \; 400}}{\mathrm{Level}}\right)\xf74\rceil \times 4$ $\mathrm{Where\; Stat\; =\; Desired\; increase\; in\; stat;}$ $\mathrm{and\; Modifiers\; =\; Product\; of\; all\; stat\; modifiers;}$ $\mathrm{and\; D\; =\; \{\; (2\; \times \; Base\; +\; IV\; +\; \lfloor \frac{\mathrm{EV}}{4}\rfloor \; )\; \times \frac{\mathrm{Level}}{\mathrm{100}}\}}$Gotta say, I’m pretty proud of working this out on my own. Nonetheless, **please feel free to point out any errors or mistakes in the comments section!**

Thank you for this, incredible work! I’m making a Speed calculator spreadsheet, and was always just a few EVs off—your write-up helped me realize I have to round up instead of truncating :)