Free calculator
G-Code Generator — Pockets, Facing, Contours, Slots and Drill Grids without CAM
Write simple 2D programs without CAM. Choose an operation, enter the dimensions and copy a complete program with ramp or helix entry, depth passes and climb milling. Check it with one click in the 3D simulator.
How it works
Passes = depth / depth per pass, rounded up, then divided evenly · Pocket path = pocket size − tool Ø · Outside contour = part size + tool Ø.
How to use the program safely
- Set the work offset G54 to the front-left corner of the part and Z0 to the top face, or change the start X and Y.
- Enter speeds from the feeds and speeds calculator.
- Press "Cut it in the 3D simulator" and look at the result.
- Change the T and H numbers to your tool, then run the first part with single block and reduced rapid.
The tool centre path is calculated, so no G41 or D offset is needed. To correct a dimension, change the tool diameter in the form: a smaller value makes a pocket larger.
Embed this calculator on your site
Free for workshops, schools and forums — copy this snippet:
<iframe src="https://cnccode.com/embed/gcode-generator/" width="100%" height="720" style="border:0" loading="lazy" title="G-Code Generator"></iframe>More free CNC tools
- Bolt Circle Calculator
- Thread Milling Calculator
- G-Code Checker
- DXF to G-Code Converter
- Text Engraving G-Code
- Feeds & Speeds Calculator
- Drilling Speed & Feed Calculator
- Surface Finish Calculator
- Thread & Tap Drill Calculator
- Chip Thinning Calculator
- Machining Cost & Cycle Time Calculator
- Inch / mm / Fraction Converter
- G-Code Viewer & Simulator
- Lathe Turning Calculator
- All tools
Frequently asked questions
Which machines can run the generated code?
It is plain ISO code in mm with G00 to G03, G54, G43 and G81 or G83. Fanuc, Haas, Mach3, LinuxCNC and most other controls accept it. GRBL has no G43 H, G81 or tool change, so remove those lines there.
Why does the tool ramp into the pocket?
Most end mills cut badly straight down. A ramp or helix keeps the cutting edges engaged and lets chips escape, so the tool lives longer.
Can I make a finishing pass?
Yes. Generate the pocket with a slightly larger tool diameter than the real one, for example 10.2 mm for a 10 mm tool. That leaves 0.1 mm per side. Then generate it again with the real diameter.
Was this page helpful?