CNC

Peck drilling program generator

A ready G81, G73 or G83 program with peck depth and count worked out.

Cycle

Enter the drill Ø, depth, RPM and feed.

Control
Units

Below Z0, point included

Drill
Coolant through the drill

Blank: 1 × drill Ø

Need the RPM and feed? The drilling calculator works them out for your drill and material.

Above Z0

Clear of clamps

Between holes

What next

What RPM and feed for this drill?Drill RPM, feed and the right peck cycle for your drill, material and hole depth.
What tapping cycle and feed?A rigid or floating tapping program with the right feed for any thread and control.
Will this program run clean?A searchable G and M code list, and a checker that flags common program mistakes.
How the peck drilling program generator works

A 1/4" HSS drill going 1.5" deep is 6×D, past the 3×D where pecking starts, so it pecks with G83 (full retract); solid carbide breaks the chip with G73 instead. At Q = 1×D = 0.25", from R0.1 that is 1.6 ÷ 0.25 = 6.4, so 7 pecks. Pick Haas, LinuxCNC or Mach4 for the program.

How to program a peck drilling cycle (G83 and G73)

Maintained by John, former CNC lathe programmer

What it calculates

A peck drilling cycle drills a deep hole in bites. G83 pulls the drill all the way out to the R plane after each peck so the chips clear and coolant gets in; G73 backs off only a little to snap the chip, which is faster but leaves the chips in the hole. G81 drills straight to depth with no pecks, for shallow holes.

This generator writes the whole block for your holes: the cycle picked from the depth and the drill, the peck Q, the number of pecks a hole, the R and initial planes, G98 or G99 between holes, and G80 to finish. It writes Haas, LinuxCNC or Mach4 syntax and lists what that control does differently in its retracts. Speeds and feeds come from the drilling calculator, which works them out for your drill and material.

The formulas

When to peck

depth ÷ D ≤ 3 → G81

deeper → G83 (HSS, cobalt) or G73 (solid carbide)

D
drill Ø
3×D
the shop rule the drilling calculator uses; carbide with coolant through the drill goes to 8×D straight, and indexable drills never peck

Peck count

pecks = ⌈(R + depth) ÷ Q⌉

R
height of the R plane above Z0, where each hole starts feeding
depth
programmed Z below Z0, point included
Q
the peck; 1 × D unless you type your drill maker’s figure

The last peck is short whenever the division doesn’t come out even.

Worked example

Two 1/4" holes, 1.5" deep, with an HSS drill at 1,200 RPM and 10 IPM, R0.1, on a Haas.

  1. 1.5 ÷ 0.25 = 6×D, past 3×D, and the drill is HSS: G83.
  2. Q = 1 × D = 0.25".
  3. From R0.1 to Z-1.5 is 1.6"; 1.6 ÷ 0.25 = 6.4, so 7 pecks, the last one short.
  4. G99 G83 X1. Y1. Z-1.5 R0.1 Q0.25 F10. on the first hole, then X2. Y1. for the second, then G80.

G83, Q0.25, 7 pecks a hole; one cycle line plus one line per extra hole.

How to use it

What you enter

Control
Haas, LinuxCNC or Mach4: the words are the same, but each retracts its own way.
Drill Ø and depth
Depth is the programmed Z below the top of the part, with the point included for a blind hole.
Drill and coolant
HSS and cobalt pull out with G83; solid carbide breaks the chip with G73; coolant through a carbide drill lets it go deeper without pecking.
Peck (Q)
Leave it blank for 1 × D, or type your drill maker’s figure.
RPM and feed
Feed per minute, from the drilling calculator or your drill’s catalog.
Planes and holes
R just above the part, the initial plane clear of clamps, and one X, Y pair per line.

What you get

Cycle and Q
The cycle the depth calls for and the peck it uses.
Peck count
How many pecks each hole takes, counted from the R plane.
Program
A commented block to copy, with a link that opens it in the G-code checker.

Common mistakes

  • Counting pecks from the top of the part. Each hole starts feeding at R, so the first peck spends part of its length in air above the part.
  • G73 in a deep hole that packs. G73 never leaves the hole, so in deep holes and gummy materials the chips pack and the drill breaks. Use G83.
  • Forgetting G80. The cycle stays on, and the next X Y move drills another hole.
  • G99 over clamps. G99 returns only to R between holes; with a clamp in the way, use G98 and an initial plane above it.
  • Dropping the decimal point. On Fanuc-style controls Z1 can mean 0.0001"; the program writes Z1. with its point.

Sources

Each control’s words and retract behaviour are from its own maker: Haas’s code pages, the LinuxCNC documentation and Artsoft’s Mach4 guide. The 3×D point where pecking starts and the 1×D peck are the shop rule the drilling calculator already uses. No two drill makers print the same peck by material, so the peck is left for your drill maker’s figure rather than averaged.

How we pick and check sources