What is a G03 Code? [With Lots of Examples]

a graphic of a cnc machine with text that says learn g code today G03 circular interpolation counter clockwise

The information below is meant for beginners. If you are experienced with CNC programming, then you probably already know this stuff and much more. If you are new to CNC programming, this is the place for you.

Please note that some of the topics below could include more information on the subject. However, in the interest of keeping things simple for those just starting out, they have been left out of this G code guide.

Ready to learn? Let’s go.

Code

G03

Name

Circular interpolation, counterclockwise

Type

Modal - stays on until changed

Description

Circular movement at a specified feed rate in a counterclockwise direction

What does a G03 code do?

A G03 code is a circular movement CNC G code. It is used to move the CNC table and/or spindle from its current location to an end location along a specified radius (R) in a counterclockwise direction.

When to use a G03 code?

G03 codes will usually be in the lines of the program that are used to cut the part. The G03 code allows the programmer to cut a full circle or portion of a circle.

F and S codes are used together with a G03 code to specify the feed rate and spindle speed. An R code is used as well to tell the machine what size radius to move along.

What to think about when using a G03 code?

Units

First, make sure you know what units you are working in. Moving 10 inches instead of 10 millimeters is a big difference.

A G20 (inches) or G21 (mm) code should identify the units you are working in before your G03 code.

comparison of units of measurement for cnc programming

Absolute vs incremental mode

The second thing to look for is whether you are working in absolute (G90) or incremental (G91) coordinates. The most recent G90 or G91 code in the program will determine which mode you are in.

Absolute coordinates will move from a set zero location such as your machines home location or a specified location on your part.

Incremental coordinates will move relative to your current position. See our posts on G90 and G91 codes to learn more about the differences between absolute and incremental coordinates.

Start and stop locations

Lastly, make sure you understand where you are currently position wise (X, Y & Z location), where you will be moving to and if there is anything in between the two locations.

The G03 code will move the machine in a circular arc to your new location. You don’t want anything in the way or to miscalculate your stop point. Clamps or vises can be easy to forget about and run into. Crashing your machine is never a good time.

3 G03 code examples and descriptions of what they do

For the examples below, we will assume your machine is in absolute mode (G90). If you are working in incremental mode (G91), the resulting movements will be different.

Check out our guides to G90 and G91 G codes to understand the difference between the two movement types.

Example #1

N085 G03 X1.0 Y2.0 R1.0

This is line number 85 of the program.

G03 sets the movement mode as circular, counterclockwise.

X1.0 Y2.0 is the location the machine will move to. There is no Z axis movement in this line.

R1.0 specifies the size of the radius that the machine will move along.

Example #2

N060 G03 X3.5 Y3.5 R0.5

This is line number 60 of the program.

G03 sets the movement mode circular, clockwise.

X3.5 Y3.5 is the location that the machine will move to. There is no Z axis movement in this line.

R0.5 specifies the size of the radius that the machine will move along.

Example #3

N477 G03

This is line number 477 of the program.

G03 sets the movement mode circular, clockwise.

There is no location specified on this line. The machine will not move based on this code line.

CNC codes that are similar to G03

a comparison of the type of movement created with G00, G01, G02 and G03 cnc g codes

Note that all the movement codes listed below are modal. This means they will stay in the movement mode identified by the code until switched to a different mode.

What is a G02 Code? [With Lots of Examples]

a graphic of a cnc machine with text that says learn g code today g02 circular interpolation

The information below is meant for beginners. If you are experienced with CNC programming, then you probably already know this stuff and much more. If you are new to CNC programming, this is the place for you.

Please note that some of the topics below could include more information on the subject. However, in the interest of keeping things simple for those just starting out, they have been left out of this G code guide.

Ready to learn? Let’s go.

Code

G02

Name

Circular interpolation, clockwise

Type

Modal - stays on until changed

Description

Circular movement at a specified feed rate in a clockwise direction

What does a G02 code do?

A G02 code is a circular movement CNC G code. It is used to move the CNC table and/or spindle from its current location to an end location along a specified radius (R) in a clockwise direction.

When to use a G02 code?

G02 codes will usually be in the lines of the program that are used to cut the part. The G02 code allows the programmer to cut a full circle or portion of a circle.

F and S codes are used together with a G02 code to specify the feed rate and spindle speed. An R code is used as well to tell the machine what size radius to move along.

What to think about when using a G02 code?

Units

First, make sure you know what units you are working in. Moving 10 inches instead of 10 millimeters is a big difference. A G20 (inches) or G21 (mm) code should identify the units you are working in before your G02 code.

comparison of units of measurement for cnc programming

Absolute vs incremental mode

The second thing to look for is whether you are working in absolute (G90) or incremental (G91) coordinates. The most recent G90 or G91 code in the program will determine which mode you are in.

Absolute coordinates will move from a set zero location such as your machines home location or a specified location on your part.

Incremental coordinates will move relative to your current position. See our posts on G90 and G91 codes to learn more about the differences between absolute and incremental coordinates.

Start and stop locations

Lastly, make sure you understand where you are currently position wise (X, Y & Z location), where you will be moving to and if there is anything in between the two locations.

The G02 code will move the machine in a circular arc to your new location. You don’t want anything in the way or to miscalculate your stop point. Clamps or vises can be easy to forget about and run into. Crashing your machine is never a good time.

3 G02 code examples and descriptions of what they do

For the examples below, we will assume your machine is in absolute mode (G90). If you are working in incremental mode (G91), the resulting movements will be different.

Check out our guides to G90 and G91 G codes to understand the difference between the two movement types.

Example #1

