Experience/Core series/Experience gain in battle/Gain formula

In the main Pokémon games, only two basic formulas have ever been used: a flat formula, where the winner's level is not taken into account, and a scaled formula, where the difference between both opponents' levels affects the amount of experience the winner receives. Generation V and games use the scaled formula. All other generations use the flat formula, although each generation generally makes its own additions or tweaks to the previous mechanics.

The full flat and scaled formulas can be seen below on the right. Depending on the order of multiplication and where rounding down is done, these formulas may produce slightly different results than are seen in-game.

Note that if a Pokémon both participated in battle and was holding an Exp. Share—or, in Generation I, the Exp. All is in the Bag—they actually receive experience both from participating in battle and from Exp. Share/Exp. All. Therefore, to arrive at their total experience gained, the formula must be evaluated both for a Pokémon that battled and for one that was holding Exp. Share, and those results must be summed. This does not apply in Generation VI or later, as Exp. Share works differently in those games.

In Black 2 and White 2 only, if a Pokémon would gain more than 100,000 experience at once, it instead gains exactly 100,000 experience.

The variables in these formulas evaluate as follows (presented in alphabetical order)...
 * a is equal to...
 * Prior to Generation VII:
 * 1 if the fainted Pokémon is wild
 * 1.5 if the fainted Pokémon is owned by a Trainer
 * In Generation VII: 1
 * b is the base experience yield of the fainted Pokémon's species; values for the current Generation are listed here
 * e is equal to...
 * 1.5 if the winning Pokémon is holding a Lucky Egg
 * 1 otherwise
 * f is equal to...
 * 1.2 if the Pokémon has an Affection of two hearts or more
 * 1 otherwise
 * L is the level of the fainted Pokémon
 * Lp is the level of the victorious Pokémon
 * p is equal to...
 * 1 if no Exp. Point Power (Pass PowerGen V or O-PowerGen VI) is active
 * If Exp. Point Power [x] is active...
 * 0.5 for ↓↓↓, 0.66 for ↓↓, 0.8 for ↓, 1.2 for ↑, 1.5 for ↑↑, or 2 for ↑↑↑, S, or MAX
 * s is equal to...
 * In Generation I...
 * If Exp. All is not in the player's Bag...
 * The number of Pokémon that participated in the battle and have not fainted
 * If Exp. All is in the player's Bag...
 * Twice the number of Pokémon that participated and have not fainted, when calculating the experience of a Pokémon that participated in battle
 * Twice the number of Pokémon that participated and have not fainted times the number of Pokémon in the player's party, when calculating the experience given by Exp. All
 * In Generations II-V...
 * If no Pokémon in the party is holding an Exp. Share...
 * The number of Pokémon that participated in the battle and have not fainted
 * If at least one Pokémon in the party is holding an Exp. Share...
 * Twice the number of Pokémon that participated and have not fainted, when calculating the experience of a Pokémon that participated in battle
 * Twice the number of Pokémon holding an Exp. Share, when calculating the experience of a Pokémon holding Exp. Share
 * In Generation VI and later...
 * 1 when calculating the experience of a Pokémon that participated in battle
 * 2 when calculating the experience of a Pokémon that did not participate in battle and if Exp. Share is turned on
 * t is equal to...
 * 1 if the winning Pokémon's current owner is its Original Trainer
 * 1.5 if the Pokémon was gained in a domestic trade
 * Generation IV+ only: 1.7 if the Pokémon was gained in an international trade
 * v is equal to...
 * Generation VI+ only: 1.2 if the winning Pokémon is at or past the level where it would be able to evolve, but it has not
 * 1 otherwise