Tolvane

FANUC mill G and M codes

One code list from Tolvane, whole, as the apps show it: what each code does on a FANUC machining center, and how to write the common ones.

The apps hold the code lists of 18 control families, for mills and lathes, with a search box, beside the alarms and the calculators.

Your machine's builder comes first. A builder adds codes of its own, and can change what a code does. Check a code against the machine's manual before a program depends on it.

128 G codes · 18 M codes · Where the list comes from

G codes

CodeWhat it does
G00Rapid positioning
How to write it (1 needed, 1 optional)

G00 X_ Y_ Z_

  • X Y Z At least one
    Where the move ends: in G90 a position in the work offset, in G91 a distance from where the tool is. An axis left out does not move.
  • A B C Optional
    Rotary axes, on a machine that has them.

Example

G90 G54 G00 X2. Y1.5
Z0.1

Rapids to X2.0 Y1.5 in G54, then down to 0.1 above Z zero.

  • No F: the axes move at the rapid rate. On many FANUC machines each axis rapids at its own speed, so the path bends unless a parameter makes it straight. Bring Z down last and take it up first.
G01Linear feed
How to write it (2 needed, 2 optional)

G01 X_ Y_ Z_ F_

  • X Y Z At least one
    Where the move ends: in G90 a position in the work offset, in G91 a distance from where the tool is. An axis left out does not move.
  • F Needed unless set before
    Feed rate: inches per minute in G94, inches per turn of the spindle in G95. It stays in force, so it is needed on the first feed move and to change it.
  • ,C Optional
    A chamfer this long at the corner where this move meets the next one (on controls with chamfer and corner R).
  • ,R Optional
    A radius this size at the corner where this move meets the next one (on controls with chamfer and corner R).

Example

G01 Z-0.25 F10.
X3. F25.

Feeds down to 0.25 deep at 10 in/min, then across to X3.0 at 25 in/min.

  • If no F has been given yet, the control stops with a feed zero alarm.
G02Arc clockwise
How to write it (3 needed, 2 optional)

G02 X_ Y_ R_ F_G02 X_ Y_ I_ J_ F_

  • X Y Optional
    End point of the arc (in G17). Needed with R. Left out with I J, the arc is a full circle back to the start.
  • R Needed: R or I J
    Radius. Plus for an arc of 180° or less, minus for more than 180°. R cannot make a full circle.
  • I J Needed: R or I J
    The center, as the distance from the start point to the center along X (I) and Y (J), with its sign, always incremental. One that is zero may be left out.
  • Z Optional
    A Z move during the arc makes a helix.
  • F Needed unless set before
    Feed rate: inches per minute in G94, inches per turn of the spindle in G95. It stays in force, so it is needed on the first feed move and to change it.

Example

G01 X1. Y0. F15.
G02 X0. Y-1. R1.

From X1 Y0 cuts a quarter circle clockwise around X0 Y0 to X0 Y-1. G02 X0. Y-1. I-1. cuts the same arc with the center given instead of the radius.

  • The plane picks the axes: G17 is X Y with I J (the usual one on a mill), G18 is Z X with K I, G19 is Y Z with J K.
  • Clockwise is as seen from the plus side of the third axis, looking down on the plane: from above for G17.
G2.2Involute interpolation, clockwise
G2.3Exponential interpolation, clockwise
G2.43D circular interpolation, clockwise
G03Arc counter-clockwise
How to write it (3 needed, 2 optional)

G03 X_ Y_ R_ F_G03 X_ Y_ I_ J_ F_

  • X Y Optional
    End point of the arc (in G17). Needed with R. Left out with I J, the arc is a full circle back to the start.
  • R Needed: R or I J
    Radius. Plus for an arc of 180° or less, minus for more than 180°. R cannot make a full circle.
  • I J Needed: R or I J
    The center, as the distance from the start point to the center along X (I) and Y (J), with its sign, always incremental. One that is zero may be left out.
  • Z Optional
    A Z move during the arc makes a helix.
  • F Needed unless set before
    Feed rate: inches per minute in G94, inches per turn of the spindle in G95. It stays in force, so it is needed on the first feed move and to change it.

