Milling G-Code Validation Report
Program: O _ _ _ _
Date:

Step 1: Enter G-Code

G-Codes
G00 Rapid positioning G00 X2.0 Y1.5;
G00 Z0.5; (Safe Z)
Moving at rapid speed saves time between cuts. Using G00 for anything but positioning above your material can break tools instantly or cause crashes. Always raise Z to a safe height before using G00 to move in X or Y.
G01 Linear interpolation G01 X2.0 Y1.5 F10.0;
G01 Z-.125 F7.5; (Cut depth)
This is your main cutting command. Without G01 and a proper feed rate (F value), your machine would either not cut at all or move too fast and break tools. Every cut in your program needs G01 with feed rate.
G02/G03 Circular interpolation (CW/CCW) G00 X1.0 Y1.0; (Start)
G02 X2.0 Y2.0 I0.5 J0.5 F10.0;
Using the wrong direction (G02 vs G03) will cut on the wrong side of your line, potentially ruining your part. The I and J values must be correct or your arc will be the wrong size or shape.
G20/G21 Units (inches/mm) G20; (inches)
G21; (millimeters)
Without specifying units, a 1-inch cut might be interpreted as 1mm (25 times smaller!). This must be at the beginning of your program or all dimensions will be wrong.
G40 Cutter compensation off G40; Failing to turn off cutter compensation when you're done with it means the machine keeps adjusting the tool path, causing unexpected movements that can ruin parts.
G41/G42 Cutter comp. on (left/right) G00 X0.5 Y0.0; (Lead-in start)
G41 D1 G01 X1.0 Y0.0 F10.0; (Left comp on, lead-in)
X1.0 Y1.0; (Cut part)
X0.0 Y1.0; (Cut part)
X0.0 Y0.0; (Cut part)
X-0.5 Y0.0; (Lead-out)
G40; (Comp off)
G41 shifts the tool left of the path, G42 shifts it right, based on the D value (tool radius). You need a lead-in move (like from X0.5 to X1.0) to start compensation smoothly and a lead-out move (like X0.0 to X-0.5) to end it safely. Without compensation, cuts will be off by the tool radius. Without lead-in/lead-out, the machine might gouge the part or error out.
G53 Machine coordinate system G53 G00 Z0.;
G00 G53 Z0.; (Full Z retract)
Using G53 ensures your tool returns to a consistent machine position, regardless of work offsets. This is essential for tool changes and ending programs safely without crashes.
G54-G59 Work coordinate systems G54; (offset 1)
G00 G54 X.375 Y-.375;
Without selecting a work coordinate system, the machine won't know where your material is located. G54 specifies that you're working with the first saved work zero.
G80 Cancel canned cycle G80; If you don't cancel a drilling cycle with G80, every X-Y movement will create another hole! This could put dozens of unwanted holes in your part.
G81 Drilling cycle G81 X1.0 Y1.0 Z-0.5 R0.1 F5.0; (Drill)
X2.0 Y1.0; (Next hole)
Using a canned cycle like G81 saves you from writing multiple lines of code for each hole. Without Z and R values, the machine won't know how deep to drill or where to retract.
G82 Drilling cycle with dwell G82 X1.0 Y1.0 Z-0.5 R0.1 P500 F5.0; (Drill with dwell)
X2.0 Y1.0; (Next hole)
G82 adds a pause (P500 = 0.5 seconds) at the bottom to break chips and improve the finish. Use it for counter-boring or precise holes. Without Z, R, or P, the machine won’t know the depth, retract height, or dwell time.
G83 Peck drilling cycle G83 X1.0 Y1.0 Z-1.0 Q0.25 R0.1 F5.0; (Peck drill)
X2.5 Y1.0; (Next hole)
G83 drills deep holes in steps (Q0.25 = 0.25-inch pecks) and retracts to R to clear chips. It’s efficient for deep drilling. Without Z, Q, or R, the machine won’t know how deep to go, how much to peck, or where to retract.
G84 Tapping cycle G84 X1.0 Y1.0 Z-0.75 R0.1 F30.0; (Tap hole)
X3.0 Y1.0; (Next hole)
G84 cuts threads by matching F (e.g., F30 for a 1/4-20 tap at 600 RPM) to the spindle speed and pitch. The spindle reverses at Z depth. Without Z, R, or F, the machine won’t know the depth, retract height, or feed rate.
G90 Absolute positioning G90;
G90 T1 M06; (Absolute mode)
Without G90, the machine might use incremental positioning, where each move is relative to the last position. This completely changes how every coordinate works and will make your part dimensions wrong.
G91 Incremental positioning G91;
G00 X1.0 Y1.0; (Move from current pos)
If you don't switch back to G90 after using G91, all remaining coordinates will be interpreted as distances from the previous position, not from work zero.
G43 Tool length compensation T1 M06; (Tool #1)
G43 H1; (Length offset)
G43 H1 Z.05; (Safe Z)
Without G43, the machine doesn't know how long your tool is, so it can't adjust the Z-axis properly. This can cause the tool to crash into your part or cut at the wrong depth.
M-Codes
M00 Program stop M00; Using M00 lets you check your part or tool before continuing. Without planned stops, you might complete an entire program with a problem you could have fixed.
M01 Optional stop M01; M01 gives you the option to check parts during a production run. This can be turned off when you're confident everything is working right.
M03 Spindle on (CW) S1200 M03;
S2000 M03; (2000 RPM)
If you forget M03, your spindle won't turn, and your tool will rub against the material without cutting. This can break tools and damage your workpiece.
M04 Spindle on (CCW) M04 S1200; Using M04 instead of M03 rotates the spindle in the opposite direction, which is needed for certain operations like left-hand tapping. Using the wrong direction can break taps.
M05 Spindle stop M05; Without stopping the spindle before a tool change, the machine will try to change tools with the spindle running, which is dangerous and can damage the tool changer.
M06 Tool change G00 Z1.0; (Safe Z)
T1 M06; (Tool #1)
Without M06, the machine won't actually change to the new tool, even if you specify a T number. You must include M06 to execute the tool change.
M30 Program end M30; Without M30, your program doesn't properly end, and the machine may attempt to continue running past your intended endpoint or won't return to the start of the program.
M83/M84 Air blast on/off M83; (air on)
M84; (air off)
Using M83 instead of M08 ensures you're using air blast (not coolant) to clear chips when machining plastics or other materials where liquid coolant would cause problems.
Letter Addresses
X, Y, Z Primary axis positions G01 X10.0 Y5.0 Z-2.5 F20.0;
G00 X.375 Y-.375; (Start pos)
G01 Z-.125 F7.5; (Cut depth)
Without X, Y, Z values, the machine doesn't know where to move. Z is especially critical - a wrong Z value can crash into your material or not cut deep enough.
I, J, K Arc center coordinates G00 X1.0 Y1.0; (Start)
G02 X2.0 Y2.0 I0.5 J0.5 F10.0;
I, J, and K tell the machine where the center of an arc is located. If these values are wrong, your arc will be the wrong size or shape. I is the X distance to center, J is the Y distance to center, from your starting point.
F Feed rate G01 X10.0 Y5.0 F20.0;
G01 Z-.125 F7.5; (Feed rate)
Without a feed rate, your machine might use the last programmed feed (which could be wrong) or default to a very slow feed. Too fast or slow feed rates break tools or make poor quality cuts.
S Spindle speed S1200 M03;
S2000 M03; (2000 RPM)
The wrong spindle speed can burn your tool or material (too slow) or cause excessive vibration and tool breakage (too fast). Different materials and tool sizes need different speeds.
T Tool selection T1 M06; (Tool #1) Without the correct T number, the machine will use the wrong tool for your operation. This can damage both the tool and your workpiece.
H Tool height offset G43 H1; (Length offset) If the H number doesn't match your T number, the machine won't compensate properly for tool length. This can cause crashes or cutting at the wrong depth.
P Dwell time / parameter G82 X1.0 Y1.0 Z-0.5 R0.1 P500 F5.0; (Dwell 0.5s) In G82 drilling cycles, P controls how long the tool pauses at the bottom of the hole (in milliseconds). Without a P value, your holes may have poor finish or chips might not break properly.
Q Peck depth G83 X1.0 Y1.0 Z-1.0 Q0.25 R0.1 F5.0; (Peck 0.25") Q sets how deep the drill goes before retracting to clear chips in peck drilling cycles. Without the right Q value, chips won't clear and can jam in deep holes, breaking your drill bit.
R Radius / clearance height G81 X1.0 Y1.0 Z-0.5 R0.1 F5.0; (Retract height)
G02 X3.0 Y3.0 R1.5 F10.0; (Arc radius)
In drilling cycles, the R value sets how high the tool retracts between holes. Too low and you might hit clamps or workpiece features. In arcs, R defines the radius of your cut.
Other Symbols
% Program start/end marker %
O1234; (PROJECT NAME)
(Program body)
M30; (End)
%
These markers tell the CNC control where your program begins and ends. Without them, the machine might read past your intended program or fail to find it properly.
; End of Block (EOB) G00 X2.0 Y1.5;
S1200 M03;
Without semicolons, the machine can't tell where one command ends and another begins. This can cause multiple commands to be interpreted as one invalid command.
O Program number %
O1234; (PROJECT NAME)
The O-number is how you and others identify your program on the machine. Without it, you can't easily find your program later or distinguish it from others.
() Comment parentheses G00 X1.0 Y1.0 (Start pos);
T1 M06; (1/4" EM)
Comments explain what your code is doing, making it easier for you and others to understand the program. Good comments prevent mistakes when editing programs later.
T#Tool Description
Basic Check (Always On) Advanced Check (Extra Safety When On)
Program Structure Errors

Missing % at start - Program must begin with %

Missing % at end - Program must end with %

Missing O-number after % - No program number defined

Multiple O-numbers defined - Only one O-number allowed per file

O-number in reserved HAAS ranges - O00000-O00099 or O09000-O09999 not allowed

O-number out of valid range - Must be between O00000 and O99999

Invalid O-number format - Must be 'O' followed by 5 digits

Missing G20/G21 - Units (inches/mm) not specified

Units mismatch - G20/G21 conflicts with selected units

Missing G54-G59 - No work coordinate system defined

Missing G90 or G91 - Positioning mode not set early

G91 without G90 before end - Incremental mode not reset

Missing M30 - Program end code missing before final %

Missing G43 - No tool length compensation defined

Syntax Errors

Multiple M codes in a single line - Only one M-code allowed per line

Line exceeds 256 characters - Too long for processing

Lowercase detected - Non-comment lines must be uppercase

Missing semicolon (;) - Required at end of non-comment lines

Semicolon after comment - Semicolon must precede comment

Multiple semicolons - Only one semicolon allowed per line

Excessive spaces - Multiple consecutive spaces detected

Sequence numbers not increasing - N# must rise sequentially

Missing sequence number - N# absent on non-comment lines

Tool Configuration Errors

Tool number less than 10 with invalid leading zero - T# should be T1, not T01

Tool number and height offset mismatch - T# and H# numbers differ

Missing H# after T# - Tool lacks corresponding height offset

Machine Parameter Errors

Spindle speed with decimal - S# must be an integer

Feed rate without decimal - F# requires a decimal point

Height offset format - H# less than 10 needs leading zero (H01)

Diameter offset format - D# less than 10 needs leading zero (D01)

Tool Data Errors

Incomplete tool data - Missing tool name, H#, feed/speed, min/max Z

Coordinate Errors

Coordinate values without decimal - X, Y, Z need decimal points

Coordinates not in X, Y, Z order - Must follow X, Y, Z sequence

Material Bounds Errors

Missing material dimensions - Width, length, height undefined

X coordinate exceeds material width - Outside material bounds

Y coordinate exceeds material length - Outside material bounds

Z coordinate exceeds material depth - Below material bottom

Safety Warnings

M08 used instead of M83 - Use M83 for air blast

M09 used instead of M84 - Use M84 to stop air blast

X-axis travel exceeds machine limit - Beyond -8 to 8 inches

Y-axis travel exceeds machine limit - Beyond -8 to 8 inches

Z-axis travel exceeds machine limit - Beyond -9.8241 to 9.8241 inches

Z value below -2 inches - Too low for safety

Z value above 5 inches - Too high for safety

G00 moving Z into material - Rapid move Z <= 0 and above material bottom

G00 moving X or Y inside material - Rapid move when Z is inside material

Machine Parameter Warnings

Spindle speed exceeds 4000 RPM - Too high for safety

Feed rate exceeds 50 IPM - Too high for safety

Drilling Cycle Errors

G81 missing Z depth - Drilling cycle lacks Z value

G81 missing R clearance (G99) - R value required

G81 invalid R format (G99) - R must be a decimal number

G81 missing F feedrate - Feedrate required

G81 invalid F format - No negative or + sign allowed

G81 not cancelled - Missing G80 before program end

G82 missing Z depth - Drilling cycle lacks Z value

G82 missing R clearance (G99) - R value required

G82 invalid R format (G99) - R must be a decimal number

G82 missing F feedrate - Feedrate required

G82 invalid F format - No negative or + sign allowed

G82 missing P dwell time - Dwell time required

G82 invalid P format - P must be a whole number

G82 not cancelled - Missing G80 before program end

G83 missing Z depth - Drilling cycle lacks Z value

G83 missing R clearance (G99) - R value required

G83 invalid R format (G99) - R must be a decimal number

G83 missing F feedrate - Feedrate required

G83 invalid F format - No negative or + sign allowed

G83 missing Q peck depth - Peck depth required

G83 invalid Q format - Q must be a positive decimal

G83 not cancelled - Missing G80 before program end

G84 missing Z depth - Drilling cycle lacks Z value

G84 missing R clearance (G99) - R value required

G84 invalid R format (G99) - R must be a decimal number

G84 missing F feedrate - Feedrate required

G84 invalid F format - No negative or + sign allowed

G84 not cancelled - Missing G80 before program end

Step 2: Fix Basic Errors STRICT

Step 3: Check Tools

T#ToolH#Feeds/SpeedsMin ZMax Z

Step 4: Check Workpiece Bounds