{"id":9538,"date":"2025-08-26T05:26:00","date_gmt":"2025-08-26T12:26:00","guid":{"rendered":"http:\/\/www.autodesk.com\/products\/fusion-360\/blog\/?p=9538"},"modified":"2026-06-30T10:40:18","modified_gmt":"2026-06-30T17:40:18","slug":"cnc-programming-fundamentals-g-code","status":"publish","type":"post","link":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/","title":{"rendered":"G-Code for CNC Programming"},"content":{"rendered":"\n<p><em>G\u2011code is the core programming language used to control CNC machines, defining how tools move and operate to manufacture parts accurately.<\/em><\/p>\n\n\n\n<?php\nfunction autodesk_fusion_cta_horizontal() {\n    ob_start();\n    ?>\n    <style>\n        .cta-section-horizontal {\n            background: #ddd; \/* Much lighter grey background *\/\n            padding: 12px; \/* Adjusted padding *\/\n            border-radius: 8px;\n            box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);\n            color: #333; \/* Darker text color for better readability *\/\n            display: flex;\n            align-items: center;\n            justify-content: space-between;\n            max-width: 650px; \/* Width adjusted for a more compact look *\/\n            margin: 20px auto;\n            position: relative;\n            flex-wrap: nowrap; \/* Prevent wrapping *\/\n        }\n\n        .cta-section-horizontal img {\n            width: 60px; \/* Slightly larger logo *\/\n            height: auto; \/* Maintain aspect ratio *\/\n            margin-right: 12px; \/* Adjusted spacing *\/\n            background-color: #ddd; \/* Match the background color *\/\n            padding: 6px; \/* Adjusted padding *\/\n            border-radius: 8px; \/* Slightly rounding to match container *\/\n            box-shadow: 0 0 0 4px #ddd; \/* Blend with background *\/\n        }\n\n        .cta-text {\n            flex: 1;\n            margin-right: 12px; \/* Adjusted spacing *\/\n        }\n\n        .cta-title {\n            font-size: 18px; \/* Slightly larger title font size *\/\n            font-weight: bold; \/* Bold title *\/\n            color: #f9a825; \/* Orange color *\/\n            margin-bottom: 4px; \/* Reduced margin *\/\n        }\n\n        .cta-info {\n            display: none; \/* Hide description *\/\n        }\n\n        .cta-buttons {\n            display: flex;\n            gap: 8px; \/* Adjusted button spacing *\/\n            align-items: center;\n        }\n\n        .cta-button {\n            padding: 8px 12px; \/* Button padding *\/\n            font-size: 12px; \/* Smaller font size for buttons *\/\n            font-weight: bold;\n            text-transform: uppercase;\n            border-radius: 4px; \/* Slightly rounded corners *\/\n            border: 2px solid transparent;\n            cursor: pointer;\n            transition: all 0.3s ease;\n            display: inline-flex; \/* Use inline-flex to ensure proper alignment *\/\n            align-items: center; \/* Center align text vertically *\/\n            justify-content: center; \/* Center align text horizontally *\/\n            text-decoration: none !important; \/* Ensure no underlines with !important *\/\n            color: inherit; \/* Use the button's text color *\/\n        }\n\n        .cta-button.white-button {\n            background-color: #fff;\n            color: #333;\n            border: 2px solid #ddd;\n        }\n\n        .cta-button.white-button:hover {\n            background-color: #333;\n            color: #fff;\n            border: 2px solid #f9a825;\n        }\n\n        .cta-button.black-button {\n            background-color: #f9a825;\n            color: #fff;\n            border: 2px solid #f9a825;\n        }\n\n        .cta-button.black-button:hover {\n            background-color: #fff;\n            color: #f9a825;\n            border: 2px solid #fff;\n        }\n    <\/style>\n\n    <div class=\"cta-section-horizontal\">\n        <img decoding=\"async\" src=\"https:\/\/autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2024\/09\/autodesk-fusion-product-icon-400.png\" alt=\"Autodesk Fusion Logo\">\n        <div class=\"cta-text\">\n            <h1 class=\"cta-title\">Elevate your design and manufacturing processes with Autodesk Fusion<\/h1>\n        <\/div>\n        <div class=\"cta-buttons\">\n            <a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/trial-intake-flow\" class=\"cta-button white-button\">Get a 30-Day Free Trial<\/a>\n            <a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/extensions\" class=\"cta-button black-button\">See Plans and Pricing<\/a>\n        <\/div>\n    <\/div>\n\n    <?php\n    return ob_get_clean();\n}\nadd_shortcode('autodesk_fusion_cta_horizontal', 'autodesk_fusion_cta_horizontal');\n?>\n\n\n\n<p>You know what they say about fundamentals: learn them first, and you\u2019ll remember them forever. The same holds true for CNC machine programming. Even as new manufacturing technologies unfold, the fundamentals for how parts are machined with a CNC program will stay with you forever.<\/p>\n\n\n\n<p>In this article, we\u2019ll be talking about the core component of every CNC program \u2013 G-code. G-code stands for &#8220;geometric code&#8221; and serves as the fundamental instruction set for CNC machines, guiding their movements and translating digital models into precise physical actions.<\/p>\n\n\n<h2 class=\"simpletoc-title\">Table of Contents<\/h2>\n<ul class=\"simpletoc-list\">\n<li><a href=\"#what-is-gcode\">What Is G-code?<\/a>\n<\/li>\n<li><a href=\"#is-gcode-still-used-in-modern-cnc-manufacturing\">Is G-code still used in modern CNC manufacturing?<\/a>\n<\/li>\n<li><a href=\"#gcode-at-a-glance\">G-code at a glance<\/a>\n<\/li>\n<li><a href=\"#do-you-need-to-know-gcode-to-use-cam-software\">Do you need to know G-code to use CAM software?<\/a>\n<\/li>\n<li><a href=\"#manual-gcode-vs-camgenerated-gcode\">Manual G-Code vs CAM-Generated G-Code<\/a>\n<\/li>\n<li><a href=\"#types-of-gcode\">Types of G-code<\/a>\n\n<ul>\n<li><a href=\"#gcode-blocks\">G-code blocks<\/a>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#how-does-fusion-generate-gcode\">How does Fusion generate G-code?<\/a>\n<\/li>\n<li><a href=\"#gcode-programs\">G-code programs<\/a>\n<\/li>\n<li><a href=\"#modals-and-address-codes\">Modals and address codes<\/a>\n<\/li>\n<li><a href=\"#gcodes-amp-mcodes-explained\">G-codes &amp; M-codes explained<\/a>\n\n<ul>\n<li><a href=\"#g0-rapid-move\">G0 \u2013 Rapid move<\/a>\n<\/li>\n<li><a href=\"#g1-linear-move\">G1 &#8211; Linear move<\/a>\n<\/li>\n<li><a href=\"#g2-g3-clockwise-arc-counterclockwise-arc\">G2, G3 \u2013 Clockwise arc, counter-clockwise arc<\/a>\n<\/li>\n<li><a href=\"#g17-g18-g19-plane-designations\">G17, G18, G19 &#8211; Plane Designations<\/a>\n<\/li>\n<li><a href=\"#g40-g41-g42-cutter-diameter-compensation\">G40, G41, G42 &#8211; Cutter Diameter Compensation<\/a>\n<\/li>\n<li><a href=\"#g43-tool-length-compensation\">G43 &#8211; Tool Length Compensation<\/a>\n<\/li>\n<li><a href=\"#g54-work-offset\">G54 &#8211; Work Offset<\/a>\n<\/li>\n<li><a href=\"#mcodes\">M-codes<\/a>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#common-gcode-mistakes\">Common G-Code Mistakes<\/a>\n\n<ul>\n<li><a href=\"#incorrect-work-offsets\">Incorrect work offsets<\/a>\n<\/li>\n<li><a href=\"#incorrect-tool-length-offsets\">Incorrect tool length offsets<\/a>\n<\/li>\n<li><a href=\"#feed-and-speed-errors\">Feed and speed errors<\/a>\n<\/li>\n<li><a href=\"#post-processor-mismatch\">Post processor mismatch<\/a>\n<\/li>\n<li><a href=\"#running-unverified-programs\">Running unverified programs<\/a>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#canned-cycles-in-gcode\">Canned cycles in G-code<\/a>\n<\/li>\n<li><a href=\"#common-drill-cycles\">Common drill cycles<\/a>\n<\/li>\n<li><a href=\"#coordinate-system-and-movement\">Coordinate system and movement<\/a>\n<\/li>\n<li><a href=\"#cutter-compensation-and-tooling\">Cutter compensation and tooling<\/a>\n<\/li>\n<li><a href=\"#safety-considerations-and-best-practices\">Safety considerations and best practices<\/a>\n<\/li>\n<li><a href=\"#troubleshooting-and-error-handling\">Troubleshooting and error handling<\/a>\n<\/li>\n<li><a href=\"#optimization-and-efficiency\">Optimization and efficiency<\/a>\n<\/li>\n<li><a href=\"#how-cam-software-reduces-manual-cnc-programming\">How CAM software reduces manual CNC programming<\/a>\n<\/li>\n<li><a href=\"#from-learning-gcode-to-programming-parts\">From learning G-code to programming parts<\/a>\n<\/li>\n<li><a href=\"#generate-your-first-cnc-toolpath-in-fusion\">Generate your first CNC toolpath in Fusion<\/a>\n<\/li>\n<li><a href=\"#gcode-and-cnc-programming-faqs\">G-code and CNC programming FAQs<\/a>\n<\/li><\/ul>\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319-1024x683.jpg\" alt=\"g-code\"\/><\/figure>\n\n\n\n<h2 id=\"what-is-gcode\" class=\"wp-block-heading\">What Is G-code?<\/h2>\n\n\n\n<p>G-code is the programming language used to control CNC machines. It tells a machine where to move, how fast to move, when to start cutting, and which tools to use during a machining operation.<\/p>\n\n\n\n<p>Every CNC machine relies on G-code to convert digital part designs into physical components. Whether you&#8217;re machining simple brackets or complex aerospace components, the machine ultimately follows G-code instructions to perform the work.<\/p>\n\n\n\n<h2 id=\"is-gcode-still-used-in-modern-cnc-manufacturing\" class=\"wp-block-heading\">Is G-code still used in modern CNC manufacturing?<\/h2>\n\n\n\n<p>Yes. While modern CAM software automates much of the programming process, G-code remains the language that CNC machines use to execute machining operations.<\/p>\n\n\n\n<p>Today&#8217;s programmers rarely write large CNC programs by hand. Instead, CAM software generates machine-ready G-code automatically from machining strategies, toolpaths, and machining parameters.<\/p>\n\n\n\n<p>Understanding G-code remains valuable because it helps machinists troubleshoot issues, optimize jobs, and verify machining intent before running production parts.<\/p>\n\n\n\n<h2 id=\"gcode-at-a-glance\" class=\"wp-block-heading\">G-code at a glance<\/h2>\n\n\n\n<p>Manufacturers all around the world use <a href=\"https:\/\/www.autodesk.com\/solutions\/cnc-programming\">CNC programming<\/a> to control a machine\u2019s tools to produce parts. At the heart of this automated manufacturing process is a set of instructions, where each instruction is a specific command in the G-code program, that tells a CNC machine where \u2013 and how \u2013 to move. These instructions are called <a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/getting-started-with-g-code\/\">G-Code<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2021\/03\/img_6047a8e151231.png\" alt=\"g-code-autodesk-fusion-360\"\/><\/figure>\n\n\n\n<p>G-code was first established in the 1960s by the <a href=\"https:\/\/www.ecianow.org\/\">Electronics Industry Association (EIA)<\/a>. While the official language was documented as RS-274D, you\u2019ll hear everyone refer to it as G-code. Why? Many of the words, or individual pieces of code, that make up this machine-based language start with the letter G.<\/p>\n\n\n\n<p>While G-code is supposed to be a universal standard, you\u2019ll find that many CNC machine companies have developed their own unique flavor. CNC machines follow specific G-code and M-code standards, but variations exist between brands and models. We\u2019re all be eating ice cream at the end of the day, but a Haas might be strawberry flavored, and a Tormach might be chocolate flavored. Because of this difference in G-code flavors, it\u2019s imperative to understand how your own machine uses G-code.<\/p>\n\n\n\n<h2 id=\"do-you-need-to-know-gcode-to-use-cam-software\" class=\"wp-block-heading\">Do you need to know G-code to use CAM software?<\/h2>\n\n\n\n<p>Not necessarily. Modern CAM software allows machinists to create toolpaths visually without manually writing G-code.<\/p>\n\n\n\n<p>Instead of programming every move by hand, users define:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tool selections<\/li>\n\n\n\n<li>Machining operations<\/li>\n\n\n\n<li>Cutting parameters<\/li>\n\n\n\n<li>Workholding setups<\/li>\n<\/ul>\n\n\n\n<p>The CAM system then automatically generates the appropriate G-code for the target machine.<\/p>\n\n\n\n<p>That said, understanding G-code fundamentals can make it easier to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Debug machining issues<\/li>\n\n\n\n<li>Validate tool motion<\/li>\n\n\n\n<li>Optimize cycle times<\/li>\n\n\n\n<li>Understand post processor output<\/li>\n<\/ul>\n\n\n\n<p>Many CNC programmers learn machining strategy first and then develop deeper G-code knowledge over time.<\/p>\n\n\n\n<h2 id=\"manual-gcode-vs-camgenerated-gcode\" class=\"wp-block-heading\">Manual G-Code vs CAM-Generated G-Code<\/h2>\n\n\n\n<p>Historically, CNC programmers often wrote programs manually.<\/p>\n\n\n\n<p>Today, most manufacturers use CAM software to generate G-code automatically.<\/p>\n\n\n<?xml encoding=\"utf-8\" ?><figure class=\"wp-block-table MuiTableContainer-root\"><table class=\"has-fixed-layout MuiTable-root DhigTable--verticalAlignment--top\"><tbody><tr class=\" MuiTableRow-root\"><th>Manual G-Code Programming<\/th><th>CAM-Generated Programming<\/th><\/tr><tr class=\" MuiTableRow-root\"><td class=\" MuiTableCell-root\">Code written line-by-line<\/td><td class=\" MuiTableCell-root\">Toolpaths generated visually<\/td><\/tr><tr class=\" MuiTableRow-root\"><td class=\" MuiTableCell-root\">Time-intensive<\/td><td class=\" MuiTableCell-root\">Faster programming<\/td><\/tr><tr class=\" MuiTableRow-root\"><td class=\" MuiTableCell-root\">Difficult to modify<\/td><td class=\" MuiTableCell-root\">Simple design revisions<\/td><\/tr><tr class=\" MuiTableRow-root\"><td class=\" MuiTableCell-root\">Increased risk of mistakes<\/td><td class=\" MuiTableCell-root\">Built-in validation and simulation<\/td><\/tr><tr class=\" MuiTableRow-root\"><td class=\" MuiTableCell-root\">Better for simple operations<\/td><td class=\" MuiTableCell-root\">Better for complex parts<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Manual programming is still useful for learning CNC fundamentals and handling simple machine operations. However, CAM software is generally preferred for production environments because it improves consistency, efficiency, and scalability.<\/p>\n\n\n\n<h2 id=\"types-of-gcode\" class=\"wp-block-heading\">Types of G-code<\/h2>\n\n\n\n<p>Why the difference in G-code flavors? It really comes down to the capabilities of each machine. Take one machine that can process a coordinate system rotation based on probe inputs. You\u2019ll need a set of G-code commands that can enable or disable this rotation. Another machine without this adjustment capability won\u2019t require that G-code. Certain G codes are unique to specific machine types or operations, so while many codes are standard, some are specialized for particular functions or equipment.<\/p>\n\n\n\n<p>When in doubt, always refer to your CNC machine\u2019s documentation as you work through the rest of this article. We\u2019ll be walking through the basics, but you never know if your machine might have taken a slightly different path to the same end destination. Consulting the G code list for your specific machine is essential to avoid errors.<\/p>\n\n\n\n<h3 id=\"gcode-blocks\" class=\"wp-block-heading\">G-code blocks<\/h3>\n\n\n\n<p>The G-code standard was published back in the days when machines had small amounts of memory. Because of this memory limitation, G-code is an extremely compact and concise language that might almost seem archaic at first glance. Take, for example, this line of code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">G01 X1 Y1 F20 T01 M03 S500<\/pre>\n\n\n\n<p>In this single line, we\u2019re giving the machine a series of instructions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>G01 &#8211; Perform a linear feed move<\/li>\n\n\n\n<li>X1\/Y1 &#8211; Move to these X and Y coordinates<\/li>\n\n\n\n<li>F20 &#8211; Move at a feed rate of 20<\/li>\n\n\n\n<li>T01 &#8211; Use Tool 1 to get the job done<\/li>\n\n\n\n<li>M03 &#8211; Turn the spindle on<\/li>\n\n\n\n<li>S500 &#8211; Set a spindle speed of 500<\/li>\n<\/ul>\n\n\n\n<p>Multiple lines of G-code like these combine to form a complete CNC program. Your CNC machine will then read the code one line at a time from left to right and top to bottom, like reading a book. Each set of instructions is on a separate line or a block.<\/p>\n\n\n\n<h2 id=\"how-does-fusion-generate-gcode\" class=\"wp-block-heading\">How does Fusion generate G-code?<\/h2>\n\n\n\n<p>Fusion automatically converts toolpaths into machine-ready G-code using post processors. Rather than writing code manually, users create machining operations such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Facing<\/li>\n\n\n\n<li>Adaptive clearing<\/li>\n\n\n\n<li>Pocketing<\/li>\n\n\n\n<li>Drilling<\/li>\n\n\n\n<li>Contouring<\/li>\n<\/ul>\n\n\n\n<p>Fusion then translates those operations into G-code that matches the specific CNC machine and controller being used.<\/p>\n\n\n\n<p>Fusion includes an extensive library of post processors, making it easier to generate compatible code for a wide range of machines while maintaining a consistent programming workflow.<\/p>\n\n\n\n<h2 id=\"gcode-programs\" class=\"wp-block-heading\">G-code programs<\/h2>\n\n\n\n<p>The goal of every G-code program is to produce parts in the safest and most efficient way possible. To achieve this, you\u2019ll typically find G-code blocks arranged in a particular order like this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start the CNC program.<\/li>\n\n\n\n<li>Load the required tool.<\/li>\n\n\n\n<li>Turn the spindle on.<\/li>\n\n\n\n<li>Turn the coolant on.<\/li>\n\n\n\n<li>Move to a position above a part.<\/li>\n\n\n\n<li>Start the machining process.<\/li>\n\n\n\n<li>Turn the coolant off.<\/li>\n\n\n\n<li>Turn the spindle off.<\/li>\n\n\n\n<li>Move away from the part to a safe location.<\/li>\n\n\n\n<li>End the CNC program.<\/li>\n<\/ol>\n\n\n\n<p>Each step in the G-code program represents a specific function that the CNC machine executes, such as starting the spindle or moving to a safe location.<\/p>\n\n\n\n<p>This flow is a simple program using only one tool for one operation. In practice, you will typically rinse and repeat steps 2 through 9. For example, the G-code program below encompasses all of the code blocks above with repeating sections where needed:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/1-cnc-program-941x1024.png\" alt=\"Example of a CNC G-code program with explanations of each code block\"\/><\/figure>\n\n\n\n<h2 id=\"modals-and-address-codes\" class=\"wp-block-heading\">Modals and address codes<\/h2>\n\n\n\n<p>Like other programming languages, G-code can repeat an action indefinitely until stopped. This looping process uses modal code, which acts until you either turn it off or modify it with another modal code. For example, M03 is a modal code that will run a spindle indefinitely until you tell it to stop with M05. Now, wait a second. That word (remember: a word is a little piece of code) didn\u2019t start with a G, but it\u2019s still G-code. Words that start with an M are machine codes\u2014M-code stands for &#8220;machine code&#8221;\u2014and they control non-movement functions of the CNC machine, such as loading programs, pausing, and managing coolant flow. I\u2019ll list some common ones in the next section, but you can find a list of your machine\u2019s M-codes in its documentation.<\/p>\n\n\n\n<p>G-code also includes a complete list of address codes. You can think of these as the dictionary for G-code that defines particular behaviors. Address codes begin with the letter designation, like G, and then with a set of numbers. For example, X2 defines an X-coordinate address code, where 2 is the value on the X-axis to move the machine to.<\/p>\n\n\n\n<p>The complete list of address codes includes:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/2-address-codes-1024x706.png\" alt=\"Examples of address code parameters\"\/><\/figure>\n\n\n\n<p>Several special character codes can be added to a G-code program. These are typically used to start a program, comment out text, or ignore characters and include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>% Begins or ends a CNC program<\/li>\n\n\n\n<li>() Defines a comment written by a CNC operator; occasionally, these must be in all caps<\/li>\n\n\n\n<li>\/ Ignores all characters that come after the slash<\/li>\n\n\n\n<li>; Determines when a block of code ends, not shown in a text editor<\/li>\n<\/ul>\n\n\n\n<h2 id=\"gcodes-amp-mcodes-explained\" class=\"wp-block-heading\">G-codes &amp; M-codes explained<\/h2>\n\n\n\n<p>G &amp; M-codes will make up the bulk of your CNC program. Codes that begin with G prepare your machine to perform a specific type of motion. These commands control the tool movements required for machining operations. G-code is used to control various types of machine tool, including mills and lathes. The most common G codes that you\u2019ll encounter time and time again in every CNC program include:<\/p>\n\n\n\n<h3 id=\"g0-rapid-move\" class=\"wp-block-heading\"><strong>G0 \u2013 Rapid move<\/strong><\/h3>\n\n\n\n<p>This code tells a machine to move as fast as possible to a specified coordinate position. G0 will move the machine axis by axis, meaning that it will first move along both axes and finish the move on whichever axis is not in positions. You can see an example of this motion in the image below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/3-G0.png\" alt=\"Diagram showing the motion of a G00 rapid move\"\/><\/figure>\n\n\n\n<h3 id=\"g1-linear-move\" class=\"wp-block-heading\"><strong>G1 &#8211; Linear move<\/strong><\/h3>\n\n\n\n<p>This code tells a machine to move in a straight line to a coordinate position with a defined feed rate. For example, G1 X1 Y1 F32 will move the machine to coordinates X1, Y1, at a feed rate of 32. G1 is commonly used on a mill for cutting material along a straight path.<\/p>\n\n\n\n<h3 id=\"g2-g3-clockwise-arc-counterclockwise-arc\" class=\"wp-block-heading\"><strong>G2, G3 \u2013 Clockwise arc, counter-clockwise arc<\/strong><\/h3>\n\n\n\n<p>These codes tell the machine to move in an arc to a coordinate destination. G2 moves the tool in a clockwise direction, while G3 moves it in a counterclockwise direction. Both are used for cutting material along curved paths. Two additional coordinates, I and J, define the arc\u2019s central location as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/4-G2-3.png\" alt=\"Diagram showing CW and CCW arc interpolation using G02 and G03\"\/><\/figure>\n\n\n\n<h3 id=\"g17-g18-g19-plane-designations\" class=\"wp-block-heading\"><strong>G17, G18, G19 &#8211; Plane Designations<\/strong><\/h3>\n\n\n\n<p>These codes define what plane an arc will be machined on. By default, your CNC machine will use G17, which is the XY plane. The other two planes are shown in the image below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/5-G17-19.png\" alt=\"Plane selection diagram showing XY, YZ, and ZX planes\"\/><\/figure>\n\n\n\n<h3 id=\"g40-g41-g42-cutter-diameter-compensation\" class=\"wp-block-heading\"><strong>G40, G41, G42 &#8211; Cutter Diameter Compensation<\/strong><\/h3>\n\n\n\n<p>These codes define the cutter diameter compensation, or CDC, which allows a CNC machine to position its tool to the left or right of a defined path. A D-register stores the offset for each tool.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/6-tool-diameter-offset.png\" alt=\"Diameter offset table with example values in tool 1.\"\/><\/figure>\n\n\n\n<h3 id=\"g43-tool-length-compensation\" class=\"wp-block-heading\"><strong>G43 &#8211; Tool Length Compensation<\/strong><\/h3>\n\n\n\n<p>This code defines the length of individual tools using a Z-axis height. This allows the CNC machine to understand where the tip of a tool is in relation to the piece it is working on. A register defines the <a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/machining-fundamentals-tool-length-offset\/\">tool length <\/a>compensations, where H is the tool length offset and Z is the tool&#8217;s length.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/7-tool-length-register.png\" alt=\"Tool Length offset table with tool length value examples\"\/><\/figure>\n\n\n\n<h3 id=\"g54-work-offset\" class=\"wp-block-heading\"><strong>G54 &#8211; Work Offset<\/strong><\/h3>\n\n\n\n<p>This code is to define a fixture offset, which determines the distance from a machine\u2019s internal coordinates to the datum on a workpiece. In the table below, only G54 has an offset definition. However, you can program multiple offsets if a job requires machining multiple parts at once.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/8-work-offset.png\" alt=\"Work Offset table with values for a work offset included in the G54\"\/><\/figure>\n\n\n\n<h3 id=\"mcodes\" class=\"wp-block-heading\"><strong>M-codes<\/strong><\/h3>\n\n\n\n<p>M codes are machine codes that might differ between CNC machines. These codes control functions on your CNC machine like coolant and spindle directions. Some of the most common M-codes include:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/9-m-codes-1024x358.png\" alt=\"Sample of common machine codes or m-codes\"\/><\/figure>\n\n\n\n<h2 id=\"common-gcode-mistakes\" class=\"wp-block-heading\">Common G-Code Mistakes<\/h2>\n\n\n\n<p>Even experienced CNC programmers occasionally encounter issues caused by programming errors or machine configuration problems. Common mistakes include:<\/p>\n\n\n\n<h3 id=\"incorrect-work-offsets\" class=\"wp-block-heading\">Incorrect work offsets<\/h3>\n\n\n\n<p>Improperly configured work offsets can cause tools to machine in unexpected locations.<\/p>\n\n\n\n<h3 id=\"incorrect-tool-length-offsets\" class=\"wp-block-heading\">Incorrect tool length offsets<\/h3>\n\n\n\n<p>Invalid tool length values can result in poor cuts, collisions, or scrap parts.<\/p>\n\n\n\n<h3 id=\"feed-and-speed-errors\" class=\"wp-block-heading\">Feed and speed errors<\/h3>\n\n\n\n<p>Overly aggressive feeds and speeds can reduce tool life and compromise surface finish.<\/p>\n\n\n\n<h3 id=\"post-processor-mismatch\" class=\"wp-block-heading\">Post processor mismatch<\/h3>\n\n\n\n<p>Generating code for the wrong machine controller can create unexpected machine behavior.<\/p>\n\n\n\n<h3 id=\"running-unverified-programs\" class=\"wp-block-heading\">Running unverified programs<\/h3>\n\n\n\n<p>Programs should always be reviewed and simulated before machining production parts.<\/p>\n\n\n\n<p>Using CAM software with simulation capabilities can help identify many of these issues before code reaches the machine.<\/p>\n\n\n\n<h2 id=\"canned-cycles-in-gcode\" class=\"wp-block-heading\">Canned cycles in G-code<\/h2>\n\n\n\n<p>The last aspect of G-code to touch on is canned cycles. These are similar to methods or functions in computer programming. They allow you to perform a complicated action in only a few lines of code without having to type out all of the details.<\/p>\n\n\n\n<p>Canned cycles include not only drilling cycles but also the boring cycle, which automates boring operations. A boring cycle streamlines the process of creating internal holes or bores by entering all parameters into a single command, making machining more efficient and precise.<\/p>\n\n\n\n<p>Take, for example, the canned cycle below. Here we are telling the CNC tool to create a hole with a peck drill in only two lines of code on the left. This same action takes over 20 lines of regular G-code.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/10-canned-cycle-sample-1024x818.png\" alt=\"Canned Cycle vs Expanded G Code\"\/><\/figure>\n\n\n\n<h2 id=\"common-drill-cycles\" class=\"wp-block-heading\">Common drill cycles<\/h2>\n\n\n\n<p><strong>G81 &#8211; Simple Drill Cycle<\/strong><\/p>\n\n\n\n<p>Before programming any drill cycle, it is essential to establish a precise reference point and define the work coordinate system. Setting the reference point ensures the CNC machine knows the exact starting location for drilling, while the work coordinate system provides a consistent framework for accurate hole placement and tool paths.<\/p>\n\n\n\n<p>This cycle will make a hole by plunging to a specific Z-axis coordinate and then retracting. Programming this cycle requires a depth, feed rate, XY coordinates, and plane to drill on.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/11-simple-drill-cycle.png\" alt=\"g81-simple-drill-cycle\"\/><\/figure>\n\n\n\n<p><strong>G83 &#8211; Peck Drill<\/strong><\/p>\n\n\n\n<p>This cycle is for quickly drilling deep holes. A tool will first drill a defined distance and then retract, which clears any material out of the hole and allows coolant to flush away chips. This cycle&#8217;s simplest implementation requires an initial height, feed plane, peck increment, and depth.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/12-peck-drill-cycle.png\" alt=\"Diagram showing peck drilling motion and parameters\"\/><\/figure>\n\n\n\n<p><strong>G98 &#8211; Return to Initial Rapid Height<\/strong><\/p>\n\n\n\n<p>This cycle will retract a tool to a clearance plane between holes, which helps to avoid clamps. Programming this cycle requires an initial height and feed plane to drill on.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/13-return-to-plane-cycle.png\" alt=\"G98 - Return to Initial Rapid Height\n\"\/><\/figure>\n\n\n\n<h2 id=\"coordinate-system-and-movement\" class=\"wp-block-heading\">Coordinate system and movement<\/h2>\n\n\n\n<p>A solid understanding of the coordinate system is essential for anyone working with CNC machines. CNC machining relies on a <a href=\"https:\/\/mathinsight.org\/cartesian_coordinates\">Cartesian coordinate system<\/a>, where the X, Y, and Z axes define the movement and position of the cutting tool relative to the workpiece. The X-axis typically controls horizontal movement, the Y-axis manages vertical movement, and the Z-axis determines the depth of the cut. This three-dimensional framework allows CNC machines to follow precise tool paths, ensuring accurate and repeatable machining operations.<\/p>\n\n\n\n<p>CNC programmers use G code commands to instruct the machine on how to move the cutting tool. For example, G00 is used for rapid movement, quickly positioning the tool to a specific location without engaging the material, while G01 enables linear interpolation, guiding the tool in a straight line at a controlled feed rate for cutting. Linear interpolation is particularly valuable for creating smooth, accurate lines and curves, which are essential for complex operations and intricate part geometries. By mastering the coordinate system and movement commands, CNC programmers can design efficient tool paths that maximize precision and productivity throughout the machining process.<\/p>\n\n\n\n<h2 id=\"cutter-compensation-and-tooling\" class=\"wp-block-heading\">Cutter compensation and tooling<\/h2>\n\n\n\n<p>Cutter compensation is essential in CNC machining as it allows the machine to adjust the tool path based on the actual size and shape of the cutting tool. This ensures that the final part meets the intended dimensions, even if there are slight variations due to tool diameter or wear. G code programming enables CNC programmers to set cutter compensation, allowing the machine to automatically offset the tool path as required, minimizing errors and material waste.<\/p>\n\n\n\n<p>Selecting the appropriate cutting tools is equally crucial for achieving optimal results. Various types of cutting tools are designed for different materials and machining operations, from end mills for milling to drills for creating holes. CNC programmers must consider factors such as material hardness, desired surface finish, cutting speed, and feed rate when choosing these tools. M codes, which refer to miscellaneous codes, control auxiliary functions like tool changes and spindle speed adjustments, ensuring smooth transitions between different tools and operations. By effectively using G code and M code programming, CNC machines can perform efficient tool changes, maintain optimal spindle speeds, and improve overall machining efficiency, resulting in high-quality, precise components.<\/p>\n\n\n\n<h2 id=\"safety-considerations-and-best-practices\" class=\"wp-block-heading\">Safety considerations and best practices<\/h2>\n\n\n\n<p>Safety is crucial in CNC machining due to the high speeds and forces involved, which can present significant risks if not properly managed. CNC programmers and operators must prioritize best practices to ensure a safe machining process, starting with thorough machine setup and selecting the appropriate cutting tools for each job. Keeping a close watch on the machining process can help identify potential issues early, such as unusual tool wear or unexpected material behavior.<\/p>\n\n\n\n<p>G code programs can be written to incorporate safety features, including limiting feed rates and spindle speeds to prevent overloading the machine or causing tool breakage. Modern CNC controls come with safety interlocks and error detection systems that can automatically stop the machine if a problem is detected. Additionally, CAD\/CAM software can be used to simulate and verify the machining process before running the actual program, helping to identify and eliminate potential errors and thus reduce the risk of accidents. By following safety guidelines and utilizing advanced software tools, CNC programmers can create a safer and more reliable machining environment.<\/p>\n\n\n\n<h2 id=\"troubleshooting-and-error-handling\" class=\"wp-block-heading\">Troubleshooting and error handling<\/h2>\n\n\n\n<p>Even with meticulous planning, errors can still occur during CNC machining due to programming mistakes, equipment malfunctions, or material inconsistencies. Effective troubleshooting and error handling are critical skills for CNC programmers. When issues arise, analyzing error messages from the CNC controls and reviewing the G code program can help identify the problem&#8217;s source. Adjusting the code, such as correcting tool paths or modifying auxiliary functions controlled by M codes, often resolves these issues.<\/p>\n\n\n\n<p>M codes manage essential auxiliary functions like spindle speed control and tool changes, and problems in these areas are frequently linked to incorrect programming or mechanical faults. CAD\/CAM software allows programmers to simulate the machining process and detect potential errors before they reach the shop floor, saving time and reducing material waste. By remaining vigilant and utilizing the right tools and software, CNC programmers can efficiently troubleshoot and resolve errors, ensuring the machining process runs smoothly.<\/p>\n\n\n\n<h2 id=\"optimization-and-efficiency\" class=\"wp-block-heading\">Optimization and efficiency<\/h2>\n\n\n\n<p>Maximizing efficiency is a crucial goal in CNC machining, as it significantly affects productivity and cost-effectiveness. CNC programmers can enhance CNC programs by minimizing unnecessary tool changes, selecting the most efficient tool paths, and optimizing feed rates and spindle speeds for each operation. G code programming allows the specification of these parameters, ensuring each machining step is as efficient as possible.<\/p>\n\n\n\n<p>CAM software is essential for analyzing and optimizing the machining process, allowing programmers to simulate various strategies and select the best approach for the job. Utilizing canned cycles for repetitive operations, such as drilling or boring, can further streamline the process and reduce programming time. Choosing the appropriate CNC machine and cutting tools for the specific material and operation also boosts efficiency. By continuously refining their programming techniques and harnessing advanced software tools, CNC programmers can reduce production time, minimize waste, and consistently deliver high-quality machined parts.<\/p>\n\n\n\n<h2 id=\"how-cam-software-reduces-manual-cnc-programming\" class=\"wp-block-heading\">How CAM software reduces manual CNC programming<\/h2>\n\n\n\n<p>Understanding G-code is valuable. Spending hours manually writing it is often not. Modern CAM software helps manufacturers automate much of the programming process by generating machine-ready code directly from CAD models. Benefits include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Faster setup<\/strong>: Toolpaths can be created visually rather than programmed line-by-line.<\/li>\n\n\n\n<li><strong>Easier design revisions<\/strong>: When a design changes, toolpaths and G-code can be regenerated automatically.<\/li>\n\n\n\n<li><strong>Fewer programming errors<\/strong>: Built-in simulation and verification help identify issues before machining begins.<\/li>\n\n\n\n<li><strong>Simplified post processing<\/strong>: Machine-specific G-code can be generated automatically using post processors.<\/li>\n\n\n\n<li><strong>Improved standardization<\/strong>: Programming workflows become more consistent across users, parts, and machines.<\/li>\n<\/ul>\n\n\n\n<p>For many manufacturers, the greatest value of CAM software isn&#8217;t eliminating G-code entirely, it&#8217;s reducing repetitive programming tasks so machinists can focus on part quality, throughput, and process improvement.<\/p>\n\n\n\n<h2 id=\"from-learning-gcode-to-programming-parts\" class=\"wp-block-heading\">From learning G-code to programming parts<\/h2>\n\n\n\n<p>Understanding G-code remains one of the most valuable skills in CNC manufacturing. It helps machinists understand machine behavior, troubleshoot issues, and validate machining operations.<\/p>\n\n\n\n<p>However, modern manufacturers rarely rely on manual G-code programming alone.<\/p>\n\n\n\n<p>Today&#8217;s CAM systems automate toolpath creation, simulation, and G-code generation, allowing programmers to move from CAD model to production-ready code significantly faster.<\/p>\n\n\n\n<p>Whether you&#8217;re learning CNC programming for the first time or looking to improve programming efficiency, combining strong G-code fundamentals with modern CAM workflows provides the best path forward.<\/p>\n\n\n\n<h2 id=\"generate-your-first-cnc-toolpath-in-fusion\" class=\"wp-block-heading\">Generate your first CNC toolpath in Fusion<\/h2>\n\n\n\n<p>Ready to move beyond manual programming? With Fusion, you can:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create CNC toolpaths visually<\/li>\n\n\n\n<li>Simulate machining operations<\/li>\n\n\n\n<li>Automatically generate machine-ready G-code<\/li>\n\n\n\n<li>Use built-in post processors<\/li>\n\n\n\n<li>Reduce programming time and improve consistency<\/li>\n<\/ul>\n\n\n\n<p>Start a <a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/free-trial\">free 30-day Fusion trial <\/a>and generate your first CNC toolpath today.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 id=\"gcode-and-cnc-programming-faqs\" class=\"wp-block-heading\">G-code and CNC programming FAQs<\/h2>\n\n\n<div class=\"is-style-faq-accordion\">\n        <details id='faq-question-1776198577638' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    What is G\u2011code in CNC programming?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            G\u2011code is the language CNC machines use to control tool motion, speeds, and functions. Modern CAM software like <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> automatically generates accurate G\u2011code from toolpaths, so programmers can focus on machining strategy instead of manual coding.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198615268' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    Why is G\u2011code considered a CNC programming fundamental?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            G\u2011code is the foundation of how CNC machines execute machining operations. Understanding how it works helps programmers troubleshoot, optimize jobs, and trust the code generated by CAM platforms such as <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong>.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198653402' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    Do CNC programmers need to write G-code by hand?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            Manual G\u2011code writing is rarely required today. Solutions like <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> automatically create machine\u2011ready G\u2011code using post processors, while still giving users full visibility into the code when verification or edits are needed.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198679474' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    How do CAM systems generate G\u2011code from CNC programs?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            CAM systems convert toolpaths into G\u2011code using post processors that match specific CNC machines. <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> includes a robust free <a href=\"https:\/\/cam.autodesk.com\/hsmposts\">post processor library<\/a>, making it easier to generate compatible code across different machines and controllers.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198689837' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    How does understanding G\u2011code improve CNC efficiency?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            Knowing G\u2011code fundamentals helps machinists identify issues faster, validate machining logic, and optimize performance. When paired with <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong>, this knowledge enables safer automation, faster programming, and easier process standardization.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198704727' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    Is learning G\u2011code still useful with automated CAM software?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            Yes. While <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> automates toolpath creation and G\u2011code output, understanding the fundamentals helps users get more value from automation, especially when adapting to new machines, materials, or complex jobs.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198728272' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    What\u2019s the advantage of using modern CAM software instead of manual CNC programming?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            Modern CAM platforms like <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> reduce errors, shorten programming time, and adapt quickly to design changes by automatically regenerating G\u2011code, something manual programming can\u2019t match at scale.\n        <\/div>\n        <\/div>\n    <\/details>    <details id='faq-question-1776198743288' class='details'>\n        <summary>\n            <span class=\"details__summary\">\n                <span class=\"details__summary-text\">\n                    Can beginners learn CNC programming without deep G\u2011code experience?\n                <\/span>\n                <svg class=\"details__caret\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" hidden>\n                    <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"m18 9.5-6 6-6-6\"\/>\n                <\/svg>\n            <\/span>\n        <\/summary>\n        <div class=\"details__content\">\n            <div class='is-style-faq-accordion__body'>\n            Absolutely. <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> allows beginners to <a href=\"https:\/\/www.autodesk.com\/learn\/ondemand\/course\/learn-fusion-for-cam-in-90-minutes\">start programming<\/a> CNC machines visually with CAM workflows, while gradually building G\u2011code knowledge through simulation, post processing, and code review.\n        <\/div>\n        <\/div>\n    <\/details>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Learn about the fundamentals of CNC programming and G-code including blocks, modals, address codes, canned cycles, and popular G&#038;M codes.<\/p>\n","protected":false},"author":1894,"featured_media":14220,"menu_order":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"coauthors":[614],"class_list":["post-9538","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fusion","dhig-theme--light"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>G-Code for CNC Programming | Fusion 360 Blog<\/title>\n<meta name=\"description\" content=\"Learn about the fundamentals of CNC programming and G-code including blocks, modals, address codes, canned cycles, and popular G&amp;M codes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"G-Code for CNC Programming | Fusion 360 Blog\" \/>\n<meta property=\"og:description\" content=\"Learn about the fundamentals of CNC programming and G-code including blocks, modals, address codes, canned cycles, and popular G&amp;M codes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Fusion Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-26T12:26:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-30T17:40:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"1201\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Marti Deans\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@marti_deans\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marti Deans\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"20 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"G-Code for CNC Programming | Fusion 360 Blog","description":"Learn about the fundamentals of CNC programming and G-code including blocks, modals, address codes, canned cycles, and popular G&M codes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/","og_locale":"en_US","og_type":"article","og_title":"G-Code for CNC Programming | Fusion 360 Blog","og_description":"Learn about the fundamentals of CNC programming and G-code including blocks, modals, address codes, canned cycles, and popular G&M codes.","og_url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/","og_site_name":"Fusion Blog","article_published_time":"2025-08-26T12:26:00+00:00","article_modified_time":"2026-06-30T17:40:18+00:00","og_image":[{"width":1800,"height":1201,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319.jpg","type":"image\/jpeg"}],"author":"Marti Deans","twitter_card":"summary_large_image","twitter_creator":"@marti_deans","twitter_misc":{"Written by":"Marti Deans","Est. reading time":"20 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#article","isPartOf":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/"},"author":{"name":"Marti Deans","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/#\/schema\/person\/667bff6d55b30422effdbdb4f3c0877f"},"headline":"G-Code for CNC Programming","datePublished":"2025-08-26T12:26:00+00:00","dateModified":"2026-06-30T17:40:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/"},"wordCount":3819,"commentCount":0,"image":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319.jpg","articleSection":["Fusion"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/","url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/","name":"G-Code for CNC Programming | Fusion 360 Blog","isPartOf":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#primaryimage"},"image":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319.jpg","datePublished":"2025-08-26T12:26:00+00:00","dateModified":"2026-06-30T17:40:18+00:00","author":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/#\/schema\/person\/667bff6d55b30422effdbdb4f3c0877f"},"description":"Learn about the fundamentals of CNC programming and G-code including blocks, modals, address codes, canned cycles, and popular G&M codes.","breadcrumb":{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198577638"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198615268"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198653402"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198679474"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198689837"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198704727"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198728272"},{"@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198743288"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#primaryimage","url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319.jpg","contentUrl":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/04.08.19_Autodesk2319.jpg","width":1800,"height":1201,"caption":"g-code"},{"@type":"BreadcrumbList","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/"},{"@type":"ListItem","position":2,"name":"G-Code for CNC Programming"}]},{"@type":"WebSite","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/#website","url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/","name":"Fusion Blog","description":"Product updates, tips, tutorials and community news.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/#\/schema\/person\/667bff6d55b30422effdbdb4f3c0877f","name":"Marti Deans","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/Marti-1-150x150.jpg99ef33b5828b3465091d7bf7166badc1","url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/Marti-1-150x150.jpg","contentUrl":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-content\/uploads\/2018\/05\/Marti-1-150x150.jpg","caption":"Marti Deans"},"description":"Marti graduated from University of California, Berkeley where she earned her B.S. Mechanical Engineering and explored manual and CNC manufacturing processes in the Berkeley Student Machine Shop using MasterCAM, HSMWorks, and InventorHSM. Using this experience, she has been working at Autodesk for over 2 years, first developing training and adoption strategies for Fusion 360 users with a focus in manufacturing and now driving awareness for Fusion 360 and its manufacturing capabilities.","sameAs":["https:\/\/x.com\/marti_deans"],"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/author\/mdeans\/"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198577638","position":1,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198577638","name":"What is G\u2011code in CNC programming?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"G\u2011code is the language CNC machines use to control tool motion, speeds, and functions. Modern CAM software like <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> automatically generates accurate G\u2011code from toolpaths, so programmers can focus on machining strategy instead of manual coding.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198615268","position":2,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198615268","name":"Why is G\u2011code considered a CNC programming fundamental?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"G\u2011code is the foundation of how CNC machines execute machining operations. Understanding how it works helps programmers troubleshoot, optimize jobs, and trust the code generated by CAM platforms such as <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong>.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198653402","position":3,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198653402","name":"Do CNC programmers need to write G-code by hand?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Manual G\u2011code writing is rarely required today. Solutions like <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> automatically create machine\u2011ready G\u2011code using post processors, while still giving users full visibility into the code when verification or edits are needed.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198679474","position":4,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198679474","name":"How do CAM systems generate G\u2011code from CNC programs?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"CAM systems convert toolpaths into G\u2011code using post processors that match specific CNC machines. <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> includes a robust free <a href=\"https:\/\/cam.autodesk.com\/hsmposts\">post processor library<\/a>, making it easier to generate compatible code across different machines and controllers.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198689837","position":5,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198689837","name":"How does understanding G\u2011code improve CNC efficiency?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Knowing G\u2011code fundamentals helps machinists identify issues faster, validate machining logic, and optimize performance. When paired with <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong>, this knowledge enables safer automation, faster programming, and easier process standardization.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198704727","position":6,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198704727","name":"Is learning G\u2011code still useful with automated CAM software?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Yes. While <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> automates toolpath creation and G\u2011code output, understanding the fundamentals helps users get more value from automation, especially when adapting to new machines, materials, or complex jobs.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198728272","position":7,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198728272","name":"What\u2019s the advantage of using modern CAM software instead of manual CNC programming?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Modern CAM platforms like <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> reduce errors, shorten programming time, and adapt quickly to design changes by automatically regenerating G\u2011code, something manual programming can\u2019t match at scale.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198743288","position":8,"url":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/cnc-programming-fundamentals-g-code\/#faq-question-1776198743288","name":"Can beginners learn CNC programming without deep G\u2011code experience?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Absolutely. <strong><a href=\"https:\/\/www.autodesk.com\/products\/fusion-360\/fusion-for-manufacturing\">Fusion<\/a><\/strong> allows beginners to <a href=\"https:\/\/www.autodesk.com\/learn\/ondemand\/course\/learn-fusion-for-cam-in-90-minutes\">start programming<\/a> CNC machines visually with CAM workflows, while gradually building G\u2011code knowledge through simulation, post processing, and code review.","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/posts\/9538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/users\/1894"}],"replies":[{"embeddable":true,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/comments?post=9538"}],"version-history":[{"count":1,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/posts\/9538\/revisions"}],"predecessor-version":[{"id":88332,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/posts\/9538\/revisions\/88332"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/media\/14220"}],"wp:attachment":[{"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/media?parent=9538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/categories?post=9538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/tags?post=9538"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.autodesk.com\/products\/fusion-360\/blog\/wp-json\/wp\/v2\/coauthors?post=9538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}