Quick Guide to the G28 CNC G Code [Tips and Tricks]

a graphic of a cnc machine with text that says learn g code today G28 zero return

When it comes to the machining, safety should always be the top concern. Assuring safety at all times involves taking good care of the CNC operator, the workpiece, the machine, and any tooling or fixtures.

That is why it is important to pay close attention and fully understand how the G28 command works.

What does a G28 code do?

The G28 command tells the CNC machine to rapid move to a chosen reference point and then rapid move to the machines zero position in one or more axes.

This command is useful when you want to do a tool change or similar function during a program and want to avoid things that might be in the way of a direct rapid move to the zero position.

Using the G28 code can allow you to move your cutter to a safe position and then directly from the safe position to the machine zero position. This lets you make sure you don’t run into the part or any tooling or fixtures in the machine when returning to the zero position.

Because the G28 command is used for safety purposes, you will find it in many CNC programs.

When to use a G28 code?

a cnc mill with multiple fixtures and coolant lines
G28 helps you avoid fixtures like these

G28 codes get used when you want to send the machine to a known position. This is often a “safe” position which means the machine is clear of any parts or tooling and is out of the way of any machine functions such as a tool or pallet change.

You will find G28 codes near the end of a section of code. This is because the code is used to prepare the machine for the next section of code.

What to think about when using a G28 code

illustration of a cnc machine crashing because it didn't retract
This move doesn't use a G28 code to move to a safe point before retracting and it crashes into the side of the part

The main things to think about when using the G28 are picking the right point to travel to that creates a safe straight line to the zero position and how many of the axes you are going to return to the zero position.

When you pick the point, you want to make sure that it doesn’t add too much extra travel because that will add extra time to machine each part.

With that in mind, the best way to avoid collisions is to move the Z-axis first. You will want to move the cutter up and away from the workpiece. This is why you will often see a G28 code that only sends the Z axis to the zero position.

All axes that are used with the G28 code will be sent to the machine zero position.

graph paper example of absolute positioning with multiple points as examples
G90 = Absolute Posititioning
graph paper example of incremental positioning with multiple points as examples
G91 = Incremental Positiioning

In most CNC programs, when using a G28 command you will also use a G91 code on the same line.

The G91 code sets the machine to incremental positioning. This means the machine will take each new location value as distances from the machine’s current location.

The other type of positioning is absolute positioning which bases locations off the workpiece zero. The workpiece zero is usually the center or a corner of the part.

Both positioning modes are modal which means they will stay in effect until switched.

If you use G28 without also using G91, it is possible that your CNC is in absolute positioning mode. This could cause a crash if you aren’t careful.

illustration of a cnc machine that shows how the machine moves when using a g28 code
G28 G91 X0 Y0 Z2.0 - This move moves the machine incrementally up 2.0 and then retracts all axes to the zero position

It is easier to move incrementally when you want to retract the cutter.

A simple code can be used to move the cutter two inches up in the Z axis and know that you are safe to travel to the zero position.

If you are in absolute positioning mode, you would need to calculate the XYZ location of the move. Moving incrementally makes the move as simple as a Z move only.

The main portion of a CNC program is often written in absolute positioning mode. This is why it is important to switch to incremental mode and also to switch back to absolute mode once you are done moving incrementally.

Is G28 a modal command?

No, G28 is not modal. Modal commands stay in effect until changed, such as a G20 (inches) or G21 (mm) code.

G28 only affects the line it is on. It is a very simple canned cycle with two steps.

Step one = move to the intermediate position.

Step two = move to the machine zero position.

Common modal commands

Code

Name

G00

Rapid Motion

G01

Linear Interpolation

G02

Circular Interpolation, Clockwise

G03

Circular Interpolation, Counter-Clockwise

G17

XY Plane

G18

XZ Plane

G19

YZ Plane

G20

Inch Mode

G21

Metric Mode

G41

Cutter Compensation, Left

G42

Cutter Compensation, Right

G43

Tool Length Compensation

G54-G59

Work Offsets

Various Canned Cycles

Hole Drilling, Reaming, Boring, etc.

G28 vs G53

The G53 code is a very similar command to G28.

Remember that we talked about the two positioning modes, absolute and incremental positioning. The G53 command sets a different type of positioning mode. G53 sets the positioning mode as relative to the machine’s coordinates.

This means the X0Y0Z0 location will be the machine’s zero return position. This also makes it easy to locate a secondary tool changer or a safe location for a pallet change.

One key difference when compared to the other positioning modes is that the G53 code is not modal. This means the machine will move relative to the machine coordinates but only for the line in which the G53 code appears.

G53 is a very handy code and often is safer than using a G28, but not all machines will accept a G53 code. G28 can be used on just about any CNC machine.

When figuring out whether you should use a G28 or G53 code, the best thing is to do is be consistent so that no one gets confused. It will be better for everyone involved, including operators, programmers, and setup personnel, if they only have to remember to use one code.

Keep it simple and if all your machines don’t accept G53 then stick with using G28 for consistency.

G28 vs G28.1

The G28.1 command sets the location that the machine will go to when the G28 command is used.

The location set by the G28.1 code will be used instead of the machine zero position when a G28 command is used.

G28 codes examples with descriptions of what they do

G28 X0 Y0 Z0

This line of code returns all 3 axes (X, Y and Z) of the CNC machine to the zero reference position. This point is often called the home position.

