Experience level

Introduction
Your experience level in NetHack is a measure of the overall power of your hero and progress of your adventure. The more experienced you are, the better you become at both fighting and magic.

Experience points (XP) are the units that you accumulate to increase your level. Depending on your game options, you may see a display of your XP or only see your current experience level.

You start at level 1 and can reach a maximum level of 30. Monsters also have an experience level defined, but it can only be seen with a wand of probing or stethoscope.

Effects
Gaining an experience level will have a number of effects on gameplay:
 * Increases your HP
 * Increases your energy
 * Increases your skill points by 1
 * Increases your chance to hit in combat
 * Increases chance of successfully learning a spell from spellbook
 * Decreases spell failure rate
 * Increases difficulty of monsters generated (before acquiring the Amulet of Yendor)
 * Changes your title, based on your role (and possibly gender)

Experience level has no direct effect on your attributes.

Gaining levels
There are several ways to gain an experience level, ranging from obvious to somewhat obscure:
 * Experience points (mostly from killing monsters)
 * Quaffing a blessed or uncursed potion of gain level
 * Eating a wraith corpse
 * Chance from incubus or succubus encounter
 * Chance when polymorphing into your own race

If you are already level 30, experience points have no effect. The rest of the above methods will cause your HP to increase, except polymorph.

Losing levels
It's also possible to lose your hard-earned experience levels:
 * Level drain attacks (vampire bite, wraith touch)
 * Chance from incubus or succubus encounter
 * Chance when polymorphing into your own race

These are preventable with level-drain resistance, except polymorph.