N035 G02 X4.0 Y4.0 R2.0

This is line number 35 of the program.

G02 sets the movement mode as circular, clockwise.

X4.0 Y4.0 is the location the machine will move to. There is no Z axis movement in this line.

R2.0 specifies the size of the radius that the machine will move along.

Example #2

N090 G02 X7.5 Y1.5 R0.5

This is line number 90 of the program.

G02 sets the movement mode as circular, clockwise.

X7.5 Y1.5 is the location that the machine will move to. There is no Z axis movement in this line.

R0.5 specifies the size of the radius that the machine will move along.

Example #3

N250 G02

This is line number 250 of the program.

G02 sets the movement mode as circular, clockwise.

There is no location specified on this line. The machine will not move based on this code line.

CNC codes that are similar to G02

a comparison of the type of movement created with G00, G01, G02 and G03 cnc g codes

Note that all the movement codes listed below are modal. This means they will stay in the movement mode identified by the code until switched to a different mode.

What is a G00 Code? [With Lots of Examples]

a graphic of a cnc machine with text that says learn g code today g00 rapid travel

The information below is meant for beginners. If you are experienced with CNC programming, then you probably already know this stuff and much more. If you are new to CNC programming, this is the place for you.

Please note that some of the topics below could include more information on the subject. However, in the interest of keeping things simple for those just starting out, they have been left out of this G code guide.

Ready to learn? Let’s go.

Code

G00

Name

Rapid travel

Type

Modal - stays on until changed

Description

The machine will move at full speed to all new locations given

What does a G00 code do?

A G00 code is a rapid traverse CNC G code. It is used to move the CNC table and/or spindle.

When to use a G00 code

G00 codes get used when the CNC programmer wants to move the tool very quickly. This happens at many points throughout a program.

The G00 code is used to decrease the time it takes to run a CNC program (cycle time). If the cycle time is decreased, more parts can be manufactured in the same amount of time.

What to think about when using a G00 code

Units

First, make sure you know what units you are working in. Moving 10 inches instead of 10 millimeters is a big difference. A G20 (inches) or G21 (mm) code should identify the units you are working in before your G00 code.

comparison of units of measurement for cnc programming

Absolute vs incremental mode

The second thing to look for is whether you are working in absolute (G90) or incremental (G91) coordinates. The most recent G90 or G91 code in the program will determine which mode you are in.

Absolute coordinates will move from a set zero location such as your machines home location or a specified location on your part.

Incremental coordinates will move relative to your current position. See our posts on G90 and G91 codes to learn more about the differences between absolute and incremental coordinates.

Machine movement

Know your machine. Some machines will move all 3 axes at once. Others will move a single axis at a time. Most machines will move all 3 at once but make sure you know how your CNC will execute the code.

Start and stop locations

Lastly, make sure you understand where you are currently position wise (X, Y & Z location), where you will be moving to and if there is anything in between the two locations. The G00 code will move the machine very quickly to the new location. You don’t want anything in the way or to miscalculate your stop point. Crashing your machine is never a good time.

6 G00 code examples and descriptions of what they do

For the examples below, we will assume your machine is in absolute mode (G90). If you are working in incremental mode (G91), the resulting movements will be different. Check out our guides to G90 and G91 G codes to understand the difference between the two movement types.

Example #1

N005 G00 X4.0 Y5.0 Z2.0

This is line number 5 of the program.

G00 sets the movement mode as rapid travel.

X4.0 Y5.0 Z2.0 is the location the machine will move to. If the Z location of the machine was already at 2.0, then the Z axis will not move. This is the same for each axis.

Example #2

N050 G00 X4.0 Y5.0

This is line number 50 of the program.

G00 sets the movement mode as rapid travel.

X4.0 Y5.0 is the location that the machine will move to. The Z axis of the machine will not change and remain at the location it was previously set at.

Example #3

N100 G00 Y5.0 Z2.0

This is line number 100 of the program.

G00 sets the movement mode as rapid travel.

Y5.0 Z2.0 is the location that the machine will move to. The X axis of the machine will not change and remain at the location it was previously set at.

Example #4

N010 G00 Y5.0

This is line number 10 of the program.

G00 sets the movement mode as rapid travel.

Y5.0 is the location that the machine will move to. The X and Z axes of the machine will not change and remain at the location they were previously set at.

Example #5

N075 G00

This is line number 75 of the program.

G00 sets the movement mode as rapid travel.

There is no location specified on this line. The machine will not move based on this code line.

Example #6

N256 G00 X4.0

This is line number 256 of the program.

G00 sets the movement mode as rapid travel.

X4.0 is the location that the machine will move to. The Y and Z axes of the machine will not change and remain at the location they were previously set at.

CNC codes that are similar to G00

a comparison of the type of movement created with G00, G01, G02 and G03 cnc g codes

Note that all the movement codes listed below are modal. This means they will stay in the movement mode identified by the code until switched to a different mode.

Ultimate Guide to CNC Codes

Here is our Ultimate Guide to CNC Codes. Below is a list of CNC codes with a description of what they are.

Click on the code if you want to find out more including multiple examples to help you understand how to use them in your programs.

A - Rotation Around the X Axis

Rotates around the 4th axis of the machine if equipped.

B - Rotation Around the Y Axis

Rotates around the 5th axis of the machine if equipped.

C - Rotation Around the Z Axis

Rotates around the 6th axis of the machine if equipped.

D - Diameter Offset

Specifies the tool diameter offset to be used for cutter compensation (G41 and G42).

F - Feed Rate

Sets the feed rate to be used for movement. The feed rate is used when moving using codes such as G01, G02 & G03.

The feed rate is not used when using rapid travel (G00).

Sets various modes in the machine or prepares the machine to perform a function such as a canned cycle.

Learn more about G codes

H CNC Code

H - Height Offset

Specifies the height offset to be used when turning tool length compensation on (G43) or off (G49)

I CNC Code

I - Radius Center in X Axis

Identifies the location of the center of a radius for a circular move relative to the current X axis location. 

J CNC Code

J - Radius Center in Y Axis

Identifies the location of the center of a radius for a circular move relative to the current Y axis location. 

K CNC Code

K - Radius Center in Z Axis

Identifies the location of the center of a radius for a circular move relative to the current Z axis location. 

L CNC Code

L - Number of Subprogram Repetitions

Used with the M98 subprogram call command. L lists how many times the subprogram will be repeated.

M codes turn on and off various machine functions such as the spindle or coolant. 

They are also used for program start and stop functions.

Learn more about M codes

N CNC Code

N - Program Line Number

Identifies the sequence or line number of the program. They are not required but they can help make a CNC program easier to follow. 

O CNC Code

O - Program Number

The program number is the first CNC word in the program.

P CNC Code

P - Subprogram Number/Dwell Time

When used with an M98 code, P identifies the subprogram number.

When used with G04 or canned cycles, P specifies the amount of time to dwell.

Q CNC Code

Q - Peck Drill Depth

Used with G73 and G83 peck drilling cycles. Q identifies the depth of each drilling peck before the drill backs up to break chips.

R CNC Code

R - Radius Size/Reference Plane

When used with G02 and G03, R specifies the size of the circular curve to be machined.

When used with a canned cycle such as G73, R specifies the location of the rapid plane.

S CNC Code

S - Spindle Speed

Sets the speed of the spindle.

Units are in revolutions per minute (RPM)

T CNC Code

T - Tool Number

Selects a tool to prepare it for tool change. M06 will cause the CNC to swap the currently loaded tool with the one selected with the T code.

Some machines do not require the use of a M06 code and will swap tools by simply using the T code.

X CNC Code

X - X Axis Movement

Specifies the location to be moved to in the X axis. 

The distance will be affected by whether the machine is in absolute (G90) or incremental (G91) mode.

Y CNC Code

Y - Y Axis Movement

Specifies the location to be moved to in the Y axis. 

The distance will be affected by whether the machine is in absolute (G90) or incremental (G91) mode.

Z CNC Code

Z - Z Axis Movement

Specifies the location to be moved to in the Z axis. 

The distance will be affected by whether the machine is in absolute (G90) or incremental (G91) mode.

; - End of Block

Signifies the end of a block of code. A single block will usually consist of one line of code.

Useful when testing code by stepping through the blocks in single block mode.

Slash Block Skip CNC Code

/ - Block Skip

Used together with a switch on the CNC control. 

When the switch is on the machine will read and execute lines that start with the / character. When the switch is off, these lines will be ignored.

Ultimate Guide to CNC M Codes

M codes play a critical in any CNC program. Using the wrong one or forgetting to use one at the right point in your program can mean the difference between a good part and a chunk of scrap.

We’ve laid out what each M code does, but remember that some CNC makers switch things around a little bit. You can bet that the most common codes such as the ones for starting and stopping your spindle, coolant and program will be the same but some of the others might vary.

M00 CNC M Code

M00 - Program Stop

When the machine gets to this code it will stop everything, including the spindle and coolant until the operator tells the machine to continue on.

M01 CNC M Code

M01 - Optional Stop

The machine will check the control panel and if the optional stop switch is on, the machine will stop just like with M00.

Programs often have optional stops placed at the break of sections in the program such as the start of a hole drilling sequence.

M02 CNC M Code

M02 - End of Program, No Rewind

A leftover from the NC days. Ends the program without rewinding to the start again. 

In many machines now, M02 is no different than M30. How it gets treated depends on the specific CNC control model.

M03 CNC M Code

M03 - Spindle On, Clockwise

Turns the spindle on in the clockwise direction. This is the spindle direction used by most cutting tools.

M04 CNC M Code

M04 - Spindle On, Counterclockwise

Turns the spindle on in the counterclockwise direction. 

M05 CNC M Code

M05 - Spindle Stop

Stops the machine spindle.

M06 CNC M Code

M06 - Tool Change

Swaps tools.

M07 CNC M Code

M07 - Coolant On, Mist

Turns on a coolant mist. Some machines treat it as coolant source 1 on.

M08 CNC M Code

M08 - Coolant On, Flood

Turns the coolant on to soak the workpiece. Some machines treat it as coolant source 2 on.

M09 CNC M Code

M09 - Coolant Off

Turns off all coolant sources.

M19 CNC M Code

M19 - Orient Spindle

Gets the tool ready for tool change. Aligns the keyways. 

The M06 code will do this as well but calling it ahead of time can make the tool change process faster.

M30 CNC M Code

M30 - End of Program, Rewind

Stops everything including the spindle, movement, coolant and will go back to the beginning of the program.

M98 CNC M Code

M98 - Sub Program Call

Starts a subprogram.

M99 CNC M Code

M99 - End of Sub Program

Ends a subprogram.

Frequently Asked Questions

What are M codes used for in a CNC program?

M codes are used for turning miscellaneous functions on and off such as the spindle and coolant.

What is the difference between G and M codes?

M codes turn things on and off while G codes switch modes in the machine such as working in inches or mm.

G codes also prepare the machine for functions such as canned cycles for drilling or boring holes.

What other types of CNC codes are used?

There are many other CNC codes that get used such as:

  • Location based codes such as A, B, C, I, J, K, X, Y & Z
  • Machine related codes such as F, R & S
  • Offset related codes such as D, H & T
  • Program related codes such as G, N, O, P & Q 

Ultimate Guide to CNC G Codes

G codes for CNC machines are preparatory commands.

This means that they set modes or prepare the machine for various actions. 

We have put together a complete list G codes for your reference. Not all are commonly used so we have listed the codes that are rarely used to help you concentrate on the most important and most often used G codes.

Moves the CNC around at the maximum possible speed. Often called rapid traverse.

Learn more about the G00 command

Move the CNC in a straight line to a specific location. The speed of this movement is determined by the feed rate (F).

Learn more about the G01 command

Move the CNC to specific location along along a specified radius traveling clockwise. The speed of this movement is determined by the feed rate (F).

Learn more about the G02 command

Move the CNC to a specific location along a specified radius traveling counterclockwise. The speed of this movement is determined by the feed rate (F).

Learn more about the G03 command

Tells the CNC not to move for a certain amount of time.

Learn more about the G04 command

G09 CNC G Code

G09 - Exact Stop Check (Non-modal)

Causes the machine to come to a stop after each command. Useful for making sharp corners. It causes the machine to stop after executing the current line.

G10 CNC G Code

G10 - Programmed Offset Input

Adjusts offset values. Can change work offset, tool length offset and/or cutter compensation offsets.

G17 CNC G Code

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.

G18 CNC G Code

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.

G19 CNC G Code

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.

G20 CNC G Code

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

Learn more about the G20 command

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

Learn more about the G21 command

G22 CNC G Code

G22 - Stored Stroke Limit

Turns on a set safety zone that will cause the machine to alarm out if it enters.

G23 CNC G Code

G23 - Stored Stroke Limit Cancel

Turns off the stored safety zone.

G27 CNC G Code

G27 - Zero Return Check

Rarely used. This command checks to see that the machine has moved to the zero return position.

G28 CNC G Code

G28 - Zero Return

The machine will move to a specified location and then to the zero return (home) position.

G29 CNC G Code

G29 - Return From Reference Position

The machine will move to the position referenced in the last G28 command. It will then move to the location referenced with the G29 command.

G30 CNC G Code

G30 - Second Position Zero Return

Similar to G28 the machine will move to a specified location and then will move to a secondary reference point in the machine such as a tool changer location.

G31 CNC G Code

G31 - Skip Function

Often used with probing, it is used to move the probe until it hits an object.

G40 CNC G Code

G40 - Cancel Cutter Compensation

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

G41 CNC G Code

G41- Cutter Compensation Left

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

G42 CNC G Code

G42 - Cutter Compensation Right

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

G43 CNC G Code

G43 - Tool Length Compensation

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

G44 CNC G Code

G44 - Negative Tool Length Compensation

Rarely used. Adjusts a tool’s location based on a specified height (H) offset in the opposite of the normal direction.

G45 CNC G Code

G45 - Single Offset Increase

Rarely used.

G46 CNC G Code

G46 - Single Offset Decrease

Rarely used. 

G47 CNC G Code

G47 - Double Offset Increase

Rarely used.

G48 CNC G Code

G48 - Double Offset Decrease

Rarely used.

G49 CNC G Code

G49 - Tool Length
Compensation Cancel

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

G50 CNC G Code

G50 - Cancel Scaling

Turns off scaling mode.

G51 CNC G Code

G51 - Scaling

Scales the machined part size by a scaling factor.

Scaling factors >1 make it bigger. Scaling factors <1 make it smaller.

G52 CNC G Code

G52 - Temporarily Shift Program Zero

Shifts the program zero location based on a location specified with the command.

G53 CNC G Code

G53 - Return to Machine Zero Position

Rapid moves the CNC to the machine reference position.

G54 CNC G Code

G54 - Work Offset 1

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

G55 CNC G Code

G55 - Work Offset 2

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

G56 CNC G Code

G56 - Work Offset 3

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

G57 CNC G Code

G57 - Work Offset 4

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

G58 CNC G Code

G58 - Work Offset 5

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

G59 CNC G Code

G59 - Work Offset 6

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

G60 CNC G Code

G60 - Single Direction Move

Forces the machine to approach each XY location from the same direction. Helps eliminate location errors caused by machine backlash.

G61 CNC G Code

G61 - Exact Stop Check (Modal)

The machine will come to a stop after each line of code. 

G64 CNC G Code

G64 - Normal Cutting Mode

Cancels both G60 and G61 modes.

G65 CNC G Code

G65 - Custom Macro Call

A macro is similar to a subprogram but it allows you to use variables in the program.

G66 CNC G Code

G66 - Custom Macro Modal Call

Makes the machine call a macro, similar to G65, with every new location given until turned off.

G67 CNC G Code

G67 - Cancel Custom Macro
Modal Call

Cancels any active custom macro modal calls.

G68 CNC G Code

G68 - Coordinate Rotation Mode

Rotates the machine coordinates at a given angle around a specified location.

G69 CNC G Code

G69 - Cancel Coordinate Rotation Mode

Turns off coordinate rotation mode.

G73 CNC G Code

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.

G74 CNC G 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.

G76 CNC G Code

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.

G80 CNC G Code

G80 - Canned Cycle Cancel

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

G81 CNC G Code

G81 - Standard Drilling Cycle

Drills a hole then rapid retracts out of the hole.

G82 CNC G 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.

G83 CNC G 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.

G84 CNC G 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.

G85 CNC G Code

G85 - Reaming Cycle

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

G86 CNC G 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.

G87 CNC G Code

G87 - Back Boring Cycle

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

G88 CNC G Code

G88 - Boring Cycle with Dwell

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

G89 CNC G Code

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.

G90 CNC G Code

G90 - Absolute Mode

All movement locations are relative to the work offset (G54, G55, etc.)

G91 CNC G Code

G91 - Incremental Mode

All movement locations are relative to the current position.

G92 CNC G Code

G92 - Program a Work Offset

Sets a work offset based on a specific location in the machine.

G94 CNC G Code

G94 - Feed per Minute Mode

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

G95 CNC G Code

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.

G96 CNC G Code

G96 - Constant Surface Speed

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

G97 CNC G Code

G97 - Constant Spindle Speed

The spindle will operate at a consistent RPM.

G98 CNC G Code

G98 - Return to Initial Plane

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

G99 CNC G 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.

Frequently asked questions

How many G codes are there?

We listed 70 G codes in our list alone but in reality there are many more. 

Some will have different meanings on lathes vs mills. Also, different CNC controller manufacturers will include their own special codes. For example, some will have codes such as G103 or they will switch the meaning of a code.

You should always know how your individual machine will react to a specific code. 

What other types of codes are used in CNC programming?

There are numerous codes other than G codes used in CNC programming. 

There are codes for locations, speeds, feeds and machine operations among others. For the most common codes, review our posts on CNC codes and M codes.

Who needs to know G code?

Anyone who works with a CNC machine would benefit from understanding G code. 

While it may not be a requirement for their job depending on where they work, these positions would benefit from understanding G codes:

  • CNC operator
  • CNC setup
  • CNC programming
  • CNC machinist

Is learning G code hard?

Learning G code can be a daunting task when there are so many codes to understand. 

While it is true that there are a lot of codes that can be used, you should know that most shops will only use a small selection of codes which cuts down the number you need to understand before you are up to speed.

Don’t be overwhelmed. Figure out which codes are the most commonly used ones and start your learning there.

What is a G01 Code? [With Lots of Examples]

a graphic of a cnc machine with text that says learn g code today g01 linear interpolation

The information below is meant for beginners. If you are experienced with CNC programming, then you probably already know this stuff and much more. If you are new to CNC programming, this is the place for you.

Please note that some of the topics below could include more information on the subject. However, in the interest of keeping things simple for those just starting out, they have been left out of this G code guide.

Ready to learn? Let’s go.

Code

G01

Name

Linear movement

Type

Modal - stays on until changed

Description

Straight line movement at a specified feed rate

What does a G01 code do?

A G01 code is a linear movement CNC G code. It is used to move the CNC table and/or spindle.

When to use a G01 code?

G01 codes will usually be in the lines of the program that are used to cut the part. The G01 code allows the programmer to specify where the tool will move to. Feed rate (F) and spindle speed (S) codes are used together with a G01 code to specify the feed rate and spindle speed.

The location movement, speeds, and feeds are the main factors that influence your cut.

What to think about when using a G01 code?

Units

First, make sure you know what units you are working in. Moving 10 inches instead of 10 millimeters is a big difference. A G20 (inches) or G21 (mm) code should identify the units you are working in before your G01 code.

comparison of units of measurement for cnc programming

Absolute vs incremental mode

The second thing to look for is whether you are working in absolute (G90) or incremental (G91) coordinates. The most recent G90 or G91 code in the program will determine which mode you are in.

Absolute coordinates will move from a set zero location such as your machines home location or a specified location on your part.

Incremental coordinates will move relative to your current position. See our posts on G90 and G91 codes to learn more about the differences between absolute and incremental coordinates.

Start and stop locations

Lastly, make sure you understand where you are currently position wise (X, Y & Z location), where you will be moving to and if there is anything in between the two locations.

The G01 code will move the machine in a straight line to your new location. You don’t want anything in the way or to miscalculate your stop point. Clamps or vises can be easy to forget about and run into. Crashing your machine is never a good time.

6 G01 code examples and descriptions of what they do

For the examples below, we will assume your machine is in absolute mode (G90). If you are working in incremental mode (G91), the resulting movements will be different. Check out our guides to G90 and G91 G codes to understand the difference between the two movement types.

Example #1

N015 G01 X7.0 Y5.0 Z3.0

This is line number 15 of the program.

G01 sets the movement mode as linear (straight line).

X7.0 Y5.0 Z3.0 is the location the machine will move to. If the Z location of the machine was already at 3.0, then the Z axis will not move. This is the same for each axis.

Example #2

N070 G01 X6.0 Y2.0

This is line number 70 of the program.

G01 sets the movement mode as linear (straight line).

X6.0 Y2.0 is the location that the machine will move to. The Z axis of the machine will not change and remain at the location it was previously set at.

Example #3

N120 G01 Y2.5 Z1.0

This is line number 120 of the program.

G01 sets the movement mode as linear (straight line).

Y2.5 Z1.0 is the location that the machine will move to. The X axis of the machine will not change and remain at the location it was previously set at.

Example #4

N020 G00 Y4.0

This is line number 20 of the program.

G01 sets the movement mode as linear (straight line).

Y4.0 is the location that the machine will move to. The X and Z axes of the machine will not change and remain at the location they were previously set at.

Example #5

N100 G01

This is line number 100 of the program.

G01 sets the movement mode as linear (straight line).

There is no location specified on this line. The machine will not move based on this code line.

Example #6

N256 G01 X8.0

This is line number 256 of the program.

G01 sets the movement mode as linear (straight line).

X8.0 is the location that the machine will move to. The Y and Z axes of the machine will not change and remain at the location they were previously set at.

CNC codes that are similar to G01

