Every G Code for Your CNC [The Complete List] - Machinist Guides (2024)

Plane Selection

Every G Code for Your CNC [The Complete List] - Machinist Guides (1)

G17 - XY Plane Selection

The vast majority of movement in CNC programs will be relative to the XY plane. Plane selection affects how G02, G03, cutter compensation and some canned cycles are handled.

Every G Code for Your CNC [The Complete List] - Machinist Guides (2)

G18 - XZ Plane Selection

Plane selection affects how G02, G03, cutter compensation and some canned cycles are handled. G18 tells the machine you are machining radii around the Y axis.

Every G Code for Your CNC [The Complete List] - Machinist Guides (3)

G19 - YZ Plane Selection

Plane selection affects how G02, G03, cutter compensation and some canned cycles are handled. G19 tells the machine you are machining radii around the Z axis.

Unit Modes

G20 - Inch Mode

All size and location commands will be in inches until changed.

Learn more about the G20 code

G21 - Metric Mode

All size and location commands will be in millimeters until changed.

Learn more about the G21 code

Compensation Codes

G40 - Cancel Cutter Compensation

Turns off any cutter compensation modes (G41 or G42).

Learn more about the G40 code

G41- Cutter Compensation Left

Shifts the machine tool path to the left based on the radius of the cutting tool.

Learn more about the G41 code

G42 - Cutter Compensation Right

Shifts the machine tool path to the right based on the radius of the cutting tool.

Learn more about the G42 code

G43 - Tool Length Compensation

Adjusts a tool’s location based on a specified tool height (H) offset.

Learn more about the G43 code

G49 - Tool Length Compensation Cancel

Turns off the tool length compensation set by a G43 or G44 command.

Learn more about the G49 code

Work Offsets

G54 - Work Offset 1

Sets a specific location in the CNC as the zero location for the program.

Learn more about the G54 code

G55 - Work Offset 2

Sets a specific location in the CNC as the zero location for the program.

Learn more about the G55 code

G56 - Work Offset 3

Sets a specific location in the CNC as the zero location for the program.

Learn more about the G56 code

G57 - Work Offset 4

Sets a specific location in the CNC as the zero location for the program.

Learn more about the G57 code

G58 - Work Offset 5

Sets a specific location in the CNC as the zero location for the program.

Learn more about the G58 code

G59 - Work Offset 6

Sets a specific location in the CNC as the zero location for the program.

Learn more about the G59 code

Canned Cycles

G73 - High-Speed Peck Drilling Canned Cycle

Peck drill a hole by repeatedly drilling, then retracting a small amount, then drilling deeper. Often used to break up chips when drilling.

Learn more about the G73 code

G74 - Left-Hand Tapping Canned Cycle

A tapping cycle for left-hand or reverse threads. The spindle must be running in reverse during this cycle. The machine will feed to the bottom of the hole and then reverse the spindle direction and back out of the hole.

Learn more about the G74 code

Every G Code for Your CNC [The Complete List] - Machinist Guides (19)

G76 - Fine Boring Canned Cycle

Bores a hole then stops the spindle, retracts the tool from the surface and rapid retracts the tool out of the hole.

G81 - Standard Drilling Cycle

Drills a hole then rapid retracts out of the hole.

Learn more about the G81 code

G82 - Standard Drill with Dwell

Drills a hole, dwells at the bottom of the hole for a set amount of time and then rapid retracts out of the hole.

Learn more about the G82 code

G83 - Deep Hole Peck Drilling Cycle

The machine will drill in pecks while rapid retracting out of the hole between each peck to help clear chips from the drill.

Learn more about the G83 code

G84 - Right-Hand Tapping Cycle

The standard tapping cycle with the spindle running clockwise. The CNC will feed to the bottom of the hole and then reverse the spindle direction and back out of the hole.

Learn more about the G84 code

G85 - Reaming Cycle

The machine will feed to the bottom of the hole and then rapid retract out.

Learn more about the G85 code

G86 - Boring Cycle

The machine will feed to the bottom of the hole and then rapid retract out. The tool is not pulled away from the surface which can leave a tool mark on the hole.

Learn more about the G86 code

Every G Code for Your CNC [The Complete List] - Machinist Guides (26)

G87 - Back Boring Cycle

Bores a hole from bottom to top. This is the reverse direction of the G86 code.

Every G Code for Your CNC [The Complete List] - Machinist Guides (27)

G88 - Boring Cycle with Dwell

Bores a hole and then dwells at the bottom for a set amount of time.

Every G Code for Your CNC [The Complete List] - Machinist Guides (28)

G89 - Back Boring Cycle with Dwell

The machine will feed to the bottom of the hole, pause for a set amount of time and then rapid retract out. The tool is not pulled away from the surface which can leave a tool mark on the hole.

Cancel Codes

Every G Code for Your CNC [The Complete List] - Machinist Guides (29)

G50 - Cancel Scaling

Turns off scaling mode.

G80 - Canned Cycle Cancel

Cancels any active canned cycles for drilling, boring, tapping, etc.

Learn more about the G80 code

Positioning Modes

G90 - Absolute Mode

All movement locations are relative to a fixed zero such as the work offset (G54, G55, etc.) or machine home location.

Learn more about the G90 code

G91 - Incremental Mode

All movement locations are relative to the machine’s current position.

Learn more about the G91 code

Speeds and Feeds

Every G Code for Your CNC [The Complete List] - Machinist Guides (33)

G94 - Feed per Minute Mode

Sets the feed rate to units (inches/mm) per minute. The tool will move at a set rate.

Every G Code for Your CNC [The Complete List] - Machinist Guides (34)

G95 - Feed per Revolution Mode

Sets the feed rate to units (mm/inches) per revolution. The tool will move a set rate for every spindle rotation.

Every G Code for Your CNC [The Complete List] - Machinist Guides (35)

G96 - Constant Surface Speed

The spindle speed will vary to maintain the same surface speed of the material.

Every G Code for Your CNC [The Complete List] - Machinist Guides (36)

G97 - Constant Spindle Speed

The spindle will operate at a consistent RPM.

Plane Return

G98 - Return to Initial Plane

After a canned cycle the tool will retract to the start of the canned cycle.

Learn more about the G98 code

G99 - Return to Rapid Plane

After a canned cycle the tool will retract to a specified location. Can be useful for avoiding workholding fixtures.

Learn more about the G99 code

Lesser Used G Codes

Every G Code for Your CNC [The Complete List] - Machinist Guides (2024)
Top Articles
Latest Posts
Article information

Author: Dong Thiel

Last Updated:

Views: 5845

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.