CNC programming
G-code meanings, canned cycles and ready-to-run programs for mill and lathe controls.
I read the posted code before it goes to the machine. The simulator shows what I meant; the code shows what I wrote.
Quick numbers
G76 passes for an external 60° threadCalculators
- Peck drilling program generatorA G81, G73 or G83 program for your holes in Haas, LinuxCNC or Mach4 syntax: the cycle by depth and drill, Q and the peck count from the R plane.
- Tapping cycle program generatorA rigid or floating tapping program for any UN or metric thread: F = RPM × pitch in G94 or the pitch in G95, and the right code on Haas, LinuxCNC, Mach4, Mach3 or Fanuc.
- Work offset calculatorG54–G59 from an edge finder touch, both sides of a bore, or a Z touch-off, and the G10 line that writes it on Haas, LinuxCNC, Mach4 or Mach3.
- Cutter compensation (G41/G42)G41 or G42 for a profile or pocket, climb or conventional, a drawing of the tool-centre path, the lead-in rules and a program block.
- G-code list and checkerPaste a program: missing feeds, spindle off, bad arcs, modal conflicts, plus a code reference.
- G-code arc calculatorStart, end and R to the I/J/K for G02/G03, or R and an end-point check from I and J.
- Ramp angle and helix calculatorRamp angle to Z per turn for a helical entry, turns to depth and the centre feed; straight ramps too.
- Drilling speeds and feeds calculatorDrill, material and depth to RPM, feed, G81/G73/G83 and Z past the point.
- Single-point threading calculatorThread depth, compound setting, passes and infeed, the thread dial for your lathe, a G76 line for Fanuc or Haas, and the wire check.
- Thread milling calculatorA ready helical thread-milling program for UN and metric threads, inside or out: climb direction, radial passes, corrected feed and comp.
Fix a problem
- Broken tapsThe tap snaps in the hole, often at a depth that repeats, or on the way back out.
- Chips packing in blind holesChips jam in the flutes or the bottom of the hole: the tap binds, threads tear near the bottom, or the gauge won’t reach full depth.
- Chips recut or packing the flutesChips pile up in a slot or pocket and get cut again: scratched floors, a crunching sound, chips welded into the flutes.
- End mill or insert breaksThe tool snaps or a whole corner breaks out, often all at once: at the start of a cut, in a slot, or as it wears.
Charts
Guides
Show 4 guides
- Rotation and polar coordinatesG68 rotation, G16 polar mode, LinuxCNC’s @ and ^ words and G112 on a lathe: what each does, and where the controls disagree.
- Canned cycles G81–G89What each drilling, tapping and boring cycle does at the bottom and on the way out, when to peck, rigid vs floating taps.
- Work offsets explainedMachine zero vs work zero, G54–G59 and the extended sets, setting them with an edge finder, and why G10 L20 differs by control.
- Cutter compensation explainedG41 and G42: which side, climb vs conventional, wear vs full radius, the lead-in rules, and why comp alarms and gouges.
Sources
Sources3
- Kennametal — Threading technical data: infeed passes, minimum infeed, infeed angle (archived Jul 28, 2026)
- Carmex — Thread turning inserts technical section: recommended cutting speed (p. 56) and number of passes (p. 58) (archived Nov 13, 2026)
- Sandvik Coromant — Turning Tools 2020 catalogue, CoroCut XS cutting data: threading infeed recommendations (p. B136) (archived Nov 15, 2026)