G-code reference

G20: Inch units

G20 is inch units. Programs positions and feeds in inches. It is modal, so it stays active on the following lines until another code from the same group replaces it.

What G20 does

G20 makes the control read dimensions in inches and feeds in inches per minute or per revolution. It belongs at the top of the program, before any motion. Running a metric program in G20 (or the reverse) multiplies or divides every move by 25.4, which is a classic crash.

TypeG-code
MachineMill and lathe
GroupUnits
ModalYes: stays active until replaced by another code from the same group

G20 example

G20

Everything after this is in inches.

WordWhat it means here
G20Inch units

Codes people confuse with G20

CodeWhat it does instead
G21 Metric units. Programs positions and feeds in millimetres.

Memory hook: G20 = inch, G21 = mm. The bigger number is the smaller unit.

Other codes in the units group

Only one code from a modal group is active at a time. Programming any of these replaces G20.

  • G21 Metric units

Meanings follow the common Fanuc-style standard that Haas, Okuma (EIA mode), Mitsubishi, LinuxCNC and most other controls share for this code. Options and parameters change details from machine to machine, so check the manual for your control.

Quick check: G20

  1. What does G20 do? (Mill and lathe)

  2. Which code: Programs positions and feeds in inches.(Mill and lathe)

  3. What does G21 do? (Mill and lathe)

Show the answers
  1. Programs positions and feeds in inches.
  2. G20
  3. Programs positions and feeds in millimetres.

Drill this code with the rest of the core set

More practice hubs

Frequently asked questions

What does G20 mean in CNC programming?
Inch units. Programs positions and feeds in inches.
Is G20 modal?
Yes. G20 belongs to the units group and stays active until another code from that group is programmed.
What is the difference between G20 and G21?
G20 (inch units): programs positions and feeds in inches. G21 (metric units): programs positions and feeds in millimetres. A way to remember it: g20 = inch, G21 = mm. The bigger number is the smaller unit.

G-Code Sprint is an educational practice tool only. It is not a CNC simulator, machine controller, safety manual, or replacement for instruction. Always follow your instructor, employer, machine manual, and shop procedures.

Free preview · no card Try G-Code Sprint