Understanding CNC File Formats: G-code, TAP, NC, and Beyond
CNC machines operate using specially formatted text files that contain G-code instructions. However, the file extensions and internal formatting may vary depending on your machine, CAM software, and postprocessor settings.
In this article, we’ll cover:
- Common file types used in CNC
- Their purpose and structure
- How to identify, open, and convert them
- Best practices for naming and organizing CNC files
📁 Common CNC File Extensions
| Extension | Description | Common Usage |
|---|---|---|
.nc | Numerical Control | Generic G-code file from CAM software |
.tap | Tapping or toolpath | Often used in Mach3, LinuxCNC |
.gcode | G-code text | Common for 3D printing, also used in milling |
.txt | Plain G-code text | Used when exporting manually |
.eia | EIA standard format | Found in Fanuc systems |
.iso | ISO 6983 G-code | Used for compatibility |
.h or .min | Heidenhain | Special structure, block-based |
⚠️ Note: The extension doesn’t define the format, just a convention. Always open and inspect before assuming compatibility.
🔍 File Structure and Syntax
All these files are plain text, containing blocks of code. For example:
%
O1234
G21 G90 G17
G0 X0 Y0
G1 Z-2 F100
M30
%
%— Start/end of programO1234— Program numberG/M codes— Machine instructionsCoordinates— Axis movesM30— End of program
🧩 File Format vs File Content
Sometimes the same file (e.g., .nc) might:
- Work on one machine
- Fail on another
- Require formatting changes, not just extension change
Example: Fanuc might reject a file with long line numbers or excessive whitespace.
🔄 File Conversion Techniques
- Change extension manually
.tap→.nc,.txt→.gcode
✅ Works if syntax is compatible - Use CAM postprocessors
Export to correct format directly (e.g., Mach3 vs Haas vs Fanuc) - Use online converters or scripts
Tools like NC Viewer or G-code clean-up scripts can help reformat content - Editor-based conversion
Tools like G-Wizard Editor, CIMCO, or Notepad++ macros can standardize syntax
📂 File Naming Best Practices
- Use descriptive names:
pocket_op1.ncinstead ofnewfile1.tap - Add versioning:
part123_v3_revA.nc - Include machine or material hint:
haas_6061_top.nc
Naming is crucial for large job shops or shared toolroom networks.
🧪 Tip: Test Before You Trust
Before running any external file:
- Open in G-code editor
- Simulate with backplotting tools
- Verify safety lines, offsets, spindle commands
- Check compatibility with your controller version
✅ Summary
Understanding CNC file formats helps you:
- Avoid compatibility issues
- Organize toolpaths clearly
- Communicate with other machines or teams
- Prevent crashes due to formatting errors
“It’s not just about the code — it’s how it’s packaged.”
▶️ Next Topic: Converting DXF to G-code for CNC Machining (2D Parts Workflow)
.
Leave a comment