📷 IMAGE AREA — G81 standard drilling motion sequence and the R plane
Suggested alt text: G81 standard drilling cycle and R plane in CNC milling
On a CNC mill it is possible to program several holes of the same type one by one with long motion lines; but this lengthens the program and increases the chance of error. FANUC controls use canned drilling cycles to simplify drilling. In this lesson we learn the basic cycles beginners will use most: G80 cancels the canned cycle, G81 standard drilling, G82 dwell drilling at the hole bottom, G83 peck deep drilling, G84 tapping; G98 returns to the initial plane, G99 to the R plane.
1. Objectives of the lesson
After this lesson the student will be able to understand what a canned drilling cycle is; drill a standard hole with G81; explain the role of the dwell in G82; peck-drill deep holes with G83; grasp the basic logic of the G84 tapping cycle; distinguish the Z, R, Q, P and F addresses; explain the difference between G98 and G99; and understand the importance of using G80 at the end of the cycle.
2. What is a canned drilling cycle?
Without a cycle we would have to repeat the same Z moves for every hole. With a canned cycle the drilling moves are defined once; the following lines only give the new hole positions. For example after G81 Z-15. R5. F120.; is defined, the lines X50. Y20.; and X80. Y20.; open new holes under the same conditions. This structure shortens the program and ensures the holes are machined under identical conditions.
3. Basic addresses
A simple drilling cycle is written as G81 X20. Y20. Z-15. R5. F120.;. Addresses: X Y the hole center position, Z the final hole depth, R the approach plane where the cutting feed begins, F the drilling feed rate. Some cycles also use Q (depth taken per peck) and P (dwell time at the hole bottom).
4. What is the R plane?
R is the level where the tool switches from rapid to cutting feed. For example in G81 Z-15. R3. F120.; the tool rapids to the hole center, rapids to the R3 plane, feeds from the R plane to Z−15 at F120, and retracts when the hole is complete. The R plane must be a safe distance above the part; if the part top face is Z0, R3 means the tool starts drilling 3 mm above the surface. If R is too low the tool rapids close to the surface/clamp; if too high the cycle time is needlessly extended.
5. G81 – Standard drilling cycle
G81 is used for simple drilling operations. General format: G81 X... Y... Z... R... F...;.
G90 G54 G00 X20. Y20.;
G43 H03 Z50.;
G98 G81 Z-12. R3. F120.;
X50. Y20.;
X80. Y20.;
G80;In this program three holes (X20 Y20, X50 Y20, X80 Y20), hole depth 12 mm, R plane 3 mm above the part, feed 120 mm/min. G81 is mostly used for standard drilling, center-drilling, short easy-to-clear holes and some simple countersinks. In deep holes, since chip evacuation is difficult, G83 is more suitable.
6. G82 – Dwell cycle at the hole bottom
G82 dwells briefly when the tool reaches Z depth and then retracts. General format: G82 X... Y... Z... R... P... F...;. Example: G82 X20. Y20. Z-5. R2. P500 F100.; — Z−5 final depth, R2 approach plane, P500 dwell, F100 feed. How the dwell is interpreted varies by FANUC model; on some systems P is millisecond-based, so the real machine manual must be checked. G82 is used for flat-bottom countersinks, operations needing a short dwell at the bottom, holes where surface quality is desired, and center/spot drilling. If the dwell is too long the tool can rub and heat at the hole bottom.
7. G83 – Peck deep drilling
If a deep hole is drilled in one pass, chips can jam in the drill flutes; the drill can break, the hole surface can spoil, the tool can overheat. G83 drills the hole in small steps rather than one pass; this is called peck drilling. General format: G83 X... Y... Z... R... Q... F...;. Example: G83 X30. Y30. Z-30. R3. Q5. F100.; — final depth Z−30, R3 plane, each plunge Q5, feed F100. The tool advances in ~5 mm steps, retracts to clear chips, and repeats until the hole is complete. Q is the approximate depth taken per peck; it is chosen by hole diameter, depth, drill type, material and coolant. Too large a Q reduces the chip-clearing benefit; too small a Q lengthens the operation.
8. Difference between G81 and G83
| Feature | G81 | G83 |
|---|---|---|
| Machining mode | Drills in one pass | Drills in small steps |
| Use | Standard and short holes | Deep holes |
| Chip evacuation | Limited | Better |
| Q value | Not used | Used |
| Cycle time | Shorter | Longer |
Simple selection logic: short and easy hole → G81; deep hole with chip-jam risk → G83.
9. G84 – Tapping cycle
G84 is the basic tapping cycle for cutting right-hand threads. General format: G84 X... Y... Z... R... F...;. In tapping the spindle rotation and Z-axis feed must be synchronized, so F is not chosen at random. For a metric tap the basic relation is F = n × P (F: mm/min feed, n: spindle rpm, P: thread pitch). For example an M8×1.25 tap at S400 rpm gives F = 400 × 1.25 = 500 mm/min:
S400 M03;
G84 X20. Y20. Z-15. R3. F500.;On FANUC systems rigid tapping may require additional commands such as M29, depending on the machine builder; the FANUC manual states that no axis or new S command should be written between M29 and G84. The real tapping program must be prepared according to the machine builder’s procedure.
10. Difference between G98 and G99
After a drilling cycle is complete, G98 or G99 selects the height the tool returns to. G98 – Return to the initial plane: after finishing the hole the tool returns to the first Z plane where the cycle began; safer when there are vise jaws, clamps or surfaces at different heights. G99 – Return to the R plane: the tool returns only to the R plane; faster because it gives a shorter move between holes, but if there is an obstacle between holes the tool can collide while moving at the R plane. On the first part or near clamping elements, G98 may be preferred.
11. G80 – Cancelling the canned cycle
A drilling cycle is a modal command; after G81 is written, the following X and Y coordinates are treated as new holes. So when the holes are complete the cycle must be cancelled with G80;. If G80 is not written, a later X or Y move can unintentionally start a new drilling operation. G80 is also used at a safe program start to cancel a previous cycle: G17 G21 G40 G49 G80 G90 G94;.
12. Simple drilling program with G81
Four holes at X20 Y20, X60 Y20, X60 Y50, X20 Y50. G81 is defined once; the other holes are given only with X and Y.
%
O1800 (G81 DRILLING);
G17 G21 G40 G49 G80 G90 G94;
T03 M06;
G54 S1200 M03;
G00 X20. Y20.;
G43 H03 Z50.;
M08;
G98 G81 Z-12. R3. F120.;
X60. Y20.;
X60. Y50.;
X20. Y50.;
G80;
G00 Z50.;
M09;
M05;
G49;
G91 G28 Z0.;
G90;
M30;
%13. Deep hole example with G83
Four holes 30 mm deep; each hole is machined with ~5 mm pecks.
%
O1810 (G83 DEEP HOLE);
G17 G21 G40 G49 G80 G90 G94;
T04 M06;
G54 S900 M03;
G00 X20. Y20.;
G43 H04 Z50.;
M08;
G98 G83 Z-30. R3. Q5. F90.;
X60. Y20.;
X60. Y50.;
X20. Y50.;
G80;
G00 Z50.;
M09;
M05;
G49;
G91 G28 Z0.;
G90;
M30;
%14. Which values are not rewritten in the same cycle?
After the cycle starts, the Z depth, R plane, Q value, F feed and G98/G99 selection remain modal; the following holes can be written only as X40. Y20.;. But if the depth or another value will change, the new value must be written explicitly: X40. Y20. Z-15.;.
15. Working sequence in a drilling cycle
A drilling program is generally prepared as: (1) call the tool, (2) select the workpiece zero, (3) start the spindle, (4) go to the X–Y center of the first hole, (5) call the tool length with G43 H, (6) turn on coolant, (7) start the G81/G82/G83/G84 cycle, (8) write the other hole coordinates, (9) cancel the cycle with G80, (10) retract the tool to a safe Z, (11) stop the coolant and spindle.
16. Points to check before drilling
- Are the drill diameter, tool H number, hole center and Z depth correct?
- In a blind hole, is the tip allowance accounted for; is the R plane above the part and clamping?
- Are the F feed and spindle rpm suitable; is G98/G99 safe; is G80 present at the end of the cycle?
17. Drill point angle and real hole depth
The Z value in the program mostly defines the point the drill tip reaches. Because the drill tip is conical, the programmed tip depth and the cylindrical full-diameter depth are not the same. For example if a blind hole must be full diameter over 15 mm, the drill tip must go deeper; this extra depth depends on the drill diameter and point angle. Basic rule: it must be checked whether the hole depth given on the drawing is the drill-tip depth or the full-diameter depth.
18. Points to check in G84 tapping
Before tapping: the correct pilot hole must be drilled, the tap pitch known, the hole deep enough, clearance left at the bottom of a blind hole, suitable lubrication used, the S and F values matched, and the tap’s rotation direction correct. A wrong feed value can cause the tap to jam or break. If the tap breaks, the broken tool piece and the hole must be checked before running the program again.
19. Common mistakes
- Forgetting G80: a hole may be drilled unintentionally on the next X–Y move.
- Writing the R plane too low: the tool rapids close to the surface/clamping.
- Writing the Z sign wrong: the tool does not go deep enough or advances toward the table.
- Not checking obstacles with G99: the tool can hit the vise moving low between holes.
- Choosing Q wrong in G83: large Q causes chip jam, small Q wastes time.
- Not calculating F by pitch in G84: the tap can break or the thread can spoil.
- Using the wrong H offset: all hole depths come out wrong or a collision occurs.
20. Basic commands used in this lesson
| Code | Function |
|---|---|
| G80 | Cancels the canned cycle |
| G81 | Standard drilling |
| G82 | Dwell drilling at the bottom |
| G83 | Peck deep drilling |
| G84 | Tapping |
| G98 | Returns to the initial plane |
| G99 | Returns to the R plane |
| X, Y | Hole center |
| Z | Final hole depth |
| R | Approach plane |
| Q | Peck amount |
| P | Dwell time |
| F | Feed rate |
21. Lesson summary
In this lesson we learned that canned cycles shorten drilling programs; that G81 is used for standard drilling; that G82 dwells at the hole bottom; that G83 drills the hole in small steps to ease chip evacuation; that G84 is the tapping cycle; that Z sets the hole depth, R the approach plane, Q the peck amount and P the dwell time; that G98 returns to the initial plane and G99 to the R plane; and that the cycle must be cancelled with G80 after drilling is finished.
📷 IMAGE AREA — The return difference between G98 initial plane and G99 R plane
Suggested alt text: Difference between G98 initial plane and G99 R plane return in CNC drilling cycles
Try it yourself: You can try the G81, G83 and G84 cycles covered in this lesson directly in your browser. Enter the part dimensions and hole positions, watch the toolpath in 3D and download the generated program: CNC Milling CAM Simulator and G Code Generator.