Some creatures and objects are exceedingly difficult or unusually easy to hurt with certain types of damage.
If a creature or an object has resistance to a damage type, damage of that type is halved against it.
If a creature or an object has vulnerability to a damage type, damage of that type is doubled against it.
If a creature or an object has Immunity to a damage type, the creature simply takes no damage from that type of damage, unless some other rule supersedes it.
Resistance and then vulnerability are applied after all other modifiers to damage. For example, a creature has resistance to bludgeoning damage and is hit by an attack that deals 25 bludgeoning damage. The creature is also within a magical aura that reduces all damage by 5. The 25 damage is first reduced by 5 and then halved, so the creature takes 10 damage.
Multiple instances of resistance or vulnerability that affect the same damage type count as only one instance. For example, if a creature has resistance to fire damage as well as resistance to all nonmagical damage, the damage of a nonmagical fire is reduced by half against the creature, not reduced by three-quarters
Damage Immunity is always applied last. If a creature is immune to an instance of damage, it takes 0 damage. If an effect such the Grave Domain's Path to the Grave channel divinity makes a creature vulnerable to a damage type, without also removing the creature's immunity it still takes no damage.