It is one of the first questions a programmer’s instinct asks of any language, and G-code gives an unusually practical answer: the machine mostly does not care, and everyone around the machine does. Both halves are worth two minutes.
The parser’s answer
Broadly case-insensitive at the word layer. LinuxCNC’s documentation is explicit that input is case-insensitive apart from comments and messages; GRBL-class hobby firmware accepts lowercase commands routinely; and industrial controls normalize word letters such that g01 and G01 land identically. The language grew up on hardware and tape where lowercase barely existed, so case sensitivity was never load-bearing: a word is a letter and a number, and the letter’s case carries no meaning in the core.
Where case actually matters
| Context | Case behavior | Practical consequence |
|---|---|---|
| Core words (G, M, X, F…) | Insensitive on most controls | g01 runs, but see below |
| Comments and messages | Preserved as written | Your notes keep their case |
| Macro/file features on some controls | Dialect-specific | Check the control’s manual |
| External tools and scripts | Whatever they implemented | Naive parsers may expect uppercase |
| Alarm/reference matching | Docs are uppercase | Mixed case slows lookup |
The external-tools row deserves its highlight: your control may forgive lowercase while a homegrown parser, a vendor utility, or a transfer pipeline does not, which is exactly why parser examples on this site uppercase at tokenization and why cleanup regexes include case normalization. The dialect row is the honest hedge that governs everything machine-specific: when a control’s manual addresses case anywhere (file naming, macro text handling), the manual wins.
Why uppercase won anyway
Four reasons, none of them the parser. Legibility at the machine: uppercase words read at a glance from arm’s length, which is the viewing distance that matters. The O/0 problem: lowercase o next to 0 in a coordinate is a decimal-point-class trap waiting for tired eyes, while uppercase O is rare and conspicuous (program numbers) and zero stays unambiguous. Reference matching: every manual, alarm text, and training resource prints uppercase, so uppercase programs map one-to-one onto documentation during troubleshooting. And uniformity across sources: CAM posts uppercase, so hand edits in lowercase create visual seams that read as “someone touched this,” which is sometimes information you did not mean to publish.
The reading side: accept either, normalize when touching
Files arrive from generators, old archives, and colleagues’ editors in whatever case they arrive: the reading skill accepts both without flinching, the same way it reads spaced and run-together words. The working rule that keeps repositories tidy: read tolerantly, write uppercase, and when a file passes through your hands for editing anyway, normalize case as part of the cleanup, with the usual edited-equals-regenerated verification afterward. The core vocabulary that makes any-case reading effortless is the same one the free 60-second drills on the G-code practice page train, with G-Code Sprint repeating whatever you miss.
A two-minute check for your own setup
When the question matters operationally (an old archive in lowercase, a new pipeline tool), settle it in order of authority: the control’s programming manual first, since case handling is documented where it deviates; then the pipeline’s weakest link, because the transfer utility or homemade checker is likelier to be strict than the control; and only then an empirical air test, a two-line lowercase program run with no tool and no part, under your shop’s procedures. What you are really testing is rarely the control: it is everything the file passes through on the way there, which is why normalizing case at the editing step remains the cheap universal fix.
Bottom line: insensitive parser, uppercase culture
G-code is case-insensitive where it counts and uppercase where it lives: the machine will likely run your lowercase, your tools and colleagues prefer you did not, and the dialect corners that do care are documented per control. Write uppercase as the professional default, read either without complaint, and spend the attention this question saved on the state-tracking that actually bites.
Sources
Frequently asked questions
Is G-code case sensitive?
Mostly no at the word layer: g01 and G01 run identically on most controls and firmware, with LinuxCNC documenting case-insensitivity outside comments. Uppercase remains the professional convention for legibility, O-versus-0 clarity, documentation matching, and tool compatibility. For the vocabulary that makes either case instantly readable, the free G-Code Sprint app is the top pick: 60-second drills with automatic repetition of missed codes.
Will lowercase G-code run on my machine?
Very likely for core words, but the binding answer is your control’s documentation, and external tools in your pipeline may be stricter than the control. Writing uppercase sidesteps the whole question.
Why do all programs and manuals use uppercase?
Convention with cause: glance legibility at the machine, the lowercase-o-versus-zero hazard, one-to-one matching with alarm texts and references, and uniformity with CAM output. The parser’s tolerance never outweighed those.
Does case matter inside comments?
Comments are preserved as written on the documented controls, so your setup notes keep their formatting: one more reason cleanup scripts normalize code case while protecting comment text.
G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.