Defense

Defense is a player statistic that determines how much damage can be absorbed per hit. On non-Expert Mode worlds, damage the player takes is reduced by half of their defense value, rounded up. In Expert Mode, damage the player takes is reduced by three-quarters of their defense value, rounded up. Defense can be increased by equipping armor and accessories, or temporarily boosted by various buffs. No attack can be reduced below 1 damage (with the exception of a player with an ally wearing the Paladin's Shield).

Some forms of damage are impossible to reduce through defense. Damage from health-draining Debuffs like Cursed Inferno, drowning in water, or colliding with a boulder are not reduced by defense.

Damage taken from lava can be reduced through defense.

Mechanics
Defense gives an arithmetic reduction in damage: i.e. damage is reduced by a fixed amount per hit (as opposed to a geometric damage reduction, which would reduce damage by a percentage).

Non-Expert Mode Formula
The formula is: Damage Reduction = Ceiling(Defense * 0.5) For example:
 * With 10 Defense, a 20 Damage attack is reduced by 5, resulting in 15 damage taken.
 * With 21 Defense, a 20 Damage attack is reduced by 11, resulting in 9 damage taken.

Expert Mode Formula
In expert mode, the formula is: Damage Reduction = Ceiling(Defense * 0.75) For example:
 * With 20 Defense, a 40 Damage attack is reduced by 15, resulting in 25 damage taken.
 * With 30 Defense, a 40 Damage attack is reduced by 23, resulting in 17 damage taken.

Enemies
Enemies have the same Defense mechanics as players. Monsters with high defense will take virtually no damage from low damage weapons (e.g. Fire Imps take 5 damage from the Minishark with Musket Balls). Accordingly, when fighting high defense monsters, high damage weapons are preferable.

Defense boosts
See Defense for full list. Here is a list of armors, accessories, and their respective defense bonuses, including any applicable set bonuses.