G-code reference

G87 G-Code: Back Boring Cycle

Back Boring Cycle — Orients the spindle, shifts the bar, rapids through the hole, shifts back and bores upward. Used for counterbores on the back side of a part.

By cnccode · Updated
PropertyValue
CodeG87
FunctionBack Boring Cycle
Modal group09
TypeModal — stays active until replaced by another code of the same group
Used onMilling machines
SyntaxG87 X_ Y_ Z_ R_ Q_ F_

What does G87 do?

Orients the spindle, shifts the bar, rapids through the hole, shifts back and bores upward. Used for counterbores on the back side of a part.

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

Syntax and parameters

Format
G87 X_ Y_ Z_ R_ Q_ F_
AddressMeaning
QShift amount

G87 example program

Example
G87 X0 Y0 Z-30.0 R-45.0 Q0.5 F50.

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Check the shift direction parameter on the control before the first run.

Controller compatibility

G87 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 G87 modal?
Yes. G87 belongs to modal group 09 and stays active until another code of that group is programmed.
What does G87 mean in CNC?
G87 means Back Boring Cycle. Orients the spindle, shifts the bar, rapids through the hole, shifts back and bores upward. Used for counterbores on the back side of a part.
What is the difference between G87 and G76?
G87 is Back Boring Cycle, while G76 is Threading Cycle (Lathe) / Fine Boring (Mill). See the G76 page for its syntax and examples.
Can I use G87 on a lathe?
Usually not with the same meaning: G87 is documented here for milling machines. Check your control manual for the equivalent.