a comparison of the type of movement created with G00, G01, G02 and G03 cnc g codes

Note that all the movement codes listed below are modal. This means they will stay in the movement mode identified by the code until switched to a different mode.

Beginner’s Guide to Blueprint Reading

Learning to read blueprints can be hard. That’s why we’ve broken down the process into bite size chunks. All of the basic components of an engineering drawing are detailed below with links throughout to give you more info on each subject.

Use the table of contents below to jump straight to your topic of choice and if you don’t find what you are looking for please leave a comment at the bottom and we will tackle any blueprint related questions we may have missed.

Components of a drawing

Title block

title block example
Title block example

A blueprint title block contains the high-level identification information. The title block of a blueprint can vary quite a bit across different companies. In general, the title block can be found in the bottom right of the blueprint and will include the following:

  1. Drawing or part number and revision
  2. Part name
  3. Company name
  4. 1st or 3rd angle projection
  5. Scale

Tolerance block

tolerance block example
Tolerance block example

The tolerance block, sometimes referred to as the general tolerance block, is usually located in the bottom right or bottom middle section of the blueprint. The tolerance block identifies the tolerances associated with dimensions that are not directly listed on the drawing.

This can include items such as the blueprint dimensional units (imperial or metric) or surface roughness requirements.

Units of measurement

The units of the print are very important because there is a huge difference between 25.4mm and 25.4 inches. The measurement units will often be called out in the title block or tolerance block but occasionally will be in another section of the blueprint such as in the notes.

Angular units are important also but there is usually less confusion associated with them because decimal degrees and degrees, minutes, seconds are so different.

Types of projections

Projections are different ways of representing parts on a blueprint. Basically this means there are different methods of showing the same part.

1st angle projection, sometimes referred to as the European convention, is a method of displaying the various views of the part as if the part has been flipped to each side.

Notice how the car is flipped below in each view of a 1st angle projection blueprint.

1st angle projection car example
1st angle projection example - click to enlarge

3rd angle projection, the American convention, is a method of displaying the various views of the part as if the part is placed in a bowl and rolled in the bowl to the other views.

Notice how the car is flipped below in each view of a 3rd angle projection blueprint.

3rd angle projection example - click to enlarge

Projections can be hard to describe in words. Just remember that 1st angle projections are a flop method and 3rd angle projection is a roll method. 

Types of tolerances

There are multiple ways of tolerancing a dimension. Below are the ways of directly dimensioning a feature with standard tolerances. GD&T tolerances are a separate topic altogether.

Limit tolerances

limit tolerance example
Limit tolerance example

Limit tolerances list a range that the dimension must fall within. No calculation needed. Simply keep it between the numbers.

Unilateral tolerances

unilateral tolerance blueprint example
Unilateral tolerance example

Unilateral tolerances are given when the allowable variation is in a single direction such as the example below. In this example, the part cannot have a diameter that is over 6mm.

Bilateral tolerances

bilateral tolerance blueprint example
Bilateral tolerance example

Bilateral tolerances, often referred to as plus or minus tolerances, have a nominal size and a tolerance in the positive and negative directions. Often this tolerance will be equal in both directions, but it doesn’t have to be. Sometimes you will see bilateral tolerances that allow more variation in one direction.

Notes section

Notes on a blueprint can have a huge impact on the component requirements. The notes are often where surface treatment requirements such as heat treating, anodizing and other similar requirements are documented.

Literally anything can be listed in the notes section and the items listed can have a large bearing on the complexity of the part.

Pay attention to your notes section, there are often critically important features and characteristics relative to the part listed.

Symbols

A wide range of symbols are used to create engineering drawings. There are also specialty blueprint symbols associated with items such as welding or electronic components, but I will only be covering the standard blueprint symbols including those related to geometric dimensioning and tolerancing (GD&T).

Center lines

Center lines, such as the center of a thru hole are depicted on a drawing with long and short lines spaced alternately.

In the example below, the centerlines are shown as blue lines.

hidden and center line blueprint example
Center lines and hidden lines example

Hidden lines

To show features in a blueprint view that would not actually be visible, hidden lines are used. These hidden lines are show on a drawing as lines made of dashes.

In the example above, the hidden lines are shown as red lines

Diameters

Diameter Blueprint GD&T Symbol o with line through it
Diameter symbol

Diameters are round or cylindrical features. Features such as the outside diameter of a part and the size of a hole or counterbore are examples of diameters. They will be referenced using the diameter symbol shown below.

Countersinks

Countersink Blueprint GD&T Symbol two lines pointing down
Countersink symbol

Countersinks are a chamfer on a hole that allows a fastener such as a screw to sit flush or below the part surface. The blueprint symbol for a countersink is shown below.

countersink blueprint example
Countersink callout example

Counterbores

Counterbore Blueprint GD&T Symbol u shape
Counterbore symbol

A counterbore is a circular hole that is deep enough to allow the head of a fastener to be recessed. Counterbores will be shown on a blueprint with a diameter and depth symbol associated with them.

counterbore blueprint example
Counterbore callout example

Radii

Radius callout example

Radii show up on prints for many different reasons. The most common application of a radius is to specify the maximum radius allowed in the bottom of a slot or hole. They are frequently used as a form of edge relief similar to a chamfer. While these are the most common radius uses, radii can be dimensioned for all kinds of internal and external features.

When a radius smoothly blends into a surface, it will occasionally be called out as a full radius or full R. A full R callout does not change the way a radius is measured or add any additional requirements.

Holes

thru hole blueprint example
Hole callout example

Holes are about as simple as they come. They come in two varieties, thru holes and blind holes. When shown on a drawing they will usually be referenced by their size and location to the center of the hole.

