Defense

Defense is a statistic that determines the decrease in damage taken per hit. The player's defense can be increased by wearing armor and accessories, and temporarily boosted by various buffs. Damage taken by players is reduced by half / /  of their defense, rounded down. Enemies also have a defense statistic.

No hit can be reduced below 1 damage, regardless of defense (with the exception of a player whose multiplayer ally is wearing a Paladin's Shield).

Some forms of damage are impossible to reduce through defense, e.g. damage from health-draining debuffs like Cursed Inferno or from drowning in water. Damage taken from lava, however, can be reduced through defense.

Players
Defense gives a flat reduction in damage, i.e. damage is reduced by a fixed amount per hit (as opposed to a multiplicative damage reduction, which would reduce damage by a percentage). It is calculated after the general damage randomization.

The formula is: $$\text{net dmg} = \left\lfloor \text{attack dmg} - \text{def} * x \right\rfloor$$, where $$x$$ is $$0.5$$ in Classic Mode, $$0.75$$ in, and $$1$$ in.

Enemies
Enemies have a defense statistic just like players do, but they do not gain more protection from defense in Expert Mode or Master Mode. They will always reduce incoming damage by 50% of their defense: $$\text{net dmg} = \left\lfloor \text{attack dmg} - \text{def} * 0.5 \right\rfloor$$.

Armor and accessories
A player's defense score can be increased by equipping armor and accessories. Armor usually consists of three items, granting an additional bonus if all pieces match, the set bonus, which may increase the defense score further. Some accessories grant direct defense boosts (see the following table), but all accessories can also be reforged to a maximum of +4 defense per accessory.

See armor for detailed defense information about every piece of armor.

Buffs and debuffs
Buffs and debuffs can temporarily alter a player's or an enemy's defense. Currently, there is no buff increasing enemies' defense. A player's defense cannot be reduced to fall below 0.

Armor penetration
Armor penetration is hidden player statistic that determines the amount of the enemy's defense portion that is ignored when dealing damage to it. For instance, a Pixie normally has defense. If the player has the Shark Tooth/Stinger Necklace equipped, then the Pixie will be taken to have defense instead.

The following items grant armor penetration:

Maximum defense
The highest possible defense can be attained using the setups described in the following sections.

On, the maximum possible defense is 186 / / , while on , it is 181 /  /. The setups are the same:

The maximum possible defense is 165 / :

The maximum possible defense is 128:

Trivia

 * Although not possible in-game, if a piece of armor were to gain a modifier, it would apply the effects just like an accessory would. For example, a set of Warding modified armor would add 12 defense total; each piece adding 4 defense to the total.
 * Damage dealt by enemies is doubled in and tripled in  compared to normal mode. This means that despite the higher factors of defense in those modes, defense is still generally less effective than in normal mode.
 * If the player somehow has negative defense, they will take more damage according to the damage taken added with half / /  amount the defense.