G-code reference

G51 G-Code: Scaling

Scaling — Scales programmed coordinates about a centre point by a factor. It is useful for shrink allowances or for re-using a profile at another size.

By cnccode · Updated
PropertyValue
CodeG51
FunctionScaling
Modal group11
TypeModal — stays active until replaced by another code of the same group
Used onMilling machines
SyntaxG51 X_ Y_ Z_ P_ (or I J K per axis)

What does G51 do?

Scales programmed coordinates about a centre point by a factor. It is useful for shrink allowances or for re-using a profile at another size.

G51 is modal: once programmed it remains in effect for the following blocks until another code from modal group 11 replaces it or the control is reset.

Syntax and parameters

Format
G51 X_ Y_ Z_ P_  (or I J K per axis)
AddressMeaning
X Y ZScaling centre
PScale factor (e.g. P2000 = ×2 with 0.001 increment)
I J KPer-axis factors

G51 example program

Example
G51 X0 Y0 P1500 (×1.5)
M98 P2000
G50

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Scaling does not scale offsets — cutter radius stays the same.
  • Option on many Fanuc controls.

Controller compatibility

G51 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G51 modal?
Yes. G51 belongs to modal group 11 and stays active until another code of that group is programmed.
What does G51 mean in CNC?
G51 means Scaling. Scales programmed coordinates about a centre point by a factor. It is useful for shrink allowances or for re-using a profile at another size.
What is the difference between G51 and G50?
G51 is Scaling, while G50 is Max Spindle Speed Clamp (Lathe) / Scaling Cancel (Mill). See the G50 page for its syntax and examples.
Can I use G51 on a lathe?
Usually not with the same meaning: G51 is documented here for milling machines. Check your control manual for the equivalent.