The size of STUD is measured from the diameter of the thread.
There are 2 types of measurement, one in millimeter is most commonly used and the code is M (size) as M3, M4 and another one is inches has been used in some countries like the United States.