Hangar CNC

G and M codes explained

G96

Constant surface speed (S in m/min): the spindle speeds up as the diameter decreases.

Learn this code in 10 minutes

Mini simulator

━ rapid · ━ cutting

Sample program

%
O2000
G21 G18 G40 G99
T0101
G96 S180 M03
G50 S2500
G00 X52 Z2 M08
G01 Z-15 F0.2
G00 X100 Z100
M05 M09
M30
%

Line by line

  1. O2000 : Program number: O2000.
  2. G21 G18 G40 G99 : Dimensions in millimetres. ZX working plane (lathe). Cancels tool radius compensation. Milling: return to the R plane after a cycle. Lathe: feed in mm per revolution.
  3. T0101 : Tool no. 1 with offset no. 1.
  4. G96 S180 M03 : Constant surface speed (S in m/min): the spindle speeds up as the diameter decreases. Constant cutting speed: 180 m/min. Spindle on, clockwise.
  5. G50 S2500 : Spindle speed limited to 2500 rpm.
  6. G00 X52 Z2 M08 : Rapid move to X=52, Z=2. Coolant on.
  7. G01 Z-15 F0.2 : Straight-line feed to Z=-15, at 0.2 mm/rev.
  8. G00 X100 Z100 : Rapid move to X=100, Z=100.
  9. M05 M09 : Spindle stop. Coolant off.
  10. M30 : End of program, rewind to the start.

Common mistakes

Forgetting this code stays active (modal) on the following lines until another code of the same group replaces it.

Free training, on phone or computer, in 5 languages.

Learn this code in 10 minutes