To measure the diameter of screws and bolts, you measure the distance from the outer thread on one side to the outer thread on the other side.
This is called the major diameter and will usually be the proper size of the bolt.