If the positioning mode is set to incremental (G91), the machine will go straight to the zero return position.

If the positioning mode is set to absolute (G90), the machine will go to the work offset (G54) zero location. This could often result in a machine crash.

G28 U0 W0

This line of code is often used for CNC lathes. U0 & W0 are incremental moves in the X and Z axis. Because these incremental moves are zero, the machine will move directly to the machine zero position. 

cnc lathe cutting threads on part
CNC lathe cutting threads

G28 G91 Z0

This line of code sets the positioning mode as incremental with the G91 command. The Z0 means that the machine will move 0 units in the Z axis which means it won’t move and then the machine will return to the zero position.

G28 G91 X0 Y0 Z35.0

This line of code is very similar to the one above with the exception that the Z axis will move 35 units in the positive Z axis and then return to the zero position.

CNC codes that are similar to G28

There are different ways to return to the reference point and as explained before, G28 and G53 are very similar codes that allow users to achieve the same goal.

Both are safe retracts and home positioning commands that not only help protect the machine but also help protect the workpiece and/or any tooling that could be damaged.

The G28 code and other similar codes also have the benefit of making the program look clean and neat.

This is very important because a clear and easily read piece of code helps anyone who might be using the program.

Remember that it might be some time between before the program gets run again which gives you plenty of time to forget everything you knew about that specific program. This is also one of the reasons that it is recommended to include comments in your program so that it is easier to follow along and understand the code.

Want to learn more about G Code for your CNC?

Quick Guide to the G03 CNC G Code [Tips and Tricks]

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

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 counterclockwise 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 know is how the machine will understand position locations.

This is determined by 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 positioning will move from a set zero location such as your machines home location or a specified location on your part.

Incremental positioning will move relative to your current position. 

The images below show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location. 

In incremental mode locations, all locations are relative to the machine’s current location.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

Start and stop locations

Lastly, make sure you understand the path that the tool will take from it’s start location to the new location.

Check  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.

Want to learn more about G Code for your CNC?

Quick Guide to the G02 CNC G Code [Tips and Tricks]

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

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 clockwise 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 know is how the machine will understand position locations.

This is determined by 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 positioning will move from a set zero location such as your machines home location or a specified location on your part.

Incremental positioning will move relative to your current position. 

The images below show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location. 

In incremental mode locations, all locations are relative to the machine’s current location.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

Start and stop locations

Lastly, make sure you understand the path that the tool will take from it’s start location to the new location.

Check  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.

Want to learn more about G Code for your CNC?

Quick Guide to the G00 CNC G Code [Tips and Tricks]

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

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. G00 controls the speed of the machines motion.

It is used to move the CNC table and/or spindle around in a straight line (linearly) at the maximum speed. When the G00 code is used, the machine ignores any set feed rate and goes as fast as possible.

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 command moves the machine quickly to decrease the time it takes to run a CNC program (cycle time)

It does this by moving full speed when there is no cutting motions being performed on the workpiece, such as when performing a tool change.

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 positioning mode

The second thing to know is how the machine will understand position locations.

This is determined by 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 positioning will move from a set zero location such as your machines home location or a specified location on your part.

Incremental positioning will move relative to your current position.

The images below show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location. 

In incremental mode locations, all locations are relative to the machine’s current location.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

Machine movement

Know your machine. Some machines will move all 3 axes at once. Some won’t.

Others will move a single axis at a time. Most machines will move all 3 at once but make sure you know the path your CNC will take when using the G00 code.

Start and stop locations

Lastly, make sure you understand the path that the tool will take from it’s start location to the new location.

Check  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.

G00 vs G01

G01 is a very similar command. It also controls straight line movement, otherwise known as linear interpolation, of the CNC machine. 

The difference is that G01 will not move at maximum speed and will instead move at the last feed rate listed in the CNC program using the F command.

G01 is used for cutting motions. G00 is not.

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.

Want to learn more about G Code for your CNC?

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 

Quick Guide to the G01 CNC G Code [Tips and Tricks]

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

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?

G01 is a CNC g-code for straight line movement, otherwise known as linear interpolation. 

The G01 code is used to move the CNC table and/or spindle around at a feed rate specified with the F command.

When to use a G01 code?

G01 codes are found in the lines of the program where the material is being cut. 

The G01 code allows the programmer to specify the location where the tool will move to. 

Feed rate (F) and spindle speed (S) codes are used together with a G01 code to specify the feeds and speeds.

The location movement, speeds, and feeds are the main factors that influence the quality of 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 identifies the units you are working in when making a move with your G01 code.

comparison of units of measurement for cnc programming

Absolute vs incremental mode

The second thing to know is how the machine will understand position locations.

This is determined by 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 positioning will move from a set zero location such as your machines home location or a specified location on your part.

Incremental positioning will move relative to your current position.

The images below show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location. 

In incremental mode locations, all locations are relative to the machine’s current location.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

Start and stop locations

Lastly, make sure you understand the path that the tool will take from it’s start location to the new location.

Check  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.

G01 vs G00

G00 is a straight line movement code similar to G01.

There is one big difference between the two codes.

G01 uses the feed rate specified with the F command to determine how fast the machine moves. 

G00 moves at the machines maximum speed. G00 is not affected by the feed rate command (F).

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.

Want to learn more about G Code for your CNC?

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!