Axle Replacement
Why Did My Axle Break?
Your axle didn't break by itself. You broke it. Axles break or bend if the bike is ridden when the hub is not adjusted right or when the bike is abused more than it was designed to bear. Locknuts come loose--hubs come out of adjustment. It's your responsibility to test your hubs. If you apply more force to steel than it was intended to take, it bends or breaks. If you want to be rough, spend more money on your equipment.
Hub Replacement
If you can overhaul a hub, replacing an axle is easy. Follow the steps for a hub overhaul (front) (rear), but change all the parts over to the new axle.
The 2 difficult issues are:
1. spacing
2. axle size and features.
Hub Spacing
Hubs must be spaced to fit between the dropouts on the frame or fork. The measurement is distance in millimeters between the outside surfaces of the locknuts, which needs to match the distance between the inside faces of the dropouts on the frame and fork.
Almost all bicycle fork dropouts are 100 mm apart, measuring from inside to inside. Therefore, almost all front hub spacing is 100mm, measured between the outside surfaces of the locknuts.
Almost all road bike frame dropouts are 130 mm apart, so rear road hub spacing is 130 mm.
The vast majority of mountain bike, comfort bike, and hybrid frame dropouts are 135 mm apart, so the rear hub spacing is 135 mm.
Some older bike rear spacing is 126 mm, and single speed bikes can vary down to 100 mm. It is very hard to find a new wheel with 126 mm hub spacing, but your bike shop can buy a 126 mm hub from J & B Importers and build a wheel for you. Or you could build your own wheel.
The rear hub for your road bike won't fit your mountain bike, and vice versa.
However, steel frame stays can often be bent to accommodate a wrongly spaced hub. But frames sometimes break in the attempt, so don't be shocked. Don't try radical bends on a cherished frame. Don't try to bend an aluminum or carbon fiber frame.
On quick release hubs, the outside surface of the locknut should be about 5.5 mm from the axle end. On nutted axles, axle length and symmetry on the outside of the locknuts does not matter much, as long as the axle is long enough--its ok for your axle to stick past the axle nut.
Bike Axle Sizes and Features
Bike axles come with different features:
axle diameter, usually 10 mm for modern Shimano hubs, but sometimes as small as 9 mm
axle length, usually about 11 mm longer than the hub spacing, usually 146 mm for Shimano mountain bike hubs and 141 mm for Shimano road bike hubs
thread pattern, usually 1 mm (one thread each millimeter) for Shimano hubs, but sometimes 24 or 26 tpi (threads per inch)
hollow or solid, hollow axles for quick release devices.
When ordering a replacement axle, you need to get all this right. It's best to take your old axle to a good bike shop and let a professional choose the replacement.