Experience is a measurement of hero's capability. Initially, every hired hero starts with a random number of experience in the range of 40 to 90 points. Experience is gained as heroes explore and battle. When they have enough experience points, they go up a level, which is commonly phrased as "level up" gaining a level. Gaining a level may have several effects. It always increases one of hero's primary skills by one. Hero classes have different probabilities of which primary skill is increased, but general rule is that might heroes tend to get more attack and defense while magic heroes get more power and knowledge. Typically when a hero gains a level, he is offered a choice of one of two secondary skills. Additionally, many of the hero specialties are affected by level up.
Typical ways for hero to gain experience is through combat or from treasure chests. From winning a combat the hero receives one experience point for each health of the enemy creatures he managed to vanquish in the battle (clones, war machines and bonus health from atifacts do not count). Resurrected creatures are only counted once, except demons raised by pit lords. If an enemy hero is defeated or an enemy town is captured during a siege, the hero receives extra 500 experience points. A hero will not receive this bonus if the enemy hero escapes or surrenders. If a hero escapes or surrenders, then he does not gain any experience, even if he managed to kill someone. A hero from whom the enemy escaped receives experience for the killed enemy creatures, but does not gain experience for the defeated hero. Additionally, Pandora's Boxes, events and quests can give experience.
Heroes with Learning gain extra experience.
Bug: after reaching level 75 a hero gets level 88 at once (13 more level-ups consecutively). From now on the level-up mechanics shows highly unstable work, including the possibility of falling into an infinte loop of level-ups.
In Horn of the Abyss the overflow of experience was fixed. Maximum possible hero level is 74.