5-AXIS NC SIMULATOR5-Axis CNC Simulator
Run 5-axis CNC programs with rotary axes (A, B, C) in your browser and check the cut part in 3D. It reads FANUC-style code: tool centre point control (G43.4, G43.5), tilted working planes (G68.2, G53.1) and Custom Macro B. The stock is held as a 3D grid, so side holes and undercuts that cannot be seen from above are cut as they really are. No sign-up and nothing to install.
Turn TCP off
and the tip
swings out!

Free play
The starting program tilts the same ball end mill by 30° with tool centre point control on (G43.4) and off (G43). At X-15 the tip stays put while only the tool leans; at X15 the tip swings through a big arc and gouges the top face. Press "Machine view" to see how the table actually tilts. Switch the machine layout and you will find that a program written with the A axis does not run on a head-type machine — it stops with an error.
Rotation directions (signs), the zero of C and the position of the rotation centre differ between machines; the values here are illustrative.
Commands this simulator reads
| Command | Meaning | How it is simulated |
|---|---|---|
| G43.4 H_ | Tool centre point control, type 1. X/Y/Z are the tool tip; A/B/C are the rotary-axis angles | The tip moves on a straight line in work coordinates; the angles change evenly within the block |
| G43.5 H_ I_ J_ K_ | Type 2. The tool direction is a vector I/J/K; the control works out the rotary angles from the machine layout | Write all three of I/J/K. Of the two possible angle solutions, the one closer to the current angles is used |
| G49 | Cancels tool length offset and tool centre point control | After it, X/Y/Z are read as positions of the machine’s linear axes |
| G68.2 X_ Y_ Z_ I_ J_ K_ | Defines the tilted working plane (feature coordinate system). X/Y/Z is the origin; I/J/K are Euler angles (rotate about Z, then the new X, then the new Z) | Euler angles only; roll-pitch-yaw, three-point and two-vector forms are not read |
| G53.1 | Points the tool normal to the tilted plane (indexes the rotary axes) | Only the rotary axes move; a warning appears if the tool is close to the stock |
| G69 | Cancels the tilted working plane | Coordinates return to the ordinary work system |
| A / B / C | Rotary axes: A (about X) and C (about Z) on a table-table machine; B (about Y) and C on head-table and head-head machines | Naming an axis the machine lacks is an error. The tilt axis travels ±120°; C turns without limit |
| G41 / G42 / G73–G89 / # / WHILE | Cutter compensation, canned cycles and Custom Macro B work as on a 3-axis machine | Inside a tilted plane they act in plane coordinates. 3D tool radius compensation for a tilted tool is not simulated |
Each control maker names and writes the same functions differently. This simulator reads only the FANUC-style syntax.
| NC | Tool centre point control | Tilted working plane |
|---|---|---|
| Siemens SINUMERIK | TRAORI | CYCLE800 |
| Heidenhain TNC | M128 / FUNCTION TCPM | PLANE SPATIAL and others |
| Haas | G234 (TCPC) | G268 |
| Mitsubishi Electric | G43.4 / G43.5 | inclined surface machining command |
Code numbers and availability depend on the control model and the machine builder’s options. Always check the manual for the real machine.
Exercises
13+2: a 45° face and a hole normal to it
Cut the top +Y edge of the block to a 45° face, then drill a φ6 hole 12 mm deep normal to that face at its centre. Tilt the coordinates with G68.2, point the tool with G53.1, and the rest is written like 3-axis code.
Hint
G68.2 X0 Y15. Z0 I0 J-45. K0 puts the origin on the top edge of the face with Z pointing out of it. The face spans Y' 0 to 21.2 mm; the hole is at Y' 10.607.
O5001 (3+2 KEISHAMEN TO ANA) G21 G90 G17 G40 G49 G80 G69 G54 G00 A0 C0 T1 M06 (FLAT D12) S5000 M03 M08 G68.2 X0 Y15. Z0 I0 J-45. K0 G53.1 G43 H1 Z50. #1 = 7. WHILE [#1 GE 0] DO1 G00 X-40. Y2. Z[#1 + 5.] G01 Z#1 F600 X40. F1200 Y10. X-40. Y18. X40. G00 Z[#1 + 5.] #1 = #1 - 3.5 END1 G00 Z50. M05 M09 G69 G49 G00 Z100. A0 C0 T2 M06 (DRILL D6) S2000 M03 M08 G68.2 X0 Y15. Z0 I0 J-45. K0 G53.1 G43 H2 Z50. G00 X0 Y10.607 G98 G81 Z-12. R3. F150 G80 G00 Z50. M05 M09 G69 G49 G00 Z100. A0 C0 M30
23+2: a side hole and a side slot (hidden from above)
Drill a φ8 hole 15 mm deep into the middle of the +Y side (Z-20) and mill a slot 10 wide, 5 deep and 30 long into the -X side. A height-map simulator cannot show these; here the sideways features are cut as they are. Use "Section" to look inside.
Hint
For the -X side use G68.2 X-30. Y0 Z-20. I90. J-90. K0. The first rotation I (about Z) swings Z' round to -X; X' is then work +Y and Y' is work -Z.
O5002 (3+2 SOKUMEN NO ANA TO MIZO) G21 G90 G17 G40 G49 G80 G69 G54 G00 A0 C0 T1 M06 (FLAT D10) S6000 M03 M08 (-X NO SOKUMEN : Z' GA -X MUKI) G68.2 X-30. Y0 Z-20. I90. J-90. K0 G53.1 G43 H1 Z50. G00 X-15. Y0 Z3. G01 Z-2.5 F200 X15. F800 Z-5. F200 X-15. F800 G00 Z50. M05 M09 G69 G49 G00 Z100. A0 C0 T2 M06 (DRILL D8) S1600 M03 M08 (+Y NO SOKUMEN) G68.2 X0 Y30. Z-20. I0 J-90. K0 G53.1 G43 H2 Z50. G00 X0 Y0 G98 G83 Z-15. R3. Q5. F160 G80 G00 Z50. M05 M09 G69 G49 G00 Z100. A0 C0 M30
3Simultaneous 5-axis: swarf-cut a 10° draft wall
Turn the φ56 round blank into a frustum with a 50 mm base and a 10° draft, 20 mm deep. The side of the tool rides on the wall, so use G43.5 (tool axis given by I/J/K) and step the tip position and direction every 5° round the part. The floor corner (Z-20 to -17.6) is not graded.
Hint
The outward wall normal is (cos10°·cosφ, cos10°·sinφ, sin10°) and the tool axis (−sin10°·cosφ, −sin10°·sinφ, cos10°). The tip centre sits one tool radius out along the normal from the foot of the wall.
O5003 (DOUJI 5JIKU SWARF) G21 G90 G17 G40 G49 G80 G69 G54 G00 A0 C0 T1 M06 (FLAT D10) S6000 M03 M08 #1 = 10. (KOUBAI) #2 = 5. (KOUGU NO HANKEI) #3 = 25. (SOKO NO HANKEI) #4 = -20. (SOKO NO Z) #10 = #3 + #2 * COS[#1] #11 = #4 + #2 * SIN[#1] G43.5 H1 X[#10 + 20.] Y0 Z50. I[-SIN[#1]] J0 K[COS[#1]] G00 Z#11 G01 X#10 F400 #5 = 5. WHILE [#5 LE 360.] DO1 X[#10 * COS[#5]] Y[#10 * SIN[#5]] I[-SIN[#1] * COS[#5]] J[-SIN[#1] * SIN[#5]] K[COS[#1]] F800 #5 = #5 + 5. END1 G01 X[#10 + 20.] F800 G00 Z50. G49 M05 M09 G00 A0 C0 M30
4Undercut: a 15° dovetail with a tilted tool
Cut a dovetail 16 mm wide at the top and 10 mm deep along X, with walls leaning in by 15°. The walls overhang, so a vertical tool cannot reach them. Slot the middle with φ12, then tilt φ6 by ±15° on the A axis and cut each wall with the side of the tool. The floor corners are not graded.
Hint
Right wall A-15., left wall A15. (C0). The tip centre is at Y±7.366, Z-9.224. Go down and up outside the stock (X±40) so the overhanging walls are not gouged.
O5004 (ARIMIZO 15DO) G21 G90 G17 G40 G49 G80 G69 G54 G00 A0 C0 T1 M06 (FLAT D12) S5000 M03 M08 G43 H1 Z50. G00 X-40. Y0 Z2. G01 Z-5. F300 X40. F800 Z-10. F300 X-40. F800 G00 Z50. M05 M09 G49 T2 M06 (FLAT D6) S8000 M03 M08 (MIGI NO KABE : A-15) G43.4 H2 X-40. Y7.366 Z50. A-15. C0 G00 Z-9.224 G01 X40. F600 G00 Z50. (HIDARI NO KABE : A15) G00 Y-7.366 A15. Z-9.224 G01 X-40. F600 G00 Z50. G49 M05 M09 G00 A0 C0 M30
Tips for writing 5-axis programs
- 3+2: G68.2, then G53.1, then G43. Cancel the tool length offset (G49) before defining the plane, move the tool clear of the stock, then index the rotary axes with G53.1. G53.1 swings the rotary axes, so commanding it just above the part can drive the tool into it. Generic CAM post-processors output the same order: retract, cancel compensation, G68.2, G53.1.
- Prefer machine-independent code. G68.2 and G43.5 describe the tool direction, so the same program runs on machines of other layouts (exercises 1 and 3 cut the same shape on a head-type machine too). G43.4 with explicit A and C is tied to one machine’s layout and rotation directions.
- Watch how you retract from an undercut. Lifting a tilted tool straight up in Z gouges an overhanging wall. Go up and down outside the stock, or retract along the tool axis. The section view shows at once where a gouge happened.
- Avoid changing direction near vertical. Changing the direction slightly while the tool is almost vertical makes the C axis swing a long way at once (the singularity), which slows the feed and can mark the surface. The simulator warns when C turns more than 30° in one block.
- Do not move rotary axes without TCP near the part. Without tool centre point control the linear axes do not follow when the rotary axes turn, so the tip swings round the rotation centre. Do rotary moves at a safe height away from the stock.
Assumptions and limits
- The stock is a 3D grid at 0.5 mm spacing, each point holding its distance to the surface. Features finer than 0.5 mm look rounded. Grading counts places more than 0.15 mm off the drawing and fails anything 0.25 mm or more off.
- Collisions are checked only between the tool, shank and holder and the stock — not with fixtures, the table, the spindle head or the machine body.
- Rotation directions, zeros, travel (±120°), the rotation centre (about 80 mm below the table top) and the head pivot length (150 mm) are illustrative. How the linear axes behave on G53.1, which of the two solutions G43.5 picks and how feed is computed with rotary motion all depend on control parameters on a real machine.
- Inverse time feed (G93), 3D tool radius compensation, tilted-plane definitions other than Euler angles and inch input (G20) are not supported.
- Before cutting on a real machine, always verify with a collision-checking simulation from the machine builder or CAM vendor, plus a dry run and single-block. This page is for learning how the code is written and how the machine moves.
FAQ
- Can I simulate a 5-axis CNC program for free?
- Yes. The simulator on this page runs entirely in the browser with no sign-up or installation. Paste a program and press Run to see the tool motion and the cut part in 3D, with line-numbered warnings for TCP-off drift, singularities, rapid moves into the stock and holder collisions. You can share a program as a link.
- What is the difference between G43.4 and G43.5?
- Both are tool centre point control and treat X/Y/Z as the tool tip. G43.4 (type 1) gives the tool direction as rotary angles (A/C or B/C); G43.5 (type 2) gives it as a vector I/J/K and lets the control work out the angles. G43.5 depends less on the machine layout, but which of the two angle solutions is used is left to the control.
- What do I, J and K mean in G68.2?
- They are Euler angles for the plane: rotate the coordinates I degrees about Z, then J degrees about the new X, then K degrees about the new Z. For example, G68.2 X0 Y15. Z0 I0 J-45. K0 puts the origin at Y15 and tilts the plane -45° about X, giving a 45° face whose normal points between +Y and +Z.
- Can I check undercuts and side holes that 3-axis simulators cannot show?
- Yes. Many 3-axis simulators store the part as a height map seen from above, so they cannot draw sideways holes or overhanging walls. This one keeps the stock as a 3D grid, so cuts from any direction remain as they are. Use the Section button to slice at X=0 or Y=0 and look inside.
Related pages
- 5-axis CNC functions (TCP, tilted working plane, comparison by control maker)
- Common 5-axis mistakes (singularity, two solutions, forgetting to cancel the plane)
- 5-axis calculations (angles from a direction vector, inverse time feed)
- Machining centres (3-axis NC simulator and exercises)
- CAM try-out (make toolpaths up to 5-axis)
- Article: machining simulators that run in the browser
Sources
Command names and behaviour were checked against public material from control and machine makers and the output of a CAM vendor’s FANUC post-processor. No manual text or examples were copied.
- FANUC America Corporation — 5-Axis Machining — CNC systems for high-performance machine tools (MBA-025-EN_03_1308, 2013)
- Fuji Technology Press — Development Report: Advanced Control Technologies for 5-Axis Machining, Int. J. of Automation Technology Vol.1 No.2, pp.108-112, 2007 (DOI 10.20965/ijat.2007.p0108, CC BY-ND 4.0)
- FANUC (fanuc.com)
- Autodesk (cam.autodesk.com)
- Mitsubishi Electric — NC Specification Selection Guide M800V/M80V/E80/C80 Series (BNP-A1244 ENG D)
- Siemens AG — Milling with SINUMERIK — 5-axis machining Manual, Edition 05/2009 (DocOrderNo. 6FC5095-0AB10-0BP1)
- DR. JOHANNES HEIDENHAIN GmbH — TNC 640 User's Manual Conversational Programming, NC Software 340590-01 / 340591-01 / 340594-01, 4/2012 (892903-20)
- Haas Automation, Inc. (haascnc.com)