Example

G01 X1. Y0. F15.
G03 X0. Y1. R1.

From X1 Y0 cuts a quarter circle counterclockwise around X0 Y0 to X0 Y1. G03 X0. Y1. I-1. cuts the same arc with the center given instead of the radius.

  • The plane picks the axes: G17 is X Y with I J (the usual one on a mill), G18 is Z X with K I, G19 is Y Z with J K.
  • Clockwise is as seen from the plus side of the third axis, looking down on the plane: from above for G17.
G3.2Involute interpolation, counter-clockwise
G3.3Exponential interpolation, counter-clockwise
G3.43D circular interpolation, counter-clockwise
G04Dwell
How to write it (2 needed)

G04 X_G04 P_

  • X Needed: X or P
    Dwell in seconds, with a decimal point: X1.5 is 1.5 seconds.
  • P Needed: X or P
    Dwell in milliseconds, with no decimal point: P1500 is 1.5 seconds.

Example

G04 P500

Waits half a second.

  • It acts on its own line only.
G05High-speed cycle machining
G5.1AI contour control
How to write it (1 needed)

G05.1 Q1G05.1 Q0

  • Q Needed
    1 turns it on, 0 turns it off.

Example

G05.1 Q1
G01 X1. Y1. F100.
X1.05 Y1.02
G05.1 Q0

Turns look-ahead on for a run of short moves, then off again.

  • An option of the control. Builders add words of their own (a precision level, for one); the machine's manual says which.
G5.4HRV3 or HRV4 servo control on or off
G6.2NURBS interpolation
G07Hypothetical axis interpolation
G7.1Cylindrical interpolation
G08Look-ahead control
G09Exact stop
G10Programmable data input
How to write it (3 needed, 1 optional)

G10 L2 P_ X_ Y_ Z_G10 L10 P_ R_

  • L Needed
    What to set: L2 a work offset G54 to G59, L20 an extra work offset G54.1 P1 to P48, L10 a tool length, L11 a length wear, L12 a cutter radius, L13 a radius wear. L10 to L13 are for the usual tool offset memory (memory C); on a control with one offset table the numbers differ.
  • P Needed
    Which one. With L2: 1 to 6 for G54 to G59, 0 for the external offset that shifts them all. With L20: the G54.1 P number. With L10 to L13: the offset number (the H or D number).
  • X Y Z Optional
    With L2 or L20: the offset values. An axis left out keeps its value.
  • R Needed
    With L10 to L13: the offset value.

Example

G90 G10 L2 P1 X-12.5 Y-8.25 Z-15.1
G90 G10 L10 P5 R6.125

Sets G54 to X-12.5 Y-8.25 Z-15.1, and the length in offset 5 to 6.125.

  • In G90 the values replace what is stored; in G91 they are added to it, so a program run twice in G91 adds twice.
  • The values go onto the offset pages and stay there after the program ends: check the pages after the first run.
G10.9Switch diameter or radius programming
G11Programmable data input cancel
G12.1Polar coordinate interpolation on (also G112)
G13.1Polar coordinate interpolation off (also G113)
G15Polar coordinates cancel
How to write it

G15

It takes no words of its own.

Example

G80 G15

Ends the drilling cycle and polar coordinates: X and Y are positions again.

G16Polar coordinates
How to write it (2 needed)

