From Bulbapedia, the community-driven Pokémon encyclopedia.
The box trick is a method in the core series Pokémon games that causes a Pokémon's stats to be recalculated based on its current effort values. This trick is applicable in Generations I through IV; from Generation V onward, the trick is obsolete, due to changes to a Pokémon's EVs automatically being applied to its stats.
A Pokémon's stats are derived values, based on the Pokémon's level, EVs (effort values), IVs (individual values), base stats, and (from Generation III onward) nature. If a Pokémon levels up or evolves, its level or base stats change, and all of its stats are recalculated; however, prior to Generation V, a Pokémon's stats are not always recalculated when its EVs are changed. From Generation I to IV, even if a Pokémon gains EVs in battle, its stats remain unchanged unless it leveled up or evolved; in Generation I and II, gaining EVs by consuming vitamins does not cause a Pokémon's stats to be recalculated either.
If a Pokémon is placed in the PC, its stats will be recalculated, without the need to level up or evolve. Doing this intentionally is known as the box trick. This occurs because the derived stats are not stored for Pokémon in the PC, only the values from which they are derived.
From Generation III onward, a Pokémon's stats are also recalculated if its EVs are changed by a vitamin or EV-reducing Berry.