An attack bonus is a number that’s added to a D20 roll when you make an attack in Dragons and Dungeons 5th edition.
Formula to calculate attack bonus 5e.

Most of the time, you’ll only have to worry about Ability Modifiers and Proficiency.
Enchantments are special bonuses or assets that can be applied to armor, tools or weapons through the use of an enchantment table. These bonuses go from +1 to +3.
A class feature is a feature you get from your class. This would include spells from a Wizard, extra attacks from a Fighter, etc.
Proficiency bonus represents your experience from a role playing viewpoint, and your power curve from a game design viewpoint.
Example:
Suppose you are playing the druid class in D&D 5e, if you are at +10 ability modifier, your proficiency bonus is +2, calculate your attack bonus.

Therefore, the attack bonus is 12.