System variables list
FANUC Macro B system variables provide access to internal CNC control data including machine coordinates,
offsets, modal states, timers and so on. This makes them essential for advanced CNC automation.
Common use cases include probing and automatic offset adjustment, adaptive machining programs, tool life
tracking, and custom macro cycles. By using system variables, manufacturers can improve machining accuracy,
reduce setup time, and automate complex CNC processes.
Common system variables {{ fanucA }}{{ fanucB }}{{ fanucC }}{{ haas }}
| Variable |
Meaning |
| #3000 |
Custom alarm message |
| #3006 |
Operator message |
| #3001 |
This variable acts as a timer that counts continuously at 1 millisecond intervals. Upon reaching
2,147,483,648 milliseconds, the timer returns to 0. |
| #3011 |
This variable contains the current date (year/month/day). For example, February 01, 2020 is stored
as 20200201. |
| #3012 |
This variable contains the current time (hours/minutes/seconds). For example, 15 minutes and 10 seconds
after 4 p.m. is stored as 161510.
|
{{ back-2-manual }}
Tool data (mill) {{ fanucA }}{{ fanucB }}{{ fanucC }}
| Variable (200 tools max) or (up to 400) |
Meaning |
| #2201 - #2400 or #11001 - #11400 |
Tool length |
| #2001 - #2200 or #10001 - #10400 |
Tool length wear |
| #2401 - #2600 or #13001 - #13400 |
Tool radius |
| #2601 - #2800 or #12001 - #12400 |
Tool radius wear |
{{ back-2-manual }}
Tool data (lathe) {{ fanucA }}{{ fanucB }}{{ fanucC }}
| Variable (64 tools max) or (up to 160) |
Meaning |
| #2701 - #2764 or #10001 - #10160 |
X-axis offset |
| #2001 - #2064 or #15001 - #15160 |
X-axis offset wear |
| #2801 - #2864 or #11001 - #11160 |
Z-axis offset |
| #2101 - #2164 or #16001 - #16160 |
Z-axis offset wear |
| #2901 - #2964 or #12001 - #12160 |
Nose radius |
| #2201 - #2264 or #17001 - #17160 |
Nose radius wear |
| #2300 - #2364 or #13001 - #13160 |
Tool-tip direction |
{{ back-2-manual }}
Work offset variables {{ fanucA }}{{ fanucB }}
| Variable |
Meaning |
| #2500 - #2800 |
G53 |
| #2501 - #2801 |
G54 |
| #2502 - #2802 |
G55 |
| #2503 - #2803 |
G56 |
| #2504 - #2804 |
G57 |
| #2505 - #2805 |
G58 |
| #2506 - #2806 |
G59 |
{{ back-2-manual }}
Work offset variables {{ fanucC }}
| Variable |
Meaning |
| #5201 - #5205 |
G53 |
| #5221 - #5225 |
G54 |
| #5241 - #5245 |
G55 |
| #5261 - #5265 |
G56 |
| #5281 - #5285 |
G57 |
| #5301 - #5305 |
G58 |
| #5321 - #5325 |
G59 |
{{ back-2-manual }}
System variables {{ fanucA }}{{ fanucB }}
| Variable |
G-code |
Group number |
Description |
| #4001 |
G00 G01 G02 G03 G33 |
1 |
Motion control (rapid, linear, circular, etc). |
| #4002 |
G17 G18 G19 |
2 |
Plane selection. |
| #4003 |
G90 G91 |
3 |
Absolute / incremental command. |
| #4004 |
G22 G23 |
4 |
Stored stroke limit ON / OFF. |
| #4005 |
G93 G94 G95 |
5 |
Feedrate mode selection. |
| #4006 |
G20 G21 |
6 |
Units selection - Inch or metric programming units. |
| #4007 |
G40 G41 G42 |
7 |
Tool radius compensation - Canceled, left compensation, or right compensation. |
| #4008 |
G43 G44 G45 |
8 |
Tool length compensation - Positive, negative, or additional tool length compensation mode. |
| #4009 |
G73 G74 G76 G80-G89 |
9 |
Canned cycle mode - Active drilling, tapping, boring, threading, or cycle cancel command. |
| #4010 |
G98 G99 |
10 |
Canned cycle return mode - Return to initial point or R-point after cycle completion. |
| #4011 |
G50 G51 |
11 |
Scaling mode - Scaling canceled or enabled. |
| #4012 |
G65 G66 G67 |
12 |
Macro call mode - Simple macro call, modal macro call, or modal macro cancel. |
| #4013 |
G96 G97 |
13 |
Spindle speed mode - Constant surface speed or fixed RPM mode. |
| #4014 |
G54-G59 |
14 |
Work coordinate system - Active work offset selection. |
| #4015 |
G61-G64 |
15 |
Path control mode - Exact stop, automatic corner control, tapping mode, or continuous cutting mode.
|
| #4016 |
G68 G69 |
16 |
Coordinate rotation - Rotation enabled or canceled. |
| #4017 |
G15 G16 |
17 |
Coordinate input mode - Cartesian or polar coordinate programming. |
| #4019 |
G40.1 G41.1 G42.1 |
19 |
Normal direction control / Tool compensation type - Advanced cutter compensation mode. |
| #4022 |
G50.1 G51.1 |
22 |
Mirror image mode - Mirror image canceled or enabled. |
{{ back-2-manual }}
System variables {{ fanucC }}
| Variable - previous line |
Variable - current line |
G-code |
Group number |
Description |
| #4001 |
#4201 |
G00 G01 G02 G03 G33 |
1 |
Motion mode - Indicates the current movement command (rapid, linear interpolation, circular
interpolation, etc.). |
| #4002 |
#4202 |
G17 G18 G19 |
2 |
Plane selection - Active machining plane (XY, ZX, or YZ). |
| #4003 |
#4203 |
G90 G91 |
3 |
Positioning mode - Absolute or incremental programming. |
| #4004 |
#4204 |
G22 G23 |
4 |
Stored stroke check - Limit checking enabled or canceled. |
| #4005 |
#4205 |
G93 G94 G95 |
5 |
Feedrate mode - Inverse time, feed per minute, or feed per revolution. |
| #4006 |
#4206 |
G20 G21 |
6 |
Units selection - Inch or metric programming units. |
| #4007 |
#4207 |
G40 G41 G42 |
7 |
Tool radius compensation - Canceled, left compensation, or right compensation. |
| #4008 |
#4208 |
G43 G44 G45 |
8 |
Tool length compensation - Positive, negative, or additional tool length compensation mode. |
| #4009 |
#4209 |
G73 G74 G76
G80-G89 |
9 |
Canned cycle mode - Active drilling, tapping, boring, threading, or cycle cancel command. |
| #4010 |
#4210 |
G98 G99 |
10 |
Canned cycle return mode - Return to initial point or R-point after cycle completion. |
| #4011 |
#4211 |
G50 G51 |
11 |
Scaling mode – Scaling canceled or enabled. |
| #4012 |
#4212 |
G65 G66 G67 |
12 |
Macro call mode - Simple macro call, modal macro call, or modal macro cancel. |
| #4013 |
#4213 |
G96 G97 |
13 |
Spindle speed mode - Constant surface speed or fixed RPM mode. |
| #4014 |
#4214 |
G54-G59 |
14 |
Work coordinate system - Active work offset selection. |
| #4015 |
#4215 |
G61-G64 |
15 |
Path control mode - Exact stop, automatic corner control, tapping mode, or continuous cutting mode. |
| #4016 |
#4216 |
G68 G69 |
16 |
Coordinate rotation - Rotation enabled or canceled. |
| #4017 |
#4217 |
G15 G16 |
17 |
Coordinate input mode - Cartesian or polar coordinate programming. |
| #4018 |
#4218 |
G50.1 G51.1 |
18 |
Mirror image mode - Mirror image canceled or enabled. |
| #4019 |
#4219 |
G40.1 G41.1 G42.1 |
19 |
Normal direction control / Tool compensation type - Advanced cutter compensation mode. |
{{ back-2-manual }}
Other modal {{ fanucA }}{{ fanucB }}
| Variable |
Adress |
| #4102 |
"B" - axis position |
| #4107 |
"D" - cutter radius |
| #4108 |
"E" - feed rate (optional) |
| #4109 |
"F" - feed rate |
| #4111 |
"H" - tool length |
| #4113 |
"M" - miscellaneous |
| #4115 |
"O" - program number |
| #4119 |
"S" - speed rate |
| #4120 |
"T" - tool number |
{{ back-2-manual }}
Other modal {{ fanucC }}
| Variable - previous line |
Variable - current line |
Adress |
| #4102 |
#4302 |
"B" - axis position |
| #4107 |
#4307 |
"D" - cutter radius |
| #4108 |
#4308 |
"E" - feed rate (optional) |
| #4109 |
#4309 |
"F" - feed rate |
| #4111 |
#4311 |
"H" - tool length |
| #4113 |
#4313 |
"M" - miscellaneous |
| #4115 |
#4315 |
"O" - program number |
| #4119 |
#4319 |
"S" - speed rate |
| #4120 |
#4320 |
"T" - tool number |
{{ back-2-manual }}
Motion system variables
| Variable |
Meaning |
| #5001 |
Previous line (X) |
| #5002 |
Previous line (Y) |
| #5003 |
Previous line (Z) |
| #5041 |
Current line (X) |
| #5042 |
Current line (Y) |
| #5043 |
Current line (Z) |
{{ back-2-manual }}