What Is MDI in CNC Machine Control?
MDI in CNC machine control is the manual data input mode: you type one block of G-code and the machine executes it right away. This page explains how the mode works, what it is good for, and where it causes scrap. Written for setup operators, programmers and engineers who need to make a call at the machine.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
How MDI in CNC Machine Mode Actually Executes a Block
The control on a CNC machine usually holds several modes: EDIT, MEMORY (auto), MDI, JOG, HANDLE and REF. In MEMORY the machine reads a stored program from its own memory and runs it start to finish. In MDI, or manual data input, you type a single block on the keypad and press cycle start. The control parses that block, moves the axes, then waits for the next entry.
The key difference is where the command lives. A MEMORY program is written to the control's storage and stays there after a power cycle. An MDI block is executed and then discarded. It never overwrites the active program, and it does not change the program number or the tool offsets unless the block itself is an offset command.
Internally the control treats an MDI block almost like the first line of a program. Modal states carry over from the last MDI entry, so the machine remembers G80, G90 or the active feed rate until you change them. That modal memory is useful and also the most common source of surprise, because operators assume each MDI block starts from a clean slate. It does not.
Because there is no program to scroll back through, MDI is best for short, verifiable actions: index the tool changer, spin the spindle at a set rpm, rapid to a known position, check a probe reading, or jog an axis to a datum. Anything longer than a few blocks belongs in a written program where it can be reviewed and reused.
- 1Single block onlyOne press of cycle start runs one block, not a sequence.
- 2No storageContent is dropped after execution; nothing is saved to the program library.
- 3Modal states carryG90/G91, G80, feed and spindle states persist between entries.
- 4Offsets stay untouchedMDI does not edit work offsets or tool offsets by itself.
What Operators Use MDI in CNC Machine Control For
The most common use is setup. After clamping a part you need to bring the spindle close to a face so you can touch off with a gauge block or a probe. Typing G0 G90 G54 X0 Y0 Z50 and pressing cycle start is faster than writing a program, and it does not disturb what is already loaded.
Tool change testing is another. If a pocket or an angle head has been sitting unused, an MDI entry like T12 M6 lets the operator confirm the arm swings clean and the taper seats before the real cycle starts. The same applies to spindle warm-up runs, which on a 12,000 rpm spindle are usually 20–30 minutes at stepped speeds.
MDI is also the standard way to call a probe or a measuring macro. On many controls the macro is stored under a fixed number, so an MDI line calls it directly and the result lands in a macro variable you can read on screen. No program edit is needed, and the measurement does not touch the part program.
Finally, MDI is how most operators stop a machine cleanly. After a feed hold, you enter M5 and M9 by hand to stop the spindle and coolant, then retract with a G91 G0 Z10 move. Short commands, immediate effect, no risk of an unplanned block running later.
- 1Touch-off and datum checksRapid near a face, then jog or probe to set the work offset.
- 2Tool change prove-outT12 M6 confirms the arm indexes and the taper seats before production.
- 3Spindle warm-up20–30 minutes at stepped speeds before a first production cut.
- 4Probe and macro callsInvoke a measuring macro without editing the stored program.
When MDI in CNC Machine Work Is the Wrong Choice
MDI is a hand tool, and like any hand tool it stops being safe past a certain length. If an operation needs more than about four or five blocks, the odds of a typo go up faster than the time you save. A missing decimal point turns X1.5 into X15, and on a machine with a 4,000 mm envelope that difference is measured in tool holders, not in scrap parts.
Production runs should never be driven from MDI. There is no restart-from-block, no program verification, no traceability. If quality wants to know which spindle speed was used on a lot, or if you need to re-run the same cycle next month, the command has to live in a program with a revision number.
Some controls limit what MDI can do at all. Certain safety interlocks, pallet change cycles and door-open conditions may be blocked in MDI even if they run fine in MEMORY. Tool life management and adaptive control loops usually only arm in automatic mode, so a speed override you test in MDI may not behave the same way in the real cut.
The other trap is modal carryover. If the previous MDI block left the machine in G91 incremental, your next block will move relative to the current position, not to the datum. Check the mode line on the screen before you press cycle start, every time.
- 1Keep it under five blocksLonger sequences belong in a written, reviewable program.
- 2Never drive production from MDINo restart point, no verification, no record for quality.
- 3Watch for blocked functionsPallet changers and safety interlocks may not arm in MDI.
- 4Confirm the modal stateRead G90/G91 and the active plane before cycle start.
MDI Behavior Across Common CNC Controls
Fanuc keeps MDI as a separate mode selectable from the mode switch. Typed blocks appear in a small buffer on the position screen and are cleared when you leave the mode. On Fanuc, M30 in MDI will reset the control and clear the modal state, which is a quick way to get back to a known starting point.
Siemens 840D treats MDI as a mode on the same softkey row as AUTO and JOG, and it supports a multi-line MDI buffer that you can edit before running. That is convenient, but it also means a leftover line from yesterday can still be sitting in the buffer. Clear it before you start.
Haas controls put MDI next to the jog and memory keys and show the current modal G-codes in a dedicated display. That display is worth reading, because it shows exactly which states will carry into your next block. Heidenhain calls the equivalent mode MDI as well, with positioning blocks entered in plain text.
The differences are mostly ergonomic. The underlying rule does not change: one block at a time, executed immediately, with modal state carried from whatever came before. Understand that rule and the mode behaves predictably on any control you step up to.
- 1FanucSeparate mode position on the switch; M30 resets and clears modal state.
- 2Siemens 840DMulti-line buffer on the softkey row; check for leftover lines.
- 3HaasDedicated modal display next to the entry field; read it first.
- 4HeidenhainPlain-text positioning blocks in MDI mode; same one-block rule.
Safe Practice for MDI in CNC Machine Setup Work
Start every MDI session with the feed override low. Twenty percent is a reasonable default for a first move after a setup change. If the axis goes the wrong way, you have time to hit feed hold and the slide has not traveled far. Bump the override up only once the direction and distance are confirmed.
Keep one hand near the feed hold button, not on the keyboard. A block like G0 G91 G28 Z0 is a full retract to the machine reference; if a fixture or a vise sits in the path, no amount of fast typing will stop it. The feed hold button will.
Never type an MDI block with the door open unless the control explicitly allows it at reduced speed. On machines with an interlocked door, the control may pause a spindle command or ignore it, and a partial execution leaves you guessing which part of the block ran.
Log critical entries. If you use MDI to touch off a tool or set a datum, write the block and the resulting offset value on the setup sheet. The next operator can then reproduce the setup instead of re-deriving it, and a job that runs twice a year stops depending on one person's memory.
- 1Start at 20% feed overrideRaise it only after direction and distance check out.
- 2Hand on feed holdEspecially before any G28 or full retract move.
- 3Respect the door interlockA blocked spindle command leaves partial execution behind.
- 4Write it on the setup sheetNext operator reproduces the setup instead of guessing.
What MDI in CNC Machine Control Means for Outsourced Parts
If you buy machined parts rather than make them, MDI still matters to you, because it shapes how a shop handles first articles. A well-run shop uses MDI to touch off tools and verify datums, then runs the prove-out program with the feed override low and the rapids reduced. The first part off the machine is the one that tells you whether the setup is right.
At GreatLight we run 127 high-precision CNC machines across three wholly-owned plants, including 16 simultaneous 5-axis machining centers and a maximum processing size of 4,000 mm. Tolerance is held to ±0.005 mm (±0.0002 in) with finishes from Ra 0.2–0.8 μm on request. Those numbers depend on setup discipline as much as on the cutting tools.
Every part is inspected before shipment, with raw material checks, in-process monitoring and final inspection, and reports are available on request. Setup work done through MDI feeds directly into that chain, because a datum set carelessly cannot be recovered by a good inspection plan.
We work to ISO 9001:2015, IATF 16949:2016, ISO 13485:2016 and ISO 27001:2022, and we quote with a free DFM analysis within 12 hours. No minimum order quantity applies, so a single prototype and a 10,000-part run go through the same setup discipline.
- 1Setup drives first-article qualityMDI touch-off and datum checks set the baseline for the prove-out cut.
- 2Capacity behind the setup127 machines, 16 five-axis centers, up to 4,000 mm processing size.
- 3Verification chain100% inspection before shipment; reports on request.
- 4No minimum order quantityOne prototype or 10,000+ parts, same discipline.
MDI vs MEMORY vs JOG: Which Mode for Which Task
Use this table to pick the right control mode before you touch the keypad.
| Control mode | Best for | Stored after use | Main risk |
|---|---|---|---|
| MDI | One-off setup blocks, touch-off, tool change test | No | Typo runs instantly at full rapid |
| MEMORY (auto) | Production cycles, proven programs, repeat runs | Yes | Wrong offset runs the whole cycle |
| JOG | Moving an axis by hand near a face | No | Over-travel into a fixture |
| HANDLE (MPG) | Fine positioning below 0.01 mm | No | Slow; easy to misread the handwheel scale |
| EDIT | Writing or revising a program | Yes | Editing the wrong program number |
| REF (zero return) | Homing axes after power-up | No | Obstruction in the retract path |
The Short Version
Use MDI for a handful of setup blocks you can read at a glance. Use MEMORY for anything that has to run more than once. If a command needs six lines or a decision in the middle, stop typing and write a program.
MDI in CNC Machine Control: Common Questions
Does an MDI block get saved to the machine's program memory?
No. The control parses and executes the block, then drops it. Nothing is written to the program library, so a power cycle clears it.
If you want to keep a command, write it into a program under EDIT mode and give the program a number you will remember.
Why did my MDI move go the wrong distance?
Check the modal state first. If G91 incremental is still active from a previous block, the move is relative to the current position, not to the work datum.
A missing or misplaced decimal point causes the same symptom. X1.5 and X15 are very different moves on a large machine.
Can I run a full program from MDI?
Some controls allow a multi-line MDI buffer, but it is not the same as running a program. There is no restart-from-block, no verification cycle and no record for quality.
For anything longer than about five blocks, load the program in MEMORY mode instead.
Is MDI the same on Fanuc, Siemens and Haas?
The rule is the same on all three: one block, executed immediately, with modal state carried in from the previous entry.
The differences are ergonomic. Siemens supports a multi-line buffer, Haas shows a dedicated modal display, and Fanuc puts MDI at a fixed position on the mode switch.
What is the safest first MDI command after a setup change?
Set the feed override to about 20%, then command a short rapid in one axis only, well clear of the fixture. Confirm the direction and distance on the position screen.
Only after that should you command a multi-axis move or a full retract to the machine reference.
Does MDI change my work offsets or tool offsets?
Not by itself. MDI only executes what you type. If the block is an offset-setting command, it will change the offset value, so check the offset screen before and after.
Setup sheets should record any offset value that came out of an MDI session.
Send Us Your Part and We Will Quote It
Upload a STEP file and we return a quotation with a free DFM analysis within 12 hours, backed by 100% inspection before shipment.
12-hour quote100% inspectionNo minimum order quantityNDA on request