Free G-Code Simulator: Interactive CNC Programming Lab

Share on Pinterest Pinterest share button Share on X X - Twitter share button Share on Meta Facebook share button

Learn CNC programming by actually writing code, not just memorizing a list of commands. CNC Studio is a free browser-based G-code simulator with an editable program, XY and isometric toolpath views, block-by-block execution, and 24 original exercises. Start with coordinates, then explore modal commands, arcs, debugging and a fictional final project.

You can use the sandbox immediately, follow the guided lessons, or print the reference and worksheets for class. No account is required. The simulator teaches a small documented subset of milling G-code; it does not simulate a physical CNC machine.

INTERACTIVE LEARNING LAB / 01

CNC Studio

Write code. Watch the path. Understand the mistake.

0 / 24 complete

The simulator requires JavaScript. The beginner guide, command reference and printable exercises below are available without it.

What is G-code?

G-code is a programming language used to instruct computer numerical control (CNC) equipment. A milling machine, for example, receives instructions that describe where a tool should move and how the movement should happen. A program can also establish units, coordinate modes and other settings that affect later instructions.

A CNC controller interprets those instructions. Some are concerned with motion or how coordinates are interpreted; others control machine functions. The exact language depends on the controller and the equipment. The shared ideas are useful to learn, but a program that works in one control is not necessarily valid in another.

Think of the language as a set of compact directions rather than ordinary conversational computer code. You don't need to be a software developer to understand the first few instructions. You do need to be comfortable with signed numbers, dimensions and the fact that a setting you changed three lines ago may still be active.

G-code vs. M-code

G words commonly select motion or machining-related modes. M words specify miscellaneous control functions, such as stopping a program or controlling machine equipment. CNC Studio supports only two M commands, M2 and M30, as virtual program endings. It deliberately rejects spindle, coolant and tool-change commands.

A line is called a block. A word typically combines a letter and a numerical value: for example, X2 is an X coordinate word. A block may contain several words, such as G1 X2 Y1. The selected distance mode determines what the coordinates mean. The selected motion mode determines how the virtual point gets there.

How to read and write your first G-code program

Try the following fictional program in the sandbox. Its only purpose is to trace a short path in virtual space. The coordinates and feed values are teaching inputs, not real machining recommendations.

G20 G90 G17 G94
G0 Z0.25
G0 X1 Y0
G1 X3 Y0 F10
Y2
G0 Z0.5
M30
BlockWhat happens in CNC Studio
G20 G90 G17 G94Set inches, absolute coordinates, the XY plane and feed per minute.
G0 Z0.25Move the virtual Z position to 0.25.
G0 X1 Y0Move to X1, Y0; Z stays unchanged.
G1 X3 Y0 F10Select straight feed motion; move to X3, Y0 with a virtual feed setting of 10 in/min.
Y2G1 is still active. Move to X3, Y2 without changing X or Z.
G0 Z0.5Change motion mode back to rapid and move Z to 0.5.
M30End the virtual program.

Now predict the final X, Y and Z values before clicking Run. The answer is (3, 2, 0.5), in inches. Change the Y2 line to Y-2 and predict the new result. The ability to anticipate the next position is more valuable than memorizing a long list of codes.

What happens when you step through a program?

Use Step to move through the interpreted blocks one at a time. Compare the digital position readout (DRO) after each block to your prediction. The lab's timeline scrubs across blocks, not real machine time; a long move and a short move can take the same amount of preview time. The isometric view shows Z movement that may look like a stationary point in the top view.

Try changing a setting without entering a coordinate. A mode change can alter the meaning of future blocks without moving the point at all. That's a useful distinction to learn before you begin working with physical equipment.

CNC coordinates: machine zero, work zero and signed movement

On a typical three-axis milling setup, X and Y describe directions in the working plane and Z is perpendicular to it. In the XY display above, positive X goes right and positive Y goes up. The isometric display also lets you see the height or depth of the virtual trace. The origin is the point at (0, 0, 0); moving into negative X or Y is entirely legitimate in the lab.

On real equipment, machine coordinates are tied to a machine reference system. Work coordinates let a programmer describe positions relative to a selected work origin. For example, LinuxCNC has work coordinate selections such as G54. Tool-length and cutter-radius compensation address different aspects of physical tool geometry. The location of the workpiece, the chosen datum and the way the tool is measured all matter.

