How to Write a Simple CNC Turning Program (Facing & OD Turning)
Here is a simple, standard Fanuc-style CNC lathe program for facing and OD (outside diameter) turning.
Below is a step-by-step guide and a complete, commented program example for a basic part.
Programming Structure
- Set the program number, safety lines, and tool selection.
- Set maximum RPM limits, turn on the spindle at a specific speed, and activate coolant.
- Move the tool to the face of the stock and face it down to the center.
- Move to the start position of the outer diameter, feed along the length to cut the OD, and retract.
- Turn off the spindle and coolant, send the machine to its home position, and end the program
Example CNC Turning Program

O0001
N1 G28 U0 W0
N2 T0101
N3 G97 S1500 M03
N4 G00 X2.1 Z0.1 M08
N5 G01 X-0.06 F0.008
N6 G00 Z0.1
N7 G00 X1.95
N8 Z0.0
N9 G01 Z-2.0 F0.006
N10 G01 X2.02 F0.01
N11 G00 Z2.0 M09
N12 G28 U0 W0 M05
N13 M30
G-Code Reference
O0001 (FACE AND TURN PROGRAM)
G28 U0 W0 – Sends the machine axes (X and Z) back to their home/reference position).
N2 T0101 – Calls Tool 1 with wear offset 1 (SELECT TOOL 1 – OD TURNING / FACING TOOL).
N3 G97 S1500 M03 – Turns the spindle on clockwise at 1500 RPM. (CONSTANT SPINDLE SPEED, 1500 RPM, SPINDLE ON).
N4 G00 X2.1 Z0.1 M08 – RAPID TO SAFE START POSITION, COOLANT ON.
FACING CYCLE
N5 G01 X-0.06 F0.008 – FACE ACROSS TO CENTER.
N6 G00 Z0.1 – RETRACT OFF FACE.
OD TURNING CYCLE
N7 G00 X1.95 – RAPID TO START OD DIAMETER.
N8 Z0.0 – RAPID TO FRONT OF PART.
N9 G01 Z-2.0 F0.006 – TURN OD DOWN TO -2.0 INCH LENGTH.
N10 G01 X2.02 F0.01 – FEED OUT SLIGHTLY.
PROGRAM END
N11 G00 Z2.0 M09 – RETRACT Z, COOLANT OFF.
N12 G28 U0 W0 M05 – RETURN TO HOME, SPINDLE STOP
N13 M30 – END OF PROGRAM