Datums

Datum Blueprint GD&T Symbol a in a box with arrow
Datum symbol

Datums are reference points for measurements and are utilized in many GD&T callouts. You will find datums shown on a drawing to identify the feature as a datum or as part of a GD&T callout in a feature control frame.

GD&T Symbols

gd&t symbols
gd&t symbols

Basic dimensions

Basic Dimension Blueprint GD&T Symbol dimension in a box
Basic dimension example

Basic dimensions are the theoretically perfect size or location of a part feature. The variation from this “perfect” size or location will be used to measure another characteristic of the part such as true position or profile. Basic dimensions do not have a tolerance themselves and instead are controlled by another GD&T callout.

Reference dimensions

Reference Dimension Blueprint GD&T Symbol dimension in parentheses
Reference dimension example

Reference dimensions are just what they sound like. They are placed on a print for reference only. They have no requirements associated with them and no tolerances either. They generally get used in one of two ways, they will be used to highlight something that might not be immediately clear without the reference dimension listed or they will be used to show the approximate dimension in another unit system (metric vs imperial units).

Chamfers

chamfer callout blueprint example
Chamfer callout example

Chamfers are used to remove the sharp edges of a part. This provides safety for both the part and the person using the part. Chamfers are frequently specified in many different places. They can be listed directly on the part, in the notes section or in the general tolerance block.

When the chamfers are small, at times they will be listed as a break edge.

Spotfaces

spotface example on mechanical blueprint drawing
Spotface callout example

Spotfaces are a small counterbore that is machined so that a fastener can sit flat on the part. They are essentially just shallow counterbores and will be dimensioned as such.

Bolt hole circles

basic dimensions for a bolt hole circle
Bolt hole circle callout example

A bolt hole circle will be shown on a print using multiple dimensions. This will include the size of the individual holes, the angle between the center of the bolt hole circle and the individual holes along with the size of the bolt hole circle itself.

Knurling

knurling blueprint callout examples
Knurling callout examples

Knurling is a textured pattern on a part. It is added for visual appeal or added grip. Knurls will be called out by the pitch, diameter, and type of knurling.

Surface finish/surface roughness

Surface Finish Blueprint GD&T Symbol check mark
Surface finish/roughness symbol

The surface finish quality is specified with the use of a check mark on the surface. The number above the start of the check is the required surface finish. If there are two numbers present, the surface roughness must fall within the range specified. If only one number is specified, the surface roughness must be less than or equal to the specified value.

Surface finish requirements are frequently specified directly on the applicable surfaces as well as in the notes section and general tolerance block.

Threads

Threads will be specified in either the ISO metric format or Unified National Coarse (UNC) thread format. This article clarifies the details of thread callouts.

Want to learn more?

GD&T is a complicated subject and understanding it correctly can be the difference between a perfect part and scrap.

The best way to learn GD&T is from experienced teachers who can break down the material into manageable pieces.

Luckily, we know someone.

And MachinistGuides.com readers get an exclusive discount on training!

Related articles

Complete Guide to Machining Blueprint Symbols

Common Blueprint Symbols

nominal size dimension with a tolerance

Nominal Size

In the example shown, 24 is the nominal size. It is the size that the tolerance envelope is based on. A reference/starting point.

plus or minus symbol

Plus or Minus

Plus or minus is the most common tolerance type. They are less common, but tolerances can be all negative, all positive or +/- with enequal sizes such as +3/-2.

45 degrees

Degree Symbol

The symbol used to callout angle requirements.

Reference dimensions are shown in parentheses. They are provided for informational use only. They are not size requirements but often help make the print easier to understand.

Symbols For Features

Radius Blueprint GD&T Symbol r

Radii

Half of a circle. The distance from the center of a circle to the edge.

Diameter Blueprint GD&T Symbol o with line through it

Diameters

The distance all the way across a circle. Two times the radius. This symbol gets used with other symbols as well such as counterbores, countersinks, and true position callouts.

Depth Blueprint GD&T Symbol line with arrow pointing down

Depth of

This symbol specifies the depth of a feature.

A counterbore is a flat bottomed, recessed hole.

Countersinks are a round, angled feature added to a hole. They are often used to allow a screw head or other fastener to sit flush with the surface.

A spotface is  a shallow counterbore that allows a fastener to sit straight. The symbol has a few variations that get used. Often the counterbore symbol portion is left out and the SF is used only.

Surface Finish Blueprint GD&T Symbol check mark

Surface Texture

A symbol for defining the surface finish of a part. There are many variations of the surface texture symbol but most often it is used with a microinch or micrometer value callout that specifies the roughness of a surface.

Symbols Used In GD&T Callouts

Basic dimensions represent a  theoretically perfect feature or size. They are shown enclosed in a box and are the basis for many GD&T callouts.

Datums are features that are used to locate a part for measurement. 

Feature control frames contain a geometric dimensioning and tolerance callout.

The example shown reads, the feature is perpendicular to within 0.001 to datum A.

GD&T Symbols

Symbols For Roundness

Circularity Blueprint GD&T Symbol circle

Circularity

Otherwise known as roundness. Circularity only applies at one location. You might check the roundness of a hole at a specific depth.

Cylindricity Blueprint GD&T Symbol circle with two lines coming off it

Cylindricity

Cylindricity is roundness but over all locations of a feature. Cylindricity of a hole would mean the hole must be round at all points.

Symbols Used for Flat Things

Straightness Blueprint GD&T Symbol line

Straightness

A straightforward requirement. The feature must be a straight line within the specified tolerance.

