Printed from Kezuriba (kezuriba.net/en/nc/g87/)
G87
Machining center, LatheModal, group 09Back boring cycle (reverse spot facing)
On machining centers
G87 X_ Y_ Z_ R_ Q_ (shift amount) P_ F_ K_
- The spindle orients and the tool is shifted so the cutting edge clears the hole, passed through, then shifted back on the far side and cuts upward
- The R point is below the hole, etc.; the points are defined the opposite way from the other cycles. G99 (R point return) cannot be used (Siemens ISO supports initial point return only)
Diagram: G87 motion (side view)
Full guide with examples: Canned cycles: how each one moves, how to choose, G98 vs G99
On lathes: Side deep hole drilling cycle (live tooling, systems A/B)One source / reference
The same number means something different on lathes (FANUC-type G-code system A). Group 10.
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 |
|---|---|---|---|
| Haas | Machining center | Code | G77 (Back Bore Canned Cycle)Haas mills use G77 for back boring. G87 is not in the list |
| NIST | Machining center | Format | G87 X_ Y_ Z_ R_ I_ J_ K_NIST: I/J give the shift position and K gives the top of the counterbore |
Frequently asked questions about G87
- What is G87 (Back boring cycle (reverse spot facing)) used for and how is it formatted in a CNC program?
- G87 commands "Back boring cycle (reverse spot facing)" on Machining center, Lathe. The standard program format is "G87 X_ Y_ Z_ R_ Q_ (shift amount) P_ F_ K_". The spindle orients and the tool is shifted so the cutting edge clears the hole, passed through, then shifted back on the far side and cuts upward
- Is G87 a modal code or a one-shot (non-modal) code?
- G87 is a modal code (Group 09). 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 G87 work differently on machining centers (mills) versus CNC lathes?
- Yes. On a machining center G87 means "Back boring cycle (reverse spot facing)", whereas on a CNC lathe (FANUC G-code System A) G87 means "Side deep hole drilling cycle (live tooling, systems A/B)". Never copy G87 between mill and lathe programs without checking which G-code system (A, B, or C) your lathe uses.
- Are there differences in G87 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 G87. 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
- National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov
- Haas Automation, Inc. — Mill Operator's Manual – 17 Mill G-Codes (online version) haascnc.com
- Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition cache.industry.siemens.com