Both Machine Screws and Bolts are often too long for the application and require cutting to length. There are two methods for cutting these bolts to length.

Method 1: Electrical crimping pliers - like those shown in the photograph, are both inexpensive and easy to use. These are made for trimming bolts and machine screws (as well as for stripping wire). Most people have this tool in their toolbox and, if not, it is readily available at any hardware store.

Beside the hinge on the Pliers there are several small holes (marked M2.5, M 3, M 3.5, M4, M5). These holes are designed to cut bolts to length without damaging the thread. To cut the bolt to length, screw your bolt into the correct size hole until you get to the desired length. The pliers will cut through the bolt - leaving the threads in-tact.

Method 2: A common hack-saw can cut through the threads. The danger is to not destroy the threads on the side that you wish to use. You can also put a nut on the bolt first - the bolt is made of a hardened steel. If the threads are accidentally damaged, you can use the nut to help fix the threads.

How to Trim an Oversized Machine Screw
Method 1: Electrical Crimping Pliers