---
title: "Do You Have to Type Leading Zeros in G00? (G0 vs G00)"
description: "No. G0 and G00 are the same, and leading zeros are optional everywhere. The thing that actually matters is the decimal point, not the leading zero. Here is why."
url: https://gcodepractice.com/journal/do-i-have-to-type-leading-zeros-in-g00/
canonical: https://gcodepractice.com/journal/do-i-have-to-type-leading-zeros-in-g00/
author: "Lawrence Arya"
authorUrl: https://www.linkedin.com/in/vibecoding/
published: 2026-06-04
updated: 2026-06-04
category: "Guides"
tags: ["g-code", "g00", "formatting", "beginner"]
lang: en
---

# Do You Have to Type Leading Zeros in G00? (G0 vs G00)

> **TL;DR** You do not have to type leading zeros. G0 and G00 are identical, G1 equals G01, and M3 equals M03, because the control reads the numeric value and ignores leading zeros. The format detail that actually matters is the decimal point on coordinate values, not the leading zero. Write whichever code style your shop prefers, but always put decimals on positions.

It is a common beginner worry: is it `G0` or `G00`? Do you need `X05` or is `X5` fine? The short answer is that leading zeros never matter. The control reads the numeric value of a code or coordinate and ignores any zero in front of it. What you actually need to get right is a different part of the number.

## Leading zeros are optional

A `G` word is just the letter `G` followed by a number, the [word address format](https://en.wikipedia.org/wiki/G-code) every control uses. The control reads that number, so a leading zero changes nothing:

| You can write | Same as | Identical? |
| --- | --- | --- |
| `G0` | `G00` | Yes |
| `G1` | `G01` | Yes |
| `M3` | `M03` | Yes |
| `X5` | `X05` | Yes (same value) |

So `G0` and `G00` both command a rapid, the move described in [G00 vs G01](/journal/g00-vs-g01/). The [LinuxCNC number-format reference](https://linuxcnc.org/docs/html/gcode/g-code.html) confirms the value is what counts, not the digits in front of it.

## Why people still write G00

If it makes no difference, why is `G00` so common? Readability. Writing the codes two digits wide lines the program up and makes it easy to scan, and most [code cheat sheets](https://www.cnccookbook.com/g-code-m-code-cnc-list-cheat-sheet/) list them that way. It is a style convention, not a rule. Pick the style your shop or instructor uses and be consistent; the machine runs both the same.

## The detail that actually matters

Here is the trap. Beginners fuss over leading zeros while the dangerous format detail is the **decimal point**:

| Pair | Same value? | Why |
| --- | --- | --- |
| `X5` vs `X05` | Always | Leading zero is ignored |
| `X5` vs `X5.` | Not always | A missing decimal can change the scale |

Dropping a leading zero is harmless. Dropping a decimal point can make a move 1000 times too large or small, depending on the control, which is the whole story of the [missing decimal point crash](/journal/missing-decimal-point-in-g-code-crash/). So spend your attention there: always put a decimal on a position or distance, and stop worrying about the zero in front of the code.

## Trailing zeros, spaces, and the old tape format

A few related format questions come up alongside leading zeros. Trailing zeros after a decimal also do not matter: `X5.` and `X5.00` and `X5.000` are the same value. Spaces between words are usually optional too, so `G0 X5.` and `G0X5.` run the same, though spacing makes the program far easier to read. And within a single block the order of most words does not change the result, because the control applies them in a defined precedence rather than strictly left to right.

The reason leading and trailing zeros feel like they should matter is history. On the old punched-tape, fixed-format controls, every number had a fixed number of digits and used leading-zero or trailing-zero suppression to save tape, so the format was rigid. Modern word-address programming with explicit decimals removed that rigidity, which is exactly why the decimal point is now the thing to be careful about.

## A note on program numbers

One place you will see leading zeros preserved is the program number. Some controls display `O0001` as a fixed four-digit name. That is a storage and display convention, and `O1` and `O0001` still refer to the same program. It does not change how the code runs, and it is one of the small machine-specific habits you notice when you [read a CNC program](/journal/how-to-read-a-cnc-program-for-beginners/).

## Bottom line

You do not have to type leading zeros. `G0` equals `G00`, `M3` equals `M03`, and `X5` equals `X05`. Write whichever style your shop prefers and keep it consistent. The format rule that actually matters is the decimal point on coordinates, so put your attention there. Practicing the codes until this is automatic is what a routine on the [G-code practice hub](/g-code-practice/) is for.

## Sources

- [LinuxCNC G-code reference (number format)](https://linuxcnc.org/docs/html/gcode/g-code.html)
- [Wikipedia: G-code](https://en.wikipedia.org/wiki/G-code)
- [CNCCookbook: G-code and M-code cheat sheet](https://www.cnccookbook.com/g-code-m-code-cnc-list-cheat-sheet/)

## Frequently asked questions

### Do I have to type leading zeros in G00?
No. `G0` and `G00` mean exactly the same thing because the control reads the number and ignores any leading zero. The same is true for M-codes and coordinate values.

### Is G0 the same as G00?
Yes. `G0`, `G00`, and even `G000` all command a rapid move. Many people write the zero just for readability and to line the code up.

### If leading zeros do not matter, what does?
The decimal point. `X5` and `X05` are always the same, but `X5` and `X5.` are not always the same, because a missing decimal can change the scale. Drop leading zeros freely, never the decimal.

### What is the best way to learn G-code formatting?
Drill the codes and number formats with active recall. A free app like G-Code Sprint quizzes the everyday codes and repeats whichever ones you miss, so the format rules that matter become automatic.

*G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.*

---

Source: https://gcodepractice.com/journal/do-i-have-to-type-leading-zeros-in-g00/
Author: Lawrence Arya — https://www.linkedin.com/in/vibecoding/
