In battle, the ability holder inverts all the stats changes it receives. If an effect would lower a stat, this Pokémon would increase that stat. If an effect would increase a stat, the stat is decreased. Self-inflicted changes are inverted as well. Status effects like burn are not affected by Contrary. Stat changes carried by Baton Pass remain the same.
Stat boosts from Z-Moves are not inverted by Contrary, with the exception of Extreme Evoboost, which inverts those stat changes. Mist and stat protecting effects take into account the inversion before blocking a stat change. Pokémon with Mold Breaker ignore the inversion when using a move on an opponent with Contrary.