When spellcasting the Fail column appears in the menu which occurs when using the [Z] command.
To calculate spell failure, you first need to sum together the penalties marked with a number sign (#) below. An increasing total penalty is worse for spellcasting, and is limited to a maximum of 20.
 The "BASE" value from the table below, depending on the character's class.
 If an "emergency" spell (noted with a + above), the "EMERG" field.
 If wearing any shield, the amount in the "SHIELD" field.
 If wearing metallic body armor, the amount in the "SUIT" field.
 If also wearing a robe, only add half the amount (rounded down).
 If wearing a robe without metallic armour, subtract the amount in the "SUIT" field.
 If wearing a metallic helmet other than the helm of brilliance, add 4.(Metal helmets interfere with the mind.)
 Metallic gloves add 6 (casting channels through the hands).
 Metallic boots add 2 (all metal interferes to some degree).
 Subtract 4 if the spell is special to that class (see table).
CLASS BASE EMERG SHIELD SUIT STAT SPECIAL SPELL Arc 5# 0# 2# 10# Int Magic mapping Bar 14# 0# 0# 8# Int Haste self Cav 12# 0# 1# 8# Int Dig Hea 3# 3# 2# 10# Wis Cure sickness Kni 8# 2# 0# 9# Wis Turn undead Mon 8# 2# 2# 20# Wis Restore ability Pri 3# 2# 2# 10# Wis Remove curse Ran 9# 2# 1# 10# Int Invisibility Rog 8# 0# 1# 9# Int Detect treasure Sam 10# 0# 0# 8# Int Clairvoyance Tou 5# 1# 2# 10# Int Charm monster Val 10# 2# 0# 9# Wis Cone of cold Wiz 1# 0# 3# 10# Int Magic missile
Next, calculate a base chance of success, which is 5.5 times your
intelligence or wisdom STAT, depending on your class. This chance is
modified by the following factors:
 SKILL level (Unskilled = 0, Basic = 1, Skilled = 2, Expert = 3)
 spell level (LVL)
 experience level (XL)
according to this formula:
difficulty = (LVL * 4)  (SKILL * 6)  (XL/3)  5
If this is positive, your chance is reduced according to another formula:
chance = base chance  square root of ((900 * difficulty) + 2000)
If it is negative, it will be increased with diminishing returns: the absolute value is multiplied by (15/LVL), capped at 20, and added to the base chance.
The resulting chance is clipped to the range of 0% to 120% success. If you are wearing a shield larger than a small shield, the chance is then reduced to 1/4 its amount (except if it is the special spell for your class  then it is only halved).
Finally, the chance of success is adjusted by your total penalty using the following formula:
chance = (chance * (20penalty) / 15)  penalty
The result is clipped to the range of 0% to 100% success.
This page is based on a spoiler by Dylan O'Donnell. The original license is:
Redistribution, copying, and editing of these spoilers, with or without modification, are permitted provided that the following conditions are met:
