Printed from Kezuriba (kezuriba.net/en/nc/g20/)
G20
Machining center, LatheModal, group 06Inch input
Format and notes
G20 (as a standalone block at the start of the program)
- Place it at the start of the program, before any motion command, and do not switch midway (NIST recommendation)
- On Haas, you check that the setting (Setting 9) matches G20/G21
Differences between controls and machines
The same code can be written or assigned differently depending on the CNC control and the machine builder. Always check your machine’s manual.
| Source | Machine | Item | Detail |
|---|---|---|---|
| Siemens (ISO dialect) | Machining center | Code | G70 (Siemens native mode)In Siemens' native language, inch/metric are G70/G71. In ISO dialect mode they are G20/G21 |
Frequently asked questions about G20
- What is G20 (Inch input) used for and how is it formatted in a CNC program?
- G20 commands "Inch input" on Machining center, Lathe. The standard program format is "G20 (as a standalone block at the start of the program)". Place it at the start of the program, before any motion command, and do not switch midway (NIST recommendation)
- Is G20 a modal code or a one-shot (non-modal) code?
- G20 is a modal code (Group 06). Once commanded, it remains active across subsequent blocks until another code from the same modal group overrides it or the control is reset. Always state or cancel modal states explicitly in your safety block and at the end of a tool operation so residual modes do not cause unexpected motion when restarting mid-program.
- Does G20 work differently on machining centers (mills) versus CNC lathes?
- G20 is primarily used on Machining center, Lathe. Depending on the machine type and the lathe G-code system (System A, B, or C), this code may be unavailable or assigned to a different function, so verify against your machine tool manual.
- Are there differences in G20 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
- Yes. Control builders such as FANUC, Mitsubishi Electric (M80/M800), Okuma (OSP), Haas, Mazak, Siemens (SINUMERIK ISO dialect), and Heidenhain can differ in argument letters, decimal-point rules, and optional parameters for G20. Review the control comparison table above and verify the exact syntax in your machine’s programming manual before proving out the program.
Sources
The meaning of this code agrees in two or more sources from different publishers. Explanations are written in our own words.
- Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0) cache.industry.siemens.com
- Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition cache.industry.siemens.com
- Haas Automation, Inc. — Mill Operator's Manual – 17 Mill G-Codes (online version) haascnc.com
- Haas Automation, Inc. — Lathe Operator's Manual – 16 Lathe G-Codes (online version) haascnc.com
- National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov