Quick Guide To The G01 CNC G Code [Tips And Tricks]
Welcome to our comprehensive guide to using the G01 CNC code. Whether you’re a beginner learning CNC programming or an experienced machinist, understanding the G01 CNC code is extremely important.
In this guide, we’ll break down everything you need to know about this linear interpolation command, including how, when, and why to use it.
What does a G01 code do?
G01 sets the CNC movement mode to straight line movement, otherwise known as linear interpolation.
The G01 code is used to move the CNC axes (X, Y, & Z) around in a straight line around at a feed rate specified with the F command.

G01 is a modal command which means it will stay on until switched to another code in the same movement group of codes such as G00 – Rapid travel or G02 – Clockwise circular interpolation.
Ready to master CNC programming?
Try the free 30 minute intro course to see how simple and easy G code can be. Take the shortcut to becoming a G Code Master today!
View Free G Code CourseG01 vs G1: Clearing the Confusion
Some people get confused about whether the 0 is required to be included in a G01 code.
To clear this up, there is no need to include the extra zero in the code. The CNC machine will read the code the same. It really is just a matter of preference.
Often you will see the full G01 code used in textbooks or other reference materials. In practice though, many prefer the shortened G1 code in their programs.
If you are working on your own, then go with whichever format you prefer. If you work in a bigger shop, make sure to stick to the format that the business has been using.
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.
Other codes used with G01
The codes below are used with the G01 code or commonly found very close to a G01 command in a CNC program:
- M03 – Spindle on, clockwise
- M05 – Spindle stop
- M06 – Tool change
- M08 – Flood coolant on
- M09 – Coolant off
- N – Program line number
- S – Set spindle speed
- X – X axis location of the hole
- Y – Y axis location of the hole
- Z – Z axis location of the bottom of the hole
Format for using a G01 code
G01 X1.0 Y2.0 Z3.0 F40
Once the G01 code is used, the machine will move to any XYZ locations given in a straight line at the set feed rate.
Because G01 is a modal code, you don’t need to specify it on every line of code.
If the next line of code after the one above was:
X4.0 Y5.0 Z6.0
then the machine would still move to the location in a straight line at the set feed rate. Because it’s modal, it stays on until switched to another mode.
The feed rate will also remain the same until it is changed and isn’t required to be on every line. This means that the feed rate can be set before the G01 code is used as well.
How to turn off the G01 code
There isn’t a specific cancel command for G01 like there is for canned cycles. Instead, to turn G01 off you will need to switch it to another code in the same group of movement codes.
The other codes in the movement group are:
- G00 – Rapid travel
- G02 – Clockwise circular interpolation
- G03 – Counterclockwise circular interpolation
Using any of these codes will turn G01 linear interpolation off and switch to the new movement mode.
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.

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, all locations are relative to the machine’s current location.
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[linear interpolation] vs G00[rapid travel]
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 machine’s maximum speed. G00 is not affected by the feed rate command (F).
G01 is used for cutting motions. G00 is not.
CNC codes that are similar to G01

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.
Code | Function |
G00 | Straight line rapid movement |
G01 | Straight line movement at a defined feed rate |
G02 | Circular movement in a clockwise direction |
G03 | Circular movement in a counterclockwise direction |
Ready to master CNC programming?
Try the free 30 minute intro course to see how simple and easy G code can be. Take the shortcut to becoming a G Code Master today!
View Free G Code CourseLeave a Comment Cancel reply
Comment
Name Email WebsiteMachinist Guides is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com.
PH +1 603 287 8259
21 durham aveclaremont, Nh 03743
© 2025 Machinist Guides
PRIVACY POLICY Manage Consent To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions. Functional Functional Always active The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network. Preferences Preferences The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user. Statistics Statistics The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you. Marketing Marketing The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.- Manage options
- Manage services
- Manage {vendor_count} vendors
- Read more about these purposes
- {title}
- {title}
- {title}
Privacy Policy
Từ khóa » G00 G01 Cnc Code
-
G00 And G01 G-Codes: CNC Linear Motion - CNCCookbook
-
CNC G Codes
-
List Of Most Important G-code Commands - How To Mechatronics
-
G01 Linear Interpolation Motion (Group 01) - Haas Automation Inc.
-
What Is G-Code? What Is M-Code? What Do They Mean In CNC ...
-
G01 G00 Basic CNC Programming ( G01 Not GO1 )
-
Using G00 And G01 G-codes With PlanetCNC TNG Software
-
G00, G01 – Support For CNC - MHCC Library Press
-
G-Code Basics, Ep. 1 - Linear Interpolation G00 G01 - YouTube
-
G-code - Wikipedia
-
G00, G01, G02, G03 – EVERY PART YOU'VE MADE USED THESE ...
-
G00 And G01: The Most Commonly Used G-Codes For CNC Machines
-
[PDF] G & M Code REFERENCE MANUAL - MachMotion
-
G-code Tutorial For CNC Programming: 6 Simple Steps - All3DP