CNC Studio has one fixed virtual origin. It doesn't implement work offsets, tool compensation, machine homing or machine travel limits. A position in this lab is therefore not a verified position on an actual mill.

G90 vs. G91: absolute and incremental programming

G90 interprets programmed endpoints as positions relative to the active origin. G91 interprets them as changes from the current position. Imagine you're already at X2, Y1 in the simulator:

InstructionNew locationWhy
G90 G0 X3 Y2(3, 2)Go to the named coordinates.
G91 G0 X3 Y2(5, 3)Add 3 to X and 2 to Y.
G91 G0 X0 Y0(2, 1)A zero displacement leaves the position unchanged.

These examples each start at the same (2, 1) position. Absolute coordinates make it convenient to follow dimensions from a common datum. Incremental coordinates can be useful for repeated patterns. Both can describe the same geometry, but switching modes in the middle of a program without noticing can send later blocks somewhere unintended.

Modal commands and omitted axes

A modal setting remains selected until a compatible replacement changes it. After selecting G1, a later line containing just X or Y still uses that motion. Likewise, G91 continues to affect X, Y and Z until G90 is selected. If an axis is omitted, its coordinate does not change in this lab.

Two instructions from the same modal group conflict on one block. For example, G90 and G91 cannot both define the endpoint mode for that block. However, G90 and G17 describe different settings and can appear together. CNC Studio reports conflicting modes instead of guessing.

G20 vs. G21: inches and millimeters

G20 selects inch units and G21 selects millimeters. A change of units is not a physical movement. X1 in inch mode corresponds to X25.4 in millimeter mode. The same numerical instruction in the wrong unit mode can produce a path 25.4 times larger or smaller than expected.

The lab stores physical coordinates in millimeters internally and converts the displayed values when units change. As an explicit teaching restriction, a real change of unit mode must be on a different block from an F declaration; it clears the active virtual feed. Set a new positive F before the next feed movement. Actual controls can handle feed and unit changes differently, so consult the specific control documentation.

G0, G1, G2 and G3: linear and circular motion

G0 is used for rapid positioning, while G1 specifies a straight movement at a programmed feed. In CNC Studio, the rapid path is drawn as a dashed amber line and the linear feed path as a solid turquoise line. It does not reproduce the acceleration, velocity or trajectory behavior of a physical control.

G2 and G3 specify clockwise and counterclockwise circular movement, respectively, when viewed from the positive Z side of the XY plane. The arc needs a start position, an endpoint and a center. In the lab's incremental arc-center mode, I and J are the offsets from the start of the arc to its center in X and Y.

How to understand I and J

Suppose a virtual circle has a center at (2, 1) and a radius of 1 inch. Start at (2, 0) and trace a counterclockwise quarter turn to (3, 1). The center is zero inches away in X and one inch away in Y, so I is 0 and J is 1.

G20 G90 G17 G94 G91.1
G0 Z0.25
G0 X2 Y0
G3 X3 Y1 I0 J1 F10
M30

This is a virtual arc in the air, not a cutting operation. Try it in the sandbox, then change G3 to G2 while keeping the same endpoint and center. The shorter counterclockwise quarter-circle becomes a longer clockwise path of 270 degrees. This is why matching endpoints isn't enough to prove that a curve follows the intended design.

For center-format arcs, the distance from the start to the center must agree sufficiently with the distance from the endpoint to the center. CNC Studio uses the published LinuxCNC radius-difference rule as a reference. It flags a mismatch outside that rule; if a small difference is accepted, the preview interpolates the radius to the endpoint as an explicit approximation. Neither acceptance nor rejection predicts the behavior of your particular machine.

To trace a full circle in the lab, specify the I/J offset but omit both X and Y. The start point must be on the circle, not at its center. A zero-length center offset is not a circle. The simulator also accepts an explicit endpoint identical to the start. It excludes radius-format R arcs, helical Z arcs, absolute-center G90.1 and multiple-turn P syntax.

Why G91.1 is not G91

G91.1 concerns the interpretation of arc-center words. G91 concerns ordinary endpoint coordinates. In the supported subset, I and J always point from the arc's start toward the center, whether the endpoint is absolute or incremental. LinuxCNC also has an absolute arc-center mode, G90.1, which CNC Studio does not implement. Check the controller manual instead of assuming that these commands exist on every control.

Common G-code mistakes and how to find them

There are two distinct kinds of errors: instructions the interpreter cannot understand, and instructions it understands perfectly well that describe the wrong path. The second kind is especially useful to practice because changing one sign or retaining the wrong mode can still yield valid syntax.

What you seeWhat to inspect
Missing feed diagnosticHas a positive F been set for the active unit mode before feed motion?
Unexpectedly long pathDid G20/G21 or G90/G91 remain in the wrong mode?
Wrong arc direction or bulgeInspect G2/G3, the start point and the I/J vector. Equal radii alone don't prove the correct shape.
Radius mismatchCalculate the start-center and end-center distances. Don't change a dimension just to clear an error.
Extra diagonal segmentCheck whether both axes should have moved in one block or in separate blocks. Inspect Z in the isometric view.
Rapid clearance warningThe virtual trace moved laterally too low, or descended below the fictional surface in G0. Review the stated exercise clearance rule.
Unexpected motion after an arcG2/G3 stays selected. Change to G1 or G0 before requesting a linear path.
Unsupported commandConsult the reference below; this lab intentionally rejects commands outside its documented subset.

When you encounter a problem, find the first block where the readout or traced path stops matching your expectation. Check that block's active mode, then inspect the values of the relevant words. Fix one problem at a time. Use the Debug mode for four deliberately faulty programs, including an arc that passes syntax and radius checks but traces the wrong side of a corner.

Lab grading checks analytic line and arc geometry, requested depth, virtual transfer clearance, endpoint modes where specified, and program termination. It permits split edges and reverse traversal when the exercise permits them. The checks use the tolerance shown in each lesson. They are learning objectives, not a comprehensive manufacturing inspection or a qualification test.

What should you look for in CNC programming training?

If you like predicting coordinates, reading diagrams and figuring out why a program produced the wrong shape, you have sampled one aspect of CNC work. Programming is not the whole trade. A machinist needs to understand physical materials, tooling, setup, measurement and the limitations of the equipment as well.

Manual programming and CAD/CAM

CAD (computer-aided design) describes a part or drawing. CAM (computer-aided manufacturing) helps plan how it will be manufactured. A post-processor translates the planned toolpaths into code for a particular control. Software can remove much of the manual work of calculating a complex toolpath, but knowing how to interpret the resulting program is useful when troubleshooting an unexpected move or checking which coordinate mode is active.

Some programs teach mainly machine operation; others include more setup, programming, CAD/CAM and process troubleshooting. The job titles overlap, so don't assume that a course called CNC technology provides all of these skills. Our CNC machinist career guide explains operator, setup, machinist and programmer responsibilities in more detail.

Ask schools these questions before choosing a program

  • How much time will I spend personally using machine tools rather than watching demonstrations?
  • Will I learn to interpret, write and troubleshoot basic programs, as well as use CAD/CAM?
  • Which machine types and control systems will I encounter?
  • Will I practice interpreting drawings, measuring parts and checking tolerances?
  • How much of the curriculum covers supervised setup, offsets, workholding and safe operating procedures?
  • What kind of entry-level role is this program designed to prepare me for?

Explore CNC machining schools and training programs and compare the actual curriculum and equipment access.

More practice before your first shop class

Develop dimensional literacy with the micrometer and caliper practice lab. Learn to navigate drawing callouts and schedules with our blueprint reading practice lab (which uses construction drawings, not machining prints). Explore the free trade tools hub for more learning resources.

What the simulator cannot teach

The virtual point has no physical diameter. There is no stock, spindle, cutting load, fixture, clamp, tool-length offset or controller compensation. A drawn outline does not mean a pocket has been cleared, a hole has been drilled, a surface has been finished, or a part meets a tolerance. The Z=0 plane and clearance heights are fictional lesson conventions. A move that passes the exercise can be hazardous on real equipment.

Actual machines require instruction on the equipment, applicable workplace procedures, supervised practice, physical setup and verification. CNC Studio is not a controller emulator, CAM package, collision checker or program proofing tool. It does not export machine programs. Use the lab to learn the logic of motion and coordinates, not to validate files for a mill or router.

About the interpreter

The supported subset is modeled on selected LinuxCNC concepts, not an implementation of the full RS274 language. Every fresh interpretation begins at (0, 0, 0), in G20, G90, G17, G91.1, G94 and G0, with feed unset. M2/M30 stops interpretation and leaves the last displayed state in place for inspection. Reset execution starts the preview again without erasing your input.

The parser accepts signed decimal numbers, lower- or uppercase words, optional initial N numbers, parenthesized comments and semicolon-to-end-of-line comments. A matched pair of standalone percent signs can delimit the program. It stops at the first unsupported or invalid block and retains the valid preceding path. For learning, reaching the end of text without M2/M30 is allowed with an advisory; exercises require an explicit ending. The lab caps input at 100,000 characters, 2,000 lines, 256 characters per line and virtual position/radius magnitudes of 100,000 mm.

See the LinuxCNC G-code overview, G-code command reference and M-code reference for the underlying language concepts. Technical references reviewed November 26, 2026.

Printable beginner G-code cheat sheet

Educational subset only. The commands here apply to CNC Studio's virtual XY lab. Not a real-machine startup checklist or machining program.

Word or codeMeaning in CNC Studio
G0Rapid straight positioning
G1Straight feed motion
G2 / G3Clockwise / counterclockwise XY arc using I/J
G17XY arc plane
G20 / G21Inches / millimeters; use a separate block from F when changing units
G90 / G91Absolute endpoint coordinates / incremental displacements
G91.1Incremental arc-center offsets (always active in the lab)
G94Feed in current units per minute
M2 / M30End virtual program
X Y ZAxis coordinate or displacement; Z words are excluded on arcs
I JArc center offsets from current X and Y
FPositive virtual feed setting; reset when units change
NOptional initial block number, not execution order
(comment) / ; commentNotes ignored by the interpreter

24 original CNC programming practice exercises

All dimensions are fictional. Work on the target coordinates in the lab or on paper. Each exercise begins from the lab defaults. Use the stated units and virtual clearance. Print this worksheet without opening the answer key for independent practice; expand the answer key before printing if you want solutions included.

First Contact

1.1 · Four-Corner Rapid Check — Raise to Z0.25, visit (2.0, 0.0), (2.0, 1.5), (0.0, 1.5), return to (0.0, 0.0) at Z0.25, end M30. Trace the complete rectangle with G0 at Z0.25 in. Finish at (0, 0, 0.25) in G90 and end the program. Finish in G90. Reverse traversal is accepted.

1.2 · Feed Motion and Straight Trace — Rapid to (0.5, 1.0, 0.25), feed plunge Z-0.1, trace to (3.5, 1.0), rapid retract Z0.25, M30. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

1.3 · Quadrant Explorer — Negative Coordinates — Rapid to (-25, 25, 5), feed plunge Z-2 (F150), trace (25, 25), (25, -25), (-25, -25), (-25, 25), retract G0 Z5. Trace every target edge/arc exactly once at its marked Z (tolerance 0.02 mm); use G0 for transfers at Z 2.5 mm or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

1.4 · Three-Point Hole Spot Layout — Reach Z-0.15 at (1.25, 0.75), (2.75, 0.75), and (2, 2.05) in. Retract to Z0.25 before every XY transfer; finish at (0, 0, 0.25). Any point order. Reach each marked point at the stated depth by G1, with no extra below-plane traces. Any point order. Finish at (0, 0, 0.25) and end the program.

Drawing With Code

2.1 · Stepped L-Bracket Profile — Trace (0,0) -> (3,0) -> (3,1) -> (1,1) -> (1,2.5) -> (0,2.5) -> (0,0) at Z-0.125, F12, retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

2.2 · Chamfered Octagon Outline — Trace (1,0) -> (3,0) -> (4,1) -> (4,3) -> (3,4) -> (1,4) -> (0,3) -> (0,1) -> (1,0) at Z-0.1, F15, retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

2.3 · Metric 45-Degree Gusset — Trace (10,10) -> (60,10) -> (10,60) -> (10,10) at Z-3, F300, retract G0 Z5. Trace every target edge/arc exactly once at its marked Z (tolerance 0.02 mm); use G0 for transfers at Z 2.5 mm or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

2.4 · Nested Window Frame — Trace outer (0,0)-(4,3) rectangle at Z-0.1, F12; retract G0 Z0.25; trace inner (1,1)-(3,2) rectangle at Z-0.1; retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

The Modal Trap

3.1 · Implicit Motion Refactor — Plunge at (0, 0) to Z-0.1 (F12), trace (1,1) -> (2,0) -> (3,1) -> (4,0), retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction. Use at least one coordinate-only G1 block.

3.2 · Incremental Step-and-Repeat Ladder — Pockets at X[0.5..1.0], [1.5..2.0], [2.5..3.0], Y[0.5..1.0] at Z-0.1 (F10), retracting Z0.25 between each; end in G90 at (0, 0, 0.25). Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Use G91 on a feed path and restore G90. Finish at (0, 0, 0.25). Reverse traversal is accepted.

3.3 · Escape the Modal Trap — Trace (1,1)-(2,2) square at Z-0.1, retract to exact Z0.25, and return to (0, 0, 0.25) in G90. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Finish in G90. Finish at (0, 0, 0.25).

3.4 · Inch-to-Metric Unit Handoff — Move to (1, 1, 0.25) in with G20; switch to G21 without moving. Trace the closed 25 mm square from (25.4, 25.4) to (50.4, 25.4), (50.4, 50.4), (25.4, 50.4), and back, at Z-2.5. Finish at Z5. Trace every target edge/arc exactly once at its marked Z (tolerance 0.02 mm); use G0 for transfers at Z 2.5 mm or higher; finish at or above that height and end with M2/M30. Switch units at the specified position in a separate block.

Around the Bend

4.1 · Quarter-Turn Corner Fillet — Trace (0,0)->(2,0) at Z-0.1 (F12), G3 arc to (3,1) around (2,1), G1 to (3,3), retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

4.2 · Obround Keyway Slot — Trace (1.0,1.5) -> (3.0,1.5) -> G2 (3.0,0.5) -> (1.0,0.5) -> G2 (1.0,1.5) at Z-0.1 (F8 plunge, F12 trace), retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

4.3 · 270-Degree Metric Keyhole — Rapid to (70, 50, 5), plunge G1 Z-2 F250, trace 270° CCW (R20 mm, center (50, 50)) to (50, 30), close (50, 50) -> (70, 50), retract G0 Z5. Trace every target edge/arc exactly once at its marked Z (tolerance 0.02 mm); use G0 for transfers at Z 2.5 mm or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

4.4 · Full 360-Degree Circle — Rapid to (2.0, 1.0, 0.25), plunge G1 Z-0.15 F8, trace a 1.000 in radius circle centered at (1.0, 1.0) at F12, retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

Debugging the Disaster

5.1 · Missing Feed and Rapid Clearance Error — Trace (1,1)->(3,1)->(3,2) at Z-0.1 (F10), retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

5.2 · Broken Arc Radius Mismatch — Plunge at (2, 2) to Z-0.1 (F10) and trace a 90° CW G2 arc to (3, 1) around (2, 1). Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

5.3 · The Inverted Center-Offset Trap — Trace (0,2)->(2,2) at Z-0.1 (F12), then a convex 90° CW outer fillet to (3,1), ending at (3,0). Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

5.4 · Comment Syntax, Unsupported Plane, and Modal Collision — Trace (1,1)->(3,1)->(3,2) at Z-0.1 (F10), retract G0 Z0.25, M30. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Follow the stated path direction.

Final Project

6.1 · Plate Outer Contour — Trace at Z-0.125, F12 (F8 plunge): (0.5,0)->(3.5,0)->G3 (4.0,0.5)->(4.0,2.0)->G3 (3.0,3.0)->(0.0,3.0)->(0.0,0.5)->G3 (0.5,0.0), retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

6.2 · Plate Center Circle (1.000 in Diameter) — Rapid to (2.5, 1.5, 0.25), plunge G1 Z-0.15 F8, full-circle G3 (F12), retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

6.3 · Upper-Left Mounting Keyway Slot — Rapid to (0.75, 2.50, 0.25), plunge G1 Z-0.1 F8, trace (1.75, 2.50) -> G2 (1.75, 2.00) -> (0.75, 2.00) -> G2 (0.75, 2.50) at F12, retract G0 Z0.25. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Reverse traversal is accepted.

6.4 · Complete Integrated TSNET-101 Alignment Plate — Trace all three fictional features from exercises 6.1, 6.2 and 6.3 at Z-0.125, Z-0.150 and Z-0.100 in respectively. Retract to Z0.25 between features and return to (0, 0, 0.25). Any feature order. Trace every target edge/arc exactly once at its marked Z (tolerance 0.001 in); use G0 for transfers at Z 0.1 in or higher; finish at or above that height and end with M2/M30. Finish at (0, 0, 0.25). Reverse traversal is accepted.

Reference answer key (expand to include in print)

These are virtual lab programs only. Never transfer them to a physical control. Other geometrically valid programs may pass.

1.1 · Four-Corner Rapid Check

G20 G90 G17 G94
G0 Z0.25
X2.0 Y0.0
Y1.5
X0.0
Y0.0
M30

1.2 · Feed Motion and Straight Trace

G20 G90 G17 G94
G0 Z0.25
X0.5 Y1.0
G1 Z-0.1 F10
X3.5
G0 Z0.25
M30

1.3 · Quadrant Explorer — Negative Coordinates

G21 G90 G17 G94
G0 Z5
X-25 Y25
G1 Z-2 F150
X25
Y-25
X-25
Y25
G0 Z5
M30

1.4 · Three-Point Hole Spot Layout

G20 G90 G17 G94
G0 Z0.25
X1.25 Y0.75
G1 Z-0.15 F8
G0 Z0.25
X2.75 Y0.75
G1 Z-0.15
G0 Z0.25
X2.00 Y2.05
G1 Z-0.15
G0 Z0.25
X0 Y0
M30

2.1 · Stepped L-Bracket Profile

G20 G90 G17 G94
G0 Z0.25
X0 Y0
G1 Z-0.125 F12
X3
Y1
X1
Y2.5
X0
Y0
G0 Z0.25
M30

2.2 · Chamfered Octagon Outline

G20 G90 G17 G94
G0 Z0.25
X1 Y0
G1 Z-0.1 F15
X3 Y0
X4 Y1
X4 Y3
X3 Y4
X1 Y4
X0 Y3
X0 Y1
X1 Y0
G0 Z0.25
M30

2.3 · Metric 45-Degree Gusset

G21 G90 G17 G94
G0 Z5
X10 Y10
G1 Z-3 F300
X60
X10 Y60
Y10
G0 Z5
M30

2.4 · Nested Window Frame

G20 G90 G17 G94
G0 Z0.25
X0 Y0
G1 Z-0.1 F12
X4
Y3
X0
Y0
G0 Z0.25
X1 Y1
G1 Z-0.1
X3
Y2
X1
Y1
G0 Z0.25
M30

3.1 · Implicit Motion Refactor

G20 G90 G17 G94
G0 Z0.25
G1 Z-0.1 F12
X1 Y1
X2 Y0
X3 Y1
X4 Y0
G0 Z0.25
M30

3.2 · Incremental Step-and-Repeat Ladder

G20 G90 G17 G94
G0 Z0.25
X0.5 Y0.5
G91
G1 Z-0.35 F10
X0.5
Y0.5
X-0.5
Y-0.5
G0 Z0.35
X1.0
G1 Z-0.35
X0.5
Y0.5
X-0.5
Y-0.5
G0 Z0.35
X1.0
G1 Z-0.35
X0.5
Y0.5
X-0.5
Y-0.5
G0 Z0.35
G90 X0 Y0
M30

3.3 · Escape the Modal Trap

G20 G90 G17 G94
G0 Z0.25
X1 Y1
G1 Z-0.1 F10
G91 X1
Y1
X-1
Y-1
G90 G0 Z0.25
X0 Y0
M30

3.4 · Inch-to-Metric Unit Handoff

G20 G90 G17 G94
G0 Z0.25
X1.0 Y1.0
G21
G1 Z-2.5 F250
X50.4
Y50.4
X25.4
Y25.4
G0 Z5
M30

4.1 · Quarter-Turn Corner Fillet

G20 G90 G17 G94
G0 Z0.25
X0 Y0
G1 Z-0.1 F12
X2 Y0
G3 X3 Y1 I0 J1
G1 X3 Y3
G0 Z0.25
M30

4.2 · Obround Keyway Slot

G20 G90 G17 G94
G0 Z0.25
X1.0 Y1.5
G1 Z-0.1 F8
X3.0 F12
G2 X3.0 Y0.5 I0 J-0.5
G1 X1.0
G2 X1.0 Y1.5 I0 J0.5
G0 Z0.25
M30

4.3 · 270-Degree Metric Keyhole

G21 G90 G17 G94
G0 Z5
X70 Y50
G1 Z-2 F250
G3 X50 Y30 I-20 J0
G1 X50 Y50
X70 Y50
G0 Z5
M30

4.4 · Full 360-Degree Circle

G20 G90 G17 G94
G0 Z0.25
X2.0 Y1.0
G1 Z-0.15 F8
G3 I-1.0 J0 F12
G0 Z0.25
M30

5.1 · Missing Feed and Rapid Clearance Error

G20 G90 G17 G94
G0 Z0.25
X1 Y1
G1 Z-0.1 F10
X3 Y1
X3 Y2
G0 Z0.25
M30

5.2 · Broken Arc Radius Mismatch

G20 G90 G17 G94
G0 Z0.25
X2 Y2
G1 Z-0.1 F10
G2 X3 Y1 I0 J-1.0
G0 Z0.25
M30

5.3 · The Inverted Center-Offset Trap

G20 G90 G17 G94
G0 Z0.25
X0 Y2
G1 Z-0.1 F12
X2
G2 X3 Y1 I0 J-1
G1 Y0
G0 Z0.25
M30

5.4 · Comment Syntax, Unsupported Plane, and Modal Collision

G20 G90 G17 G94
G0 Z0.25
X1.0 (start) Y1.0
G1 Z-0.1 F10
G1 X3.0 Y1.0
X3.0 Y2.0
G0 Z0.25
M30

6.1 · Plate Outer Contour

G20 G90 G17 G94
G0 Z0.25
X0.5 Y0.0
G1 Z-0.125 F8
X3.5 F12
G3 X4.0 Y0.5 I0 J0.5
G1 Y2.0
G3 X3.0 Y3.0 I-1.0 J0
G1 X0.0
Y0.5
G3 X0.5 Y0.0 I0.5 J0
G0 Z0.25
M30

6.2 · Plate Center Circle (1.000 in Diameter)

G20 G90 G17 G94
G0 Z0.25
X2.5 Y1.5
G1 Z-0.15 F8
G3 I-0.5 J0 F12
G0 Z0.25
M30

6.3 · Upper-Left Mounting Keyway Slot

G20 G90 G17 G94
G0 Z0.25
X0.75 Y2.50
G1 Z-0.1 F8
X1.75 F12
G2 X1.75 Y2.00 I0 J-0.25
G1 X0.75
G2 X0.75 Y2.50 I0 J0.25
G0 Z0.25
M30

6.4 · Complete Integrated TSNET-101 Alignment Plate

G20 G90 G17 G94
(Outer contour)
G0 Z0.25
X0.5 Y0.0
G1 Z-0.125 F8
X3.5 F12
G3 X4.0 Y0.5 I0 J0.5
G1 Y2.0
G3 X3.0 Y3.0 I-1.0 J0
G1 X0.0
Y0.5
G3 X0.5 Y0.0 I0.5 J0
G0 Z0.25
(Center circle)
X2.5 Y1.5
G1 Z-0.15 F8
G3 I-0.5 J0 F12
G0 Z0.25
(Slot outline)
X0.75 Y2.50
G1 Z-0.1 F8
X1.75 F12
G2 X1.75 Y2.00 I0 J-0.25
G1 X0.75
G2 X0.75 Y2.50 I0 J0.25
G0 Z0.25
X0 Y0
M30

Frequently asked questions

Is CNC Studio a free G-code simulator?

Yes. The lab runs in your browser and all 24 exercises, the sandbox, hints and reference solutions are free. You do not need an account or to submit contact information.

Is G-code hard to learn?

Basic coordinate moves are approachable when you learn them one at a time. Modal settings, coordinate systems and arc geometry take practice. Physical CNC setup, process planning and machining require additional supervised training.

Do I need to learn G-code if I use CAM software?

Understanding basic G-code helps you read and troubleshoot posted toolpaths and understand what a control is being instructed to do. CAM skills and manual programming literacy complement each other.

Can I use this simulator to check a real CNC program?

No. CNC Studio implements only a teaching subset and does not simulate actual cutting, workholding, controller behavior or collision risk. Never use its output as machine verification.