Skip to content

G12 / G13: circular pocket clockwise and counterclockwise

G12 and G13 machine a complete circular pocket starting from the center, with the tool spiraling out to the diameter you ask for: G12 does it clockwise and G13 counterclockwise, which in practice decides whether you cut climb or conventional. They see heavy use on Haas because they save writing out the whole clearing spiral and the finish passes by hand. They are not universal: on Fanuc they depend on the installed option, and on Siemens or Heidenhain the job is done by their own pocket cycles.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

The brands and control names mentioned belong to their owners and are used only to identify the equipment. GetGCode is not affiliated with or endorsed by any manufacturer, ISO or ASME: this is our own content, not official documentation. Legal notice.

Family
Milling cycles
Machine
Milling, Mill-turn
Risk
Medium
Example
G12 I10 F200

Syntax by control

Haas (milling), single-pass pocket
G13 I10. F300
Clears a pocket out to a radius of 10 mm from the current position, at whatever depth the tool is at. This is the simplest form: use it when you have already brought Z down and only want to open up the circle.
Haas, pocket with multiple radial passes
G13 I5. K25. Q4. D01 F300
I is the starting radius, K the final radius and Q the radial step between passes. When K is greater than I you need Q, and if it is missing the control alarms out. D calls the tool radius offset.
Haas, pocket with multiple passes in Z
G13 I5. K25. Q4. Z-10. L3 D01 F300
Z gives the final depth and L the number of repeats in depth when combined with an incremental move. The exact behavior of L depends on the control version: check your machine manual before you trust it.
Fanuc
Depends on the installed option
On Fanuc, G12 and G13 are not part of the basic set: they exist on some controls and configurations as a circular pocket cycle, but you cannot take them for granted. Check your control's G code list before using them.
Siemens / Heidenhain (equivalents)
POCKET4(...) / CYCL DEF 252 CAJERA CIRCULAR
Siemens handles the circular pocket with POCKET4 and Heidenhain with its circular pocket cycle. There is no literal translation of the parameters: they are cycles with their own entry and finishing logic.

Address letters used with it

LetterWhat it setsUnit
IRadius of the first pass, measured from the center of the pocket, which is where the tool sits when the cycle is called. It has to be greater than the cutter radius.mm / in
KFinal radius of the finished pocket. If it is greater than I, the cycle makes several radial passes and needs Q.mm / in
QRadial step between successive passes. It sets how much material the cutter takes on each turn and, with that, the load on the tool.mm / in
DTool radius offset number. With D active, the cycle accounts for the actual cutter radius to reach the dimension; without it, the pocket comes out over or under by the cutter diameter depending on the control.offset number
ZFinal depth of the pocket. The cycle goes down to it before opening the spiral, or splits it into passes depending on the mode you use.mm / in
LNumber of repeats in depth. Its exact behavior varies with the control version, and it is the parameter most worth checking in the machine manual.integer
FCutting feed. The cycle applies it to both the spiral and the final contour pass.mm/min

Worked example

Circular pocket Ø50 mm and 8 mm deep in an aluminum plate, with a Ø12 three-flute end mill that does cut at center. The pocket is opened in two depth passes so as not to overload the tool, and the cycle is called with the tool already centered on the pocket axis.

O0130 (CAJERA CIRCULAR CON G13)
( Program header. )
G21 G17 G40 G49 G80
( Millimeters, XY plane and a clean state. )
G91 G28 Z0.
( Z to the reference point before the tool change. )
T2 M06
( Ø12 three-flute end mill. )
G90 G54 G00 X50. Y40.
( Positions over the center of the pocket. The cycle always starts from the center, so this point is critical. )
G43 H02 Z50. M03 S6000
( Tool length and spindle on. )
G00 Z1. M08
( Approach to 1 mm above the face and coolant on. )
G01 Z-4. F300
( First plunge, to half the depth. It can go straight down because this end mill cuts at center; with one that did not, you would have to ramp or helix in. )
G13 I7. K25. Q3. D02 F600
( Opens the pocket at this depth: starts at a radius of 7 mm, reaches a radius of 25 mm, in other words Ø50, and steps 3 mm of radius per pass. D02 applies the actual cutter radius so the wall ends up on size. )
G01 Z-8. F300
( Second plunge, now to final depth, with the tool still at the center because the cycle brought it back there. )
G13 I7. K25. Q3. D02 F600
( Repeats the clearing at final depth. Repeating the whole cycle is easier to read than playing with L when there are only two levels. )
G00 Z50. M09
( Rapid retract and coolant off. )
G91 G28 Z0. M05
( Z to the reference point and spindle stopped. )
G90 M30
( Back to absolute and end. )
Open the simulator to check the example

Practical keys to using G12/G13 in the workshop

G12 or G13, and what that has to do with climb milling

The only difference between the two is the direction of the spiral: G12 runs it clockwise and G13 counterclockwise. With a right-hand cutter running M03, the counterclockwise spiral of G13 climb cuts on the pocket wall, which gives a better finish and less wear in most materials. G12 cuts conventional, which can be useful on materials with a cast skin or when the machine has backlash and climb milling pushes the tool. In aluminum and ordinary steel, the default choice is G13.

Why the center matters more than it seems

The cycle does not receive the coordinates of the pocket center: it starts wherever the tool is at the moment of the call. That makes it very convenient, because the same block works for any pocket by changing only the positioning before it, and very easy to get wrong, because a position inherited from the previous operation opens the pocket somewhere else with nothing to warn you. The habit is to always put the G00 X Y of the center right before the cycle, even if it looks redundant, and not to trust that the tool is still where the previous block left it.

Starting radius, step and tool load

The first radius has to be greater than the cutter radius, because otherwise the tool would have to cut over itself. The Q step decides how much material comes off on each turn of the spiral, and it is the equivalent of the radial depth of a contouring pass: values on the order of a quarter or a third of the cutter diameter are reasonable for roughing. Set it too large and the cutter goes in with a very high engagement angle right at the start of each turn, and that is where the cutting edges chip.

Mistakes that cost you a part (or a tool)

  • Calling the cycle without having positioned the tool at the center of the pocket: the clearing happens wherever the cutter was, not where the pocket goes.
  • Setting a starting radius smaller than the cutter radius: the cycle alarms out or attempts an impossible move.
  • Forgetting Q when K is greater than I: the control does not know how far to step per pass and throws a missing parameter alarm.
  • Not calling the D offset and finding out that the pocket is off from the print by the cutter diameter.
  • Plunging straight down to depth with an end mill that does not cut at center, instead of ramping or helixing in before calling the cycle.
  • Copying a G12 or G13 to a Fanuc machine assuming it exists: on many controls it is not there and you get an invalid code alarm.
  • Using L without having checked in that machine's manual how it splits the depth passes.

Frequently asked questions

What is the difference between G12 and G13?

Only the direction of the spiral: G12 goes clockwise and G13 counterclockwise. With a right-hand cutter and normal spindle rotation, G13 climb cuts on the pocket wall and G12 cuts conventional. For finishing in aluminum or steel, G13 is the usual choice.

Do they work for non-circular pockets?

No. G12 and G13 only cut complete circular pockets from the center. For rectangular or free-form pockets, Haas has G150, which takes the contour from a subprogram, and Siemens and Heidenhain have their rectangular and contour pocket cycles.

Do G12 and G13 exist on Fanuc?

It depends on the control and the installed options. They are not part of the basic Fanuc set, so there are machines where they work and machines where they give an invalid code alarm. If the program has to be portable between brands, it is better to write the helical interpolation by hand with G02 or G03.

How do I leave finish stock?

The cleanest way is to rough with a K a little smaller than the final radius and then repeat the cycle with the final K and a finishing feed. You can also play with the radius offset, entering a slightly larger value for roughing, but that leaves the finish stock hidden in the tool table and it is easy to forget.

Can I use them to bore a large hole?

Yes, and it is one of their most practical uses: opening a hole with an end mill to a diameter larger than any drill you have available. What you have to watch is the entry, because plunging straight down at the center takes an end mill that cuts at center, and the wall finish, which improves a lot with one last turn at a small radial step.

Related codes

Related apps