Instructions
Find your base attack bonus (BAB) in the chart listed in each character class section of the Core Rulebook. In general, fighter characters -- fighters, barbarians, rangers, paladins -- start with a BAB of one at level one and progress at one per level: While non-fighter characters -- wizards, rogues, clerics, druids, bards -- start with a BAB of zero at level one and progress more slowly.
Add your strength modifier to melee attacks and your dexterity modifier to ranged attacks. To calculate your ability modifier, divide your ability score by two, round down and then subtract five. For example, an ability score of 18 or 19 gives you a modifier of four.
Add your size modifier. Most playable races are normal-size, while halflings and gnomes are small. Normal-sized characters have a size modifier of zero: While small characters have a bonus of one. See the size modifier chart (page 179 of the Core Rulebook) for a complete list of size modifiers.
Add the range penalty to a ranged attack. If the target is within the listed range of the weapon, this number will be zero. If the target is farther away than the range listed, then add a negative two range penalty for each range unit of distance between the shooter and the target. For example, a short-bow has a range of 60 feet. If the target is 80 feet away, then there is a range penalty of negative two. If the target is 125 feet away, the penalty is negative four.
Add any weapon or item bonuses.
Add any bonuses from weapon training, if applicable. Weapon training adds a plus one to hit bonus for a select group of weapons -- such as axes, heavy blades, light blades, crossbows and flails.
Add any other attack roll modifiers that are applicable. Table 8-5 on page 195 of the Core Rulebook lists the possible attack modifiers. Some examples of attack bonuses include Flanking (+2), Invisible (+2) and higher ground (+1). Some negative attack modifiers are Dazzled (-1), Shaken (-2), Prone (-4), and Entangled (-2).