Flatness Blueprint GD&T Symbol parallelogram

Flatness

Similar to straightness but over a whole surface. The high and low of a surface must be within the specified tolerance of each other.

Symbols Used to Control Angles

Perpendicularity Blueprint GD&T Symbol two lines perpendicular to each other

Perpendicularity

Two features must be 90 degrees to each other.

Parallelism Blueprint GD&T Symbol two parallel lines

Parallelism

Two features must run together (180 degrees to each other).

Angularity Blueprint GD&T Symbol two lines at an angle

Angularity

Angularity is used when two features must be have a specific angle between them and the angle between the features is not 90 or 180 degrees.

Symbols Used for Profile

Profile of a Line Blueprint GD&T Symbol half circle not connected

Profile of a Line

Profile of a line controls the shape of a feature. Imagine it as controlling the outline of a feature.

Profile of a Surface Blueprint GD&T Symbol half circle

Profile of a Surface

Profile of a surface controls the shape of a feature but instead of controlling it in one location like profile of a line, it applies to the entire feature surface.

GD&T Symbols That Control Location of a Feature

True Position Blueprint GD&T Symbol target

True Position

Controls location of a feature based on the variation from the basic dimensions.

Concentricity Blueprint GD&T Symbol two concentric circles

Concentricity

A requirement that the centerline or axis of two features are located together. 

Symmetry Blueprint GD&T Symbol three lines

Symmetry

A requirement that a feature must be evenly located based on another feature. Centered based on a feature or location.

Runout Blueprint GD&T Symbol single arrow

Circular Runout

Controls how even a surface is when spun in a circle. 

Total Runout Blueprint GD&T Symbol two arrows

Total Runout

The same as circular runout but at all locations on the feature. Circular runout and total runout have a relationship similar to circularity and cylindricity.

Symbols That Change Tolerance

Maximum Material Condition Blueprint GD&T Symbol m in a circle

Maximum Material Condition

A modifier that can give bonus tolerance based how close or far the features are from nominal size.

Least Material Condition Blueprint GD&T Symbol l in a circle

Least Material Condition

A modifier that can give bonus tolerance based how close or far the features are from nominal size.

Projected Tolerance Zone Blueprint GD&T Symbol p in a circle

Projected Tolerance Zone

Used when a tolerance zone applies outside the boundaries of the physical part.

Regardless of Feature Size Blueprint GD&T Symbol s in a circle

Regardless of Feature Size

The tolerances do not change based on the size of the features. This is the default spec and any tolerance is assumed to be regardless of feature size even if the symbol is not used.

Unequally Disposed Profile Blueprint GD&T Symbol U in a circle

Unequally Disposed Tolerance Zone

Profile tolerance zones are normally centered on the nominal dimensions. When this is not the case, the unequally disposed tolerance symbol is used to move the tolerance zone based off the nominal dimensions.

Want to learn more?

GD&T is a complicated subject and understanding it correctly can be the difference between a perfect part and scrap.

The best way to learn GD&T is from experienced teachers who can break down the material into manageable pieces.

Luckily, we know someone.

And MachinistGuides.com readers get an exclusive discount on training!

Guide to Holes on Blueprints [Types, Symbols & Features]

Hole types

blind holes blueprint example
3 blind holes specified

Blind holes are holes that get drilled or milled to a specified depth but do not go all the way through the part.

thru hole blueprint example
Thru hole example

Thru holes

Thru holes get drilled all the way through a part.

They can be specified as “thru” as shown in the example or the blueprint can make it clear visually that the hole goes all the way through the part.

cutaway example of blind and thru holes
3 blind holes and 1 thru hole

Blind holes vs thru holes

This picture of a part cut in half shows the difference between a thru hole and a blind hole. The three holes on the left are blind holes which do not break through to the other surface.

The thru hole on the right goes all the way through the part.

Symbols used to dimension holes

Diameter Blueprint GD&T Symbol o with line through it
Diameter symbol

Diameter

The diameter of the hole is the size. The diameter is the distance across the hole.

Radius Blueprint GD&T Symbol r
Radius symbol

Radii

Less often, holes are specified with a radial dimension instead of a diameter. The radius is the distance from the center of the hole to the edge of the hole. This is equal to 1/2 of the diameter.

Depth Blueprint GD&T Symbol line with arrow pointing down
Depth symbol

Depth

The depth of the hole is the distance that it is drilled to. 

Features associated with holes

Counterbore Blueprint GD&T Symbol u shape
Counterbore symbol

Holes often get counterbores that allow a fastener such as a bolt head to be recessed. 

Holes with a counterbore will specify the size and depth of the hole as well as the size and depth of the counterbore.

Countersink Blueprint GD&T Symbol two lines pointing down
Countersink symbol

Countersinks get added to holes as either a way to specify a chamfer for protective purposes or to allow a fastener such as a screw head to be recessed.

Holes with a countersink will specify the size and depth of the hole as well as the size and angle of the countersink.

Spotface Blueprint GD&T Symbol SF in a u
Spotface symbol

Spotfaces are functionally no different than a counterbore. They are machined on a part to allow a fastener to sit flush, though not always completely recessed.

Holes with a spotface will specify the size and depth of the holes as well as the size and depth of the spotface.

Note: spotfaces are not always specified with the symbol shown. At times, they will only use the counterbore symbol and other times they will use the SF notation only.

Want to learn more?

GD&T is a complicated subject and understanding it correctly can be the difference between a perfect part and scrap.

The best way to learn GD&T is from experienced teachers who can break down the material into manageable pieces.

Luckily, we know someone.

And MachinistGuides.com readers get an exclusive discount on training!