XP calculated:
BASE Formula:
experience = B*T*N*[(your_pet_level + 9) * (opponent_pet_level - your_pet_level + 5)]
1) B
Experience Buff Bonus: There are various ways to gain pet experience buffs. All are additive together before multiplying. This bonus is denoted as B.
B = 1.00 when not using any buffs
B = 1.10 when using only a Safari Hat
B = 1.25 when using only a Lesser Pet Treat
B = 1.50 when using only a Pet Treat
B = 1.85 when using all 3 together.
B = 3.85 when using all 3 together during a Pet Experience bonus event
2) T
Tamer Specific Bonus: This bonus is based on the tamer. It doesn't appear to have any correlation to enemy pet rarety (epic vs rare pets have the same bonus for some sets of tamers for example). It may have some correlation to the Tamer's NPC level (not the pet level) as there are some trends, but there isn't enough data currently available to verify that. This bonus is denoted as T.
T = 0.1 when fighting most Menagerie battles (Squirt is a notable exception at T=5.0)
T = 1.0 when fighting wild pet battles (non-tamer battles)
T = 2.0 when fighting any Celestial Tournament tamer
T = 2.5 when fighting Zunta, Julia Stevens, Dagra the Fierce, or Old MacDonald
T = 3.0 when fighting any other Vanilla WoW tamer, Outlands Tamer, Northrend Tamer, or Cataclysm Tamer
T = 5.0 when fighting most WoD tamers, any Pandaria tamer, the Feasel brothers, and Little Tommy Newcomer.
T = 6.0 when fighting Ashlei
3) N
Multi-Pet Bonus: This bonus is based on the number of opponents faced and is denoted by the variable N.
N = 1.0 when fighting only one enemy pet (Little Tommy Newcomer, Celestials, Beasts of Fable, and low level wild battles)
N = 2.0 when fighting two enemy pets (Zunta and Julia Stevens are the only tamers with 2 pets)
N = 2.5 when fighting three enemy pets (Most tamers)
PS Make Pet Battle great again
PPS:
https://www.warcraftpets.com/community/forum/viewtopic.php?f=10&&&&t=8829