Magikarp's size is determined by a combination of its IVs and the lower half of its Personality Value, a hidden, 32-bit integer assigned to every Pokémon that determines a *lot* of the Pokémon's traits (like ability, shininess, gender, etc.).

`00000000 00000000 *00000000* >00000000<`

The lowest two bytes of **p** are used in the calculation: **p1** (surrounded by `> <`

above) is mathematically equivalent to `p % 256`

, while **p2** (surrounded by `* *`

above) is equivalent to `(p / 256) % 256`

(rounded down). The IV values are also not used in whole; only the four least significant bits of each are used: mathematically, `<stat>' = IV % 16`

.

The first step in the calculation is as follows:

`s = ( ( (Atk' ⊕ Def') * HP' ) ⊕ p1 ) * 256 + ( ( (SpAtk' ⊕ SpDef') * Spd' ) ⊕ p2 )`

*"For the next step, h is the species' height in tenths of a meter. And the values of x, y, and z depend on"* certain vales the Bulbapedia article has laid out in a chart I can't include here.

The final part of the calculation gives the Pokémon's size in millimeters. The final value of Size is also rounded down.

`Size = Rounddown( (s-z) / y + x ) * h / 10`

If the game converts this number to inches, the final result will be rounded down to the nearest tenth of an inch.

For reference (taken from the shininess section in the Bulbapedia article):

> A bitwise exclusive or operation (or "⊕") on inputs a and b, written as `a ⊕ b = c`

, outputs c such that, if `a(i) (bit I of a)`

and `b(i)`

are different, then `c(i)`

is 1; otherwise it is 0. For example, `1100 ⊕ 1010 = 0110`

.

Even though the Pokémon's IVs help determine the size of a Pokémon, the equation makes it so that the Pokémon's size cannot be manipulated by IV breeding, since the Personality Value (in this generation) cannot be manipulated by breeding in any significant way, and is therefore always random. The equation uses the PV to alter the output in an unpredictable manner. For all intents and purposes, there is no method to get specific Magikarp sizes outside of RNG abuse.