In applications where vibration or rotation may work a nut loose, various locking mechanisms may be employed: lock washers, jam nuts, eccentric double nuts,specialist adhesive thread-locking fluid such as Loctite, safety pins (split pins) or lockwire in conjunction with castellated nuts, nylon inserts (nyloc nut), or slightly oval-shaped threads.
Square nuts, as well as bolt heads, were the first shape made and used to be the most common largely because they were much easier to manufacture, especially by hand. While rare today[when?] due to the reasons stated below for the preference of hexagonal nuts, they are occasionally used in some situations when a maximum amount of torque and grip is needed for a given size: the greater length of each side allows a spanner to be applied with a larger surface area and more leverage at the nut.
The most common shape today is hexagonal, for similar reasons as the bolt head: six sides give a good granularity of angles for a tool to approach from (good in tight spots), but more (and smaller) corners would be vulnerable to being rounded off. It takes only one sixth of a rotation to obtain the next side of the hexagon and grip is optimal. However, polygons with more than six sides do not give the requisite grip and polygons with fewer than six sides take more time to be given a complete rotation. Other specialized shapes exist for certain needs, such as wingnuts for finger adjustment and captive nuts (e.g. cage nuts) for inaccessible areas.