Essengold

Reply within 6 hours
Quick Contact

At Essengold, we have no big or small task that we would not handle; we give Super-fast prototyping and assembly services! Request a quote now!

Brass-CNC-machining-parts-2

Our joint venture is ISO9001: 2008 certified, specializing in CNC machining services. This includes custom and standard machines for CNC screw components, Swiss-milled parts, turn-mill parts, or secondary operations.

Surface-Finish

The role of surface finish in CNC machining cannot be overemphasized, as it influences both the functional and visual appeal of produced parts.

G10 CNC Code Explained: How to Set Offsets and Datums

June 11, 2026
G10 CNC Code Explained How to Set Offsets and Datums
Author James Cao

James Cao CNC machining expert

Typing offset values into a control panel by hand is one of the easiest ways to scrap a part. One wrong digit in a work offset, and your tool plows into the fixture. The G10 CNC code fixes that problem by allowing you to write offsets and datums directly into your program. If you run repeatable fixtures, multiple parts on one table, or lights-out batches, this single code can save you setup time and prevent costly crashes.

This guide is for CNC programmers, machinists, and manufacturing engineers who want to use G10 with confidence. You’ll learn exactly what G10 does, how to write it for both work and tool offsets, real Fanuc and Haas examples, when to reach for it, and the mistakes that even experienced operators catch. By the end, you’ll know how to hard-code your datums cleanly and avoid the off-by-one errors that ruin parts.

What the G10 CNC Code Actually Does

G10 is the programmable data input command. In plain terms, it lets you set offset values from inside your G-code instead of keying them into the control by hand. You can write a work coordinate system like G54, or load tool length and wear offsets, directly in the program.

Think of it this way. Normally, an operator stands at the machine, opens the offset page, and types numbers into G54 or a tool register. With G10, those numbers live in the program file. Load the job, run it, and the datums are already defined.

That shift matters for one big reason: it removes the human from the error-prone step. Manual entry invites typos, transposed digits, and wrong-register mistakes. G10 makes your offsets travel with the program, so the setup repeats the same way every single time.

G10 Syntax and Format

The format of G10 changes depending on what you’re setting. The two jobs you’ll use most are writing a work offset (your part datum) and writing a tool offset (length or wear). Both follow a similar pattern but use different L codes.

Setting Work Offsets with L2

To set a work coordinate system like G54, you use L2. Here’s the Fanuc-style format:

G10 L2 P1 X-250.0 Y-180.0 Z-300.0

Breaking it down:

  • L2 tells the control you’re writing a work coordinate offset.
  • P1 selects which offset you’re setting (more on P numbers below).
  • X Y Z Are the offset values measured from machine zero?

How P Numbers Map to G54–G59

The P value picks the work offset register. This mapping trips up beginners constantly, so commit it to memory:

  • P1 = G54
  • P2 = G55
  • P3 = G56
  • P4 = G57
  • P5 = G58
  • P6 = G59

Note that P0 Typically targets the external (common) offset, not G53. G53 is the machine coordinate system and isn’t set with G10 L2.

Setting Tool Offsets with L10 and L11

Tool offsets use different L codes. On most Fanuc controls:

  • L10 sets the tool length geometry offset.
  • L11 sets the tool length wear offset.
  • L12 and L13 handle cutter radius geometry and wear.

A tool length geometry example looks like this:

G10 L10 P3 R-125.4

Here L10 target length geometry, P3 is the tool offset number, and R is the value you’re storing.

A short setup that defines a datum and a tool offset together might read:

G90 G10 L2 P1 X-300.0 Y-220.0 Z-450.0
G10 L10 P3 R-125.4
M30

Notice the G90 at the start. Working in absolute mode keeps your offset values predictable, which we’ll come back to in the mistakes section.

When to Use G10

G10 earns its keep in any job where you want consistency and want the operator out of the offset-entry loop. Here are the clearest cases.

  • Repeatable fixtures: When the same fixture sits in the same spot every run, hard-code the datum once and stop re-touching off.
  • Multiple parts on one table: Set several work offsets — G54, G55, G56 — in a single block of code for multi-part setups.
  • Lights-out and batch jobs: Remove the manual offset step entirely so unattended runs start from known, correct datums.
  • Probing routines: Pair G10 with a probe to write measured surface positions straight into a work offset (a common automated setup move).

The pattern across all four is the same: G10 shines whenever a repeatable, error-free setup matters more than quick one-off tweaks. For a single prototype, you’ll probably just touch off at the control. For production, G10 pays you back fast.

Common G10 Mistakes and How to Avoid Them

Most G10 problems trace back to a handful of repeat offenders. Learn these, and you’ll dodge the crashes and scrapped parts that catch people off guard.

Mixing Up G90 and G91

This is the big one. In absolute mode (G90), G10 replaces the offset with the values you give. In incremental mode (G91), G10 adds your values to the existing offset. Run a G10 block in G91, thinking it’ll overwrite the datum, and you’ll stack values on top of what’s already there. Always confirm your mode before the G10 line — many programmers force G90 right in the same block.

Using the Wrong P Number

P1 is G54, not G53. An off-by-one error here writes your datum into the wrong register, and you won’t notice until the tool moves to the wrong place. Double-check the P-to-G mapping every time you write a new offset.

Confusing the L Codes

L2, L10, and L11 all do different jobs — work offset, tool-length geometry, and tool-length wear. Swap them by accident, and you’ll write a part datum into a tool register, or a tool length into a work offset. Slow down and verify the L code before you run.

Forgetting to Verify Against the Manual

L-code numbering isn’t perfectly universal across builders. Before running a new G10 routine on an unfamiliar machine, check the control’s manual. A two-minute confirmation beats a crashed spindle.

Fanuc vs Haas: Key Differences

Both Fanuc and Haas use the same core G10 structure — L2 for work offsets and L10/L11 for tool offsets — so most of what you’ve learned carries straight across. The differences show up at the edges.

Haas supports L20 for additional work offsets beyond G59, giving you extra coordinate systems for complex multi-part setups. Fanuc handles extended offsets differently, often through G54.1 P-addresses rather than a single L code. The R-value and P-number logic stays familiar on both, but the exact L-code map can shift between builders and even between machine builds.

The practical takeaway: write your G10 logic the same way on both platforms for standard offsets, but always confirm the extended-offset syntax against your specific control before you rely on it.

Key Takeaways

  • G10 sets offsets from inside your program, removing the error-prone manual entry step and making setups repeatable.
  • Use L2 for work offsets (P1 = G54 through P6 = G59) and L10/L11 for tool length geometry and wear.
  • Mind G90 vs G91 — absolute mode replaces the offset, incremental mode adds to it.
  • Watch your P numbers and L codes, and verify extended-offset syntax against your control’s manual.

Master G10 and you turn setup from a manual, mistake-prone chore into a repeatable part of your program. Start by hard-coding one reliable fixture datum, confirm it runs clean, then build from there.

G10 is just one piece of the setup puzzle. To see how it works alongside reference return and probing, read the full pillar guide: G10, G28, and G31 CNC Codes: The Complete Guide to Offsets, Reference Return, and Probing →

Need Precision CNC Machining You Can Trust?

Knowing the code is one thing. Turning it into accurate, repeatable parts is another. At Essengold, we combine deep programming expertise with tight process control to deliver components that hit your specs every time. From rapid prototypes to full production runs, our team handles the offsets, datums, and probing routines so you don’t have to.

Get a quote on your CNC machining project today → and see how precise, reliable manufacturing keeps your project moving forward.

 

 

Share this Post

Facebook
X
LinkedIn

Get in touch with us!

Contact Form Demo
In this article

Get in touch with Us !

Contact Form Demo

Please upload 3D and 2D files if available. If you cannot do so, please try compressing the files into a Zip or rar format before uploading. You can also email us at sales@essengoldparts.com.