Attack Bonus
There are four parts that get added together:
- Your Ability Modifier
- For most Melee weapons, this is Strength; for most Ranged weapons, this is Dexterity; for attack-roll spells, this is your Spellcasting Ability (typically Intelligence, Wisdom, or Charisma)
- The notable exception to this rule are Finesse weapons, which explicitly allow you to choose between Dexterity or Strength at your leisure. In the core game, this property only appears on Melee Weapons.
- Also, thrown weapons typically count as melee weapons, even if they may be used at range; check the weapon's statblock for possible exceptions to this rule.
- Another notable exception is special class features or spells that allow alternative ability modifiers. For example, a Druid casting Shillelagh gains the ability to use Wisdom instead of Strength or Dexterity, but only on certain weapons.
- Similarly, a Hexblade Warlock uses Charisma instead of Strength or Dexterity, provided the weapon they're using matches the requirements of their Patron.
- Your Proficiency Bonus
- This applies if you have proficiency in the weapon. Simple as that. For Martial classes like Fighters, Barbarians, or Paladins, this pretty much means every single weapon in the game, meaning they always get their Proficiency Bonus. For other classes, you need to check the proficiencies their class grants.
- There are also, theoretically, exist "Exotic Weapons" which no class gains proficiency in by default, and for which a character would not receive their proficiency bonus unless they gain proficiency in it through some means; the core game does not contain any such weapons though.
- For spells, you nearly always have proficiency in spellcasting, and therefore gain this bonus. There are a few edge cases where this might not be true, but they are rare and only worth mentioning as a curiosity.
- Special modifiers on the weapon itself
- Common to Magic Weapons, usually takes the form of a +1/+2/+3 static bonus to Attacks (and damage)
- Buffs/Other Effects
- The spell Bless, for example, adds a d4 roll to any attack roll the target makes.
So for example, a level 5 Fighter wielding a +1 Rapier (has the Finesse property), with a Strength Score of 16 and a Dexterity of 18, would have the following bonus for their Attack Roll:
- Ability Modifier: +3 if they use Strength, or +4 if they use Dexterity
- Proficiency: Fighters gain proficiency in Rapiers, so +3 for a Level 5 character
- Magic Weapon: Weapon is a +1 Rapier, so +1.
- Total: +8 with Dexterity; +7 with Strength
Damage Bonus
- Your Ability Modifier
- Same as above: Strength for melee, Dexterity for Ranged, Either for weapons that have the Finesse property, Intelligence/Wisdom/Charisma for features that allow this modifier to be replaced by a different stat.
- Spells do NOT gain this damage bonus unless the character has a specific feature that allows their spells to benefit, like the Evocation Wizard or the Agonizing Blast Warlock feature; or if the spell specifically says so, like with Green Flame Blade specifically saying that you are allowed to add your spellcasting modifier to the damage produced by the spell.
- Special Modifiers
- Unless the weapon says otherwise, a +1/+2/+3 bonus normally applies to both the Attack Bonus and the Damage Bonus.
- Buffs/Other Effects
- For example, the spell Divine Favor allows the target to add 1d4 Radiant Damage to all their Damage Rolls produced by Weapon Attacks.
So using the Fighter example from above, assuming they took the Dueling Fighting Style, their Damage Bonus would be:
- Ability Modifier: +3 if they use Strength, or +4 if they use Dexterity
- Magic Weapon: +1
- Buffs/Other Effects: The Dueling Fighting Style adds +2 to damage rolls for one-handed weapons if the character is not wielding another weapon, so +2
- Total: +7 for Dexterity, +6 for Strength
Note that for damage, Proficiency was explicitly not added. Proficiency is generally not added to damage rolls unless some feature expressly says it should.
All of these rules were compiled from Chapter 9 of the Player's Handbook, Combat, starting at page 189.
A few other Examples
- Level 5 Wizard casting Fire Bolt, Intelligence 18
- Attack Roll: 1d20 + 4 (Intelligence) + 3 (Proficiency) == 1d20 + 7
- Damage Roll: 2d10 (Firebolt)
- Level 10 Evocation Wizard casting Fire Bolt, Intelligence 20
- Attack Roll: 1d20 + 5 (Intelligence) + 4 (Proficiency) == 1d20 + 9
- Damage Roll: 2d10 (Firebolt) + 5 (Intelligence, Empowered Evocation)
- Level 13 Rogue wielding a Longsword, Dexterity 20, Strength 10
- Attack Roll: 1d20 + 0 (Strength) + 0 (Non-Proficiency) == 1d20
- Damage Roll: 1d8 (or 1d10 if wielding with two hands) + 0 (Strength) == 1d8 or 1d10
- Level 13 Rogue wielding a Rapier, Dexterity 20, Strength 10
- Attack Roll: 1d20 + 5 (Dexterity) + 5 (Proficiency) == 1d20 + 10
- Damage Roll: 1d8 + 5 (Dexterity) + 7d6 (Sneak Attack for Finesse Weapon) == 1d8 + 5 + 7d6