G17 G90 G16X_ Y_

  • X At least one of X / Y
    After G16 (in G17): the radius. In G90 it is measured from the work zero.
  • Y At least one of X / Y
    After G16 (in G17): the angle in degrees, counterclockwise from the plus X direction (3 o'clock). A line may give only a new angle; the radius stays.

Example

G17 G90 G16
G99 G81 X2. Y0. Z-0.5 R0.1 F8.
Y60.
Y120.
Y180.
Y240.
Y300.
G80 G15

Drills six holes on a 4.0 diameter circle around the work zero, 60° apart, then turns polar coordinates off.

  • To center the circle somewhere else, shift the zero there with G52 first, and back after.
  • Turn it off with G15; left on, every later X Y is read as a radius and an angle.
G17XY plane
How to write it

G17

It takes no words of its own.

Example

G90 G17 G40 G80

A usual safe start line: absolute, XY plane, cutter comp off, drilling cycle off.

  • G17 is the XY plane (drilling along Z), G18 the ZX plane, G19 the YZ plane.
G17.1Plane conversion of a G17 program
G18ZX plane
How to write it

G18

It takes no words of its own.

Example

G18
G01 X0. Z0. F10.
G02 X0.5 Z-0.5 R0.5
G17

Picks the ZX plane, cuts a quarter arc of 0.5 radius in X and Z, then goes back to the XY plane.

  • G17 is the XY plane (drilling along Z), G18 the ZX plane, G19 the YZ plane.
G19YZ plane
How to write it

G19

It takes no words of its own.

Example

G19
G01 Y0. Z0. F10.
G03 Y0.5 Z-0.5 R0.5
G17

Picks the YZ plane, cuts a quarter arc of 0.5 radius in Y and Z, then goes back to the XY plane.

  • G17 is the XY plane (drilling along Z), G18 the ZX plane, G19 the YZ plane.
G20Inch input
How to write it

G20

It takes no words of its own.

Example

G20
G90 G17 G40 G80

Inch from here on.

  • Write it on a line of its own at the top of the program, before any position, offset or feed is used. It should not change in the middle of a program.
G21Metric input
How to write it

G21

It takes no words of its own.

Example

G21
G90 G17 G40 G80

Metric from here on.

  • Write it on a line of its own at the top of the program, before any position, offset or feed is used. It should not change in the middle of a program.
G22Stored stroke check on
G23Stored stroke check off
G25Spindle speed fluctuation detection off
G26Spindle speed fluctuation detection on
G27Reference position return check
G28Return to reference position
How to write it (1 needed)

G91 G28 Z0

  • X Y Z At least one
    The axes to send home, and the point they pass through on the way, read in the present G90 or G91 mode. In G91, 0 means straight home from where the tool is. Only the axes written go home.

Example

G91 G28 Z0.
G90

Takes Z straight up to home, then goes back to absolute.

  • In G90, G28 Z0 first rapids to Z0 of the work offset, which can be at or inside the part. That is why it is written with G91.
  • Cutter comp should be off.
G29Return from reference position
G30Return to 2nd reference position
G30.1Floating reference position return
G31Skip function
G31.8EGB-axis skip
G33Thread cutting
G34Variable lead thread cutting
G35Circular thread cutting, clockwise
G36Circular thread cutting, counter-clockwise
G37Automatic tool length measurement
G38Cutter compensation: keep the offset vector
G39Corner offset circular interpolation
G40Cutter compensation cancel
How to write it (1 needed)

G40 G01 X_ Y_

  • X Y At least one
    A straight move clear of the part; comp comes off during it.

Example

G40 G01 X-0.75 Y2.5

Turns cutter comp off while moving away from the part.

G40.1Normal direction control cancel
G41Cutter compensation left
How to write it (3 needed)

G41 G01 X_ Y_ D_ F_

  • D Needed
    Offset number holding the cutter radius (a parameter can make it the diameter).
  • X Y At least one
    The lead-in: a straight G00 or G01 move in the plane, longer than the cutter radius, ending at or near the start of the cut. Comp comes on during this move.
  • F Needed unless set before
    Feed rate: inches per minute in G94, inches per turn of the spindle in G95. It stays in force, so it is needed on the first feed move and to change it.

Example

G00 X-0.75 Y-0.75
G41 G01 X0. Y-0.25 D12 F20.
Y2.
G40 G01 X-0.75 Y2.5

Turns comp on to the left with the radius in D12 while moving to the part's left edge, cuts up the edge at X0, then turns comp off moving away.

  • Left and right are seen looking along the direction of travel. With a right-hand cutter in M03, G41 climb mills.
  • Go from G41 to G42 through G40. Turn comp off with G40 on a move clear of the part.
G41.1Normal direction control on (side: sources differ)
G42Cutter compensation right
How to write it (3 needed)

G42 G01 X_ Y_ D_ F_

  • D Needed
    Offset number holding the cutter radius (a parameter can make it the diameter).
  • X Y At least one
    The lead-in: a straight G00 or G01 move in the plane, longer than the cutter radius, ending at or near the start of the cut. Comp comes on during this move.
  • F Needed unless set before
    Feed rate: inches per minute in G94, inches per turn of the spindle in G95. It stays in force, so it is needed on the first feed move and to change it.

Example

G00 X-0.75 Y2.75
G42 G01 X0. Y2.25 D12 F20.
Y0.
G40 G01 X-0.75 Y-0.5

Turns comp on to the right with the radius in D12 while moving to the part's left edge, cuts down the edge at X0, then turns comp off moving away.

  • Left and right are seen looking along the direction of travel. With a right-hand cutter in M03, G41 climb mills.
  • Go from G41 to G42 through G40. Turn comp off with G40 on a move clear of the part.
G42.1Normal direction control on (side: sources differ)
G43Tool length compensation +
How to write it (1 needed, 1 optional)

G43 H_ Z_

  • H Needed
    Offset number with the tool's length, usually the same number as the tool (T5, H5).
  • Z Optional
    The first Z position with the offset on, usually a safe height above the part. Written on the same line, the first move with the offset is plain to see.

Example

T5 M06
G90 G54 G00 X1. Y1. S3000 M03
G43 H5 Z1. M08

After the tool change, turns on length offset 5 while moving Z to 1.0 above Z zero.

  • A wrong H number puts the tool off by the difference in lengths: check it matches the tool. G49 (or H0) turns it off.
G43.1Tool length compensation along the tool axis
G44Tool length compensation -
G45Tool offset increase
G46Tool offset decrease
G47Tool offset double increase
G48Tool offset double decrease
G49Tool length compensation cancel
G50Scaling cancel
G50.1Programmable mirror image cancel
G50.2Polygon turning cancel
G51Scaling
G51.1Programmable mirror image
G51.2Polygon turning on
G52Local coordinate system
How to write it (1 needed)

G52 X_ Y_ Z_G52 X0 Y0 Z0

  • X Y Z At least one
    How far the zero moves from the work offset's zero. The shift applies in every work offset (G54 to G59) until it is set back to 0.

Example

G52 X3. Y2.
G81 X0. Y0. Z-0.5 R0.1 F8.
G80
G52 X0. Y0.

Moves the zero 3.0 in X and 2.0 in Y, drills a hole at the new zero, then puts the zero back.

  • Set it back with G52 X0 Y0 Z0. Left on, the next part is cut in the wrong place (on many controls a reset or M30 clears it, by a parameter).
G53Machine coordinate system
How to write it (1 needed)

G53 X_ Y_ Z_

  • X Y Z At least one
    Position in the machine's own coordinates, measured from home. The move is a rapid.

Example

G90 G53 G00 Z0.

Rapids Z to machine zero, the top of travel on most machining centers.

  • Write it in G90: a FANUC control ignores incremental values with G53. Turn cutter comp off first.
G53.2Machine coordinate positioning at a feed rate
G54Work offset G54
How to write it

G54

It takes no words of its own.

Example

G90 G54 G00 X0. Y0.

Picks work offset 1 (G54) and rapids to its zero.

  • The values are on the work offset page. It stays in effect until another is picked. G54.1 P1 to P48 gives more (an option).
G54.1Additional work offset
How to write it (1 needed)

G54.1 P_

  • P Needed
    Number of the extra work offset: 1 to 48, or up to 300 with the larger option.

Example

G90 G54.1 P7 G00 X0. Y0.

Picks extra work offset 7 and rapids to its zero.

  • The extra offsets are an option of the control.
G55Work offset G55
How to write it

G55

It takes no words of its own.

Example

G90 G55 G00 X0. Y0.

Picks work offset 2 (G55) and rapids to its zero.

  • The values are on the work offset page. It stays in effect until another is picked. G54.1 P1 to P48 gives more (an option).
G56Work offset G56
How to write it

G56

It takes no words of its own.

Example

G90 G56 G00 X0. Y0.

Picks work offset 3 (G56) and rapids to its zero.

  • The values are on the work offset page. It stays in effect until another is picked. G54.1 P1 to P48 gives more (an option).
G57Work offset G57
How to write it

G57

It takes no words of its own.

Example

G90 G57 G00 X0. Y0.

Picks work offset 4 (G57) and rapids to its zero.

  • The values are on the work offset page. It stays in effect until another is picked. G54.1 P1 to P48 gives more (an option).
G58Work offset G58
How to write it

G58

It takes no words of its own.

Example

G90 G58 G00 X0. Y0.

Picks work offset 5 (G58) and rapids to its zero.

  • The values are on the work offset page. It stays in effect until another is picked. G54.1 P1 to P48 gives more (an option).
G59Work offset G59
How to write it

G59

It takes no words of its own.

Example

G90 G59 G00 X0. Y0.

Picks work offset 6 (G59) and rapids to its zero.

  • The values are on the work offset page. It stays in effect until another is picked. G54.1 P1 to P48 gives more (an option).
G60Single direction positioning
G61Exact stop mode
G62Automatic corner override
G63Tapping mode
G64Cutting mode
G65Macro call
How to write it (1 needed, 2 optional)

G65 P_ L_ A_ B_ C_

  • P Needed
    Number of the program to call (its O number).
  • L Optional
    How many times to run it, 1 if left out.
  • A to Z Optional
    Values handed to the macro: A goes to #1, B #2, C #3, I #4, J #5, K #6, D #7, E #8, F #9, H #11, M #13, Q #17, R #18, S #19, T #20, U #21, V #22, W #23, X #24, Y #25, Z #26. G, L, N, O and P cannot be used.

Example

G65 P9100 X2. Y1. Z-0.5

Runs O9100 once with #24 = 2.0, #25 = 1.0 and #26 = -0.5.

  • Unlike M98, the macro gets its own local variables (#1 to #33), filled from the letters.
G66Modal macro call
G66.1Modal macro call (every block)
G67Modal macro call cancel
G68Coordinate rotation
How to write it (1 needed, 1 optional)

G68 X_ Y_ R_G69

  • X Y Optional
    Center of rotation, a position in the work offset (in G17). Left out, the center is where the tool stands.
  • R Needed
    Angle in degrees, counterclockwise positive.

Example

G68 X0. Y0. R30.
G01 X2. Y0. F20.
G69

Turns the coordinates 30° counterclockwise about X0 Y0, so the move to X2 Y0 runs along a line at 30°. G69 turns it off.

  • It works in the plane in effect (G17 as a rule). Turn it off with G69 as soon as the feature is done. An option on some controls.
G69Coordinate rotation cancel
G72.1Figure copy, rotation
G72.2Figure copy, linear
G73High-speed peck drilling cycle
How to write it (4 needed, 2 optional)

G73 X_ Y_ Z_ R_ Q_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • Q Needed
    Depth of each peck, a positive number. Between pecks the drill backs off a small set amount (a parameter) to break the chip; it does not leave the hole.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G99 G73 X1. Y1. Z-0.5 R0.1 Q0.1 F10.
X2.
G80

Drills at X1 Y1 to 0.5 deep in 0.1 pecks, back to R between holes, then the same at X2 Y1. G80 ends the cycle.

  • For deep holes where chips pack, G83 clears them by going back out to R every peck.
G74Left-hand tapping cycle
How to write it (3 needed, 3 optional)

M29 S_G74 X_ Y_ Z_ R_ P_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • P Optional
    Dwell at the bottom in milliseconds, with no decimal point: P500 is half a second. Left out, no dwell.
  • F Needed unless set before
    Feed: the pitch times the rpm in G94 (in/min), or the pitch in G95.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

M29 S500
G90 G99 G74 X1. Y1. Z-0.5 R0.2 F25.
G80

Rigid taps a 1/4-20 left-hand thread 0.5 deep at 500 rpm (500 ÷ 20 = 25 in/min).

  • With a floating tap holder, start the spindle in reverse (M04) first; the cycle reverses it at the bottom. With rigid tapping (M29 S on most machines) the cycle runs the spindle itself.
G76Fine boring cycle
How to write it (4 needed, 3 optional)

G76 X_ Y_ Z_ R_ Q_ P_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • Q Needed
    How far the bar moves off the wall at the bottom, after the spindle orients, before it rapids out. A positive number; the direction is set in a parameter.
  • P Optional
    Dwell at the bottom in milliseconds, with no decimal point: P500 is half a second. Left out, no dwell.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G98 G76 X1. Y1. Z-0.75 R0.1 Q0.01 F4.
G80

Bores at X1 Y1 to 0.75 deep, orients the spindle at the bottom, moves 0.010 off the wall and rapids out without marking the bore.

  • When the spindle orients, the cutting tip must point the opposite way from the shift; pointing the same way, the shift drives the tip into the wall. Check it at the machine before the first cut.
G80Canned cycle cancel
How to write it

G80

It takes no words of its own.

Example

G80

Ends the cycle: X Y moves after it are plain moves again.

  • Write it after the last hole: a cycle left on makes a hole at every later X Y move.
G80.5Electronic gear box 2 pair: sync cancel
G80.8Electronic gear box: sync cancel
G81Drilling cycle
How to write it (3 needed, 2 optional)

G81 X_ Y_ Z_ R_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G99 G81 X1. Y1. Z-0.3 R0.1 F12.
X2.
X3.
G80

Drills three holes 0.3 deep along Y1, back to R (0.1) between them.

G81.1Chopping
G81.5Electronic gear box 2 pair: sync start
G81.8Electronic gear box: sync start
G82Drilling cycle with dwell
How to write it (3 needed, 3 optional)

G82 X_ Y_ Z_ R_ P_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • P Optional
    Dwell at the bottom in milliseconds, with no decimal point: P300 is 0.3 seconds. Left out, no dwell, the same as G81.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G99 G82 X1. Y1. Z-0.1 R0.1 P300 F8.
G80

Spots a hole 0.1 deep and waits 0.3 seconds at the bottom for a clean bottom.

G83Peck drilling cycle
How to write it (4 needed, 2 optional)

G83 X_ Y_ Z_ R_ Q_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • Q Needed
    Depth of each peck, a positive number. After each peck the drill rapids out to R to clear the chips, then back down to just above the last depth (a parameter sets how far above).
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G99 G83 X1. Y1. Z-1.25 R0.1 Q0.2 F8.
G80

Drills 1.25 deep in pecks of 0.2, going out to R after each one to clear the chips.

G84Tapping cycle
How to write it (3 needed, 4 optional)

M29 S_G84 X_ Y_ Z_ R_ P_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • P Optional
    Dwell at the bottom in milliseconds, with no decimal point: P500 is half a second. Left out, no dwell.
  • F Needed unless set before
    Feed: the pitch times the rpm in G94 (in/min), or the pitch in G95. For 1/4-20 at 600 rpm: 600 ÷ 20 = 30 in/min.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.
  • Q Optional
    Depth of each peck for peck tapping, on machines set up for it (a parameter). Left out, one pass.

Example

M29 S600
G90 G99 G84 X1. Y1. Z-0.5 R0.2 F30.
G80

Rigid taps a 1/4-20 hole 0.5 deep at 600 rpm (600 ÷ 20 = 30 in/min).

  • M29 S makes it rigid on machines that use M29; the builder picks the M number, and some machines are rigid without it. With a floating holder, start the spindle forward (M03) first.
G84.2Rigid tapping cycle (FS15 format)
G84.3Left-hand rigid tapping cycle (FS15 format)
G85Boring cycle, feed out
How to write it (3 needed, 2 optional)

G85 X_ Y_ Z_ R_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G99 G85 X1. Y1. Z-0.5 R0.1 F6.
G80

Reams 0.5 deep, feeding out the same way it fed in.

G86Boring cycle, spindle stop, rapid out
How to write it (3 needed, 2 optional)

G86 X_ Y_ Z_ R_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G98 G86 X1. Y1. Z-0.5 R0.1 F5.
G80

Bores 0.5 deep, stops the spindle at the bottom and rapids out; the tool can leave a line on the wall.

  • The spindle starts again at the R level or the starting level.
G87Back boring cycle
G88Boring cycle, dwell, manual out
G89Boring cycle, dwell, feed out
How to write it (3 needed, 3 optional)

G89 X_ Y_ Z_ R_ P_ F_ K_

  • X Y Optional
    Where the hole is. Left out, the hole is made where the tool stands. Each later line with only X Y makes one more hole the same way.
  • Z Needed
    Bottom of the hole. In G90 a Z position; in G91 the distance down from the R level. It stays for the next holes until G80.
  • R Needed
    The R level, where the feed starts, a little above the part. In G90 a Z position; in G91 the distance down from the starting height. Write it on the first hole; it stays until G80.
  • P Optional
    Dwell at the bottom in milliseconds, with no decimal point: P500 is half a second. Left out, no dwell.
  • F Needed unless set before
    Feed down the hole, in/min in G94.
  • K Optional
    How many times to repeat the hole, 1 if left out. In G91 each repeat moves by X Y again, making a row of holes; K0 stores the cycle without making a hole. Older controls use L.

Example

G90 G99 G89 X1. Y1. Z-0.5 R0.1 P500 F5.
G80

Bores 0.5 deep, waits half a second at the bottom, then feeds out.

G90Absolute programming
How to write it

G90

It takes no words of its own.

Example

G90 G00 X1. Y1.
G91 G01 X0.5 F10.
G90

Rapids to X1 Y1, feeds 0.5 further in X (to X1.5), then goes back to absolute.

  • It stays in effect until changed. A program left in G91 by mistake makes every later position a distance.
G91Incremental programming
How to write it

G91

It takes no words of its own.

Example

G90 G00 X1. Y1.
G91 G01 X0.5 F10.
G90

Rapids to X1 Y1, feeds 0.5 further in X (to X1.5), then goes back to absolute.

  • It stays in effect until changed. A program left in G91 by mistake makes every later position a distance.
G91.1Check the maximum incremental amount
G92Work coordinate system setting
G92.1Work coordinate system preset
G93Inverse time feed
G94Feed per minute
How to write it

G94

It takes no words of its own.

Example

G95 G01 Z-0.5 F0.004
G94

Feeds down at 0.004 per turn of the spindle, then goes back to inches per minute.

G95Feed per revolution
How to write it

G95

It takes no words of its own.

Example

G95 G01 Z-0.5 F0.004
G94

Feeds down at 0.004 per turn of the spindle, then goes back to inches per minute.

G96Constant surface speed
G97Constant surface speed cancel
G98Canned cycle return to initial level
How to write it

G98 G81 X_ Y_ Z_ R_ F_G99 G81 X_ Y_ Z_ R_ F_

It takes no words of its own.

Example

G90 G00 Z1.
G98 G81 X1. Y1. Z-0.5 R0.1 F10.
X3.
G80

Drills two holes and goes back to Z1.0, the starting height, after each, to clear a clamp between them. With G99 it would go back only to R (0.1).

  • G98: back to the starting level (the Z where the cycle began). G99: back to R. Use G98 to hop over clamps.
G99Canned cycle return to R level
How to write it

G98 G81 X_ Y_ Z_ R_ F_G99 G81 X_ Y_ Z_ R_ F_

It takes no words of its own.

Example

G90 G00 Z1.
G99 G81 X1. Y1. Z-0.5 R0.1 F10.
X3.
G80

Drills two holes and goes back only to R (0.1) after each, the quick way when nothing stands between them. With G98 it would go back to Z1.0, the starting height.

  • G98: back to the starting level (the Z where the cycle began). G99: back to R. Use G98 to hop over clamps.
G107Cylindrical interpolation (same as G07.1)
G112Polar coordinate interpolation on (same as G12.1)
G113Polar coordinate interpolation off (same as G13.1)

M codes

CodeWhat it does
M00Program stop
How to write it

M00

It takes no words of its own.

Example

M05
M09
M00 (TURN THE PART OVER)

Stops the program; Cycle Start goes on from the next line.

  • Whether M00 itself stops the spindle and coolant is up to the builder: stop them first, as here, and start them again after.
M01Optional stop
How to write it

M01

It takes no words of its own.

Example

M01

Stops only when the Optional Stop switch is on; otherwise the program goes on.

M02Program end
M03Spindle forward
How to write it (1 needed)

S_ M03

  • S Needed unless set before
    Spindle speed in rpm. It stays until changed, so it is needed on the first start.

Example

S2500 M03

Starts the spindle clockwise, as seen from above, at 2500 rpm.

M04Spindle reverse
How to write it (1 needed)

S_ M04

  • S Needed unless set before
    Spindle speed in rpm. It stays until changed, so it is needed on the first start.

Example

S800 M04

Starts the spindle counterclockwise, as seen from above, at 800 rpm, for a left-hand tool.

M05Spindle stop
How to write it

M05

It takes no words of its own.

Example

M05

Stops the spindle.

M06Tool change
How to write it (1 needed)

T_ M06

  • T Needed
    The tool to put in the spindle. On most machines a T on an earlier line already brings that pocket to the change position (pre-staging).

Example

G91 G28 Z0.
G90
T12 M06
T7

Takes Z home, changes to tool 12, then brings tool 7 ready for the next change.

  • How it works is up to the builder: some need Z at a set height first (G28 or G30), some do it themselves. Check the machine's manual.
M07Coolant 2 (mist or high pressure)
M08Coolant on
How to write it

M08

It takes no words of its own.

Example

G43 H5 Z1. M08

Turns flood coolant on as the tool comes down.

M09Coolant off
How to write it

M09

It takes no words of its own.

Example

G00 Z1. M09

Turns coolant off as the tool lifts clear.

M10Clamp (often a rotary axis)
M11Unclamp (often a rotary axis)
M19Spindle orientation
How to write it

M19

It takes no words of its own.

Example

M19

Stops the spindle at its set angle, for a tool change or a boring bar.

  • Set by the builder; some take an angle with it.
M29Rigid tapping mode
How to write it (1 needed)

M29 S_

  • S Needed
    Spindle speed for the tap, in rpm.

Example

M29 S600
G90 G99 G84 X1. Y1. Z-0.5 R0.2 F30.
G80

Rigid taps a 1/4-20 hole at 600 rpm.

  • The builder picks the M number for rigid tapping (M29 is the usual one); some machines are set so G84 is always rigid.
M30Program end and rewind
How to write it

M30

It takes no words of its own.

Example

M05
M09
G91 G28 Z0.
G90
M30

Stops the spindle and coolant, sends Z home, then ends the program and goes back to its start, ready for the next part.

M98Subprogram call
How to write it (1 needed, 1 optional)

M98 P_ L_

  • P Needed
    The program to call (its O number).
  • L Optional
    How many times to run it, 1 if left out. Many controls also read the count written in front of a four-digit number: P30100 runs O0100 three times.

Example

M98 P1000 L2

Runs O1000 twice, then goes on with the next line.

  • The subprogram ends with M99. It shares the variables of the program that calls it.
M99Subprogram return
How to write it (1 optional)

M99M99 P_

  • P Optional
    A line number (N) in the calling program to go back to, instead of the line after the call.

Example

O1000
G91 G01 Z-0.05 F10.
G90
M99

The end of subprogram O1000: M99 goes back to the program that called it.

  • In a main program, M99 goes back to its start and runs it again until reset.
M198External subprogram call

Where the list comes from

Each meaning and each note is written in Tolvane's own words, from these pages and manuals: