Gcode to glTF: A Mesh of Your Print Paths (Download Currently Incomplete)
This page rebuilds the extruded paths in your G-code as one 3D mesh, but the .gltf it delivers is missing the .bin files that hold the geometry, so it will not open. Until that is fixed, use our Gcode to GLB converter, which produces the same reconstruction in one self-contained file.
Download Started!
How would you rate your experience with MiConvert?
What turning G-code into glTF involves
A .gcode file is a script of machine moves and extrusion amounts. It stores no surfaces at all. Three.js, Babylon.js, Blender and online model viewers have nothing to draw until those moves are turned into geometry. glTF is the common hand-off format for web and real-time 3D, so it is a natural target when you want to show a sliced job on a website or in an engine.
The conversion runs on our servers. A Python parser follows G0 to G3 moves, absolute or relative extrusion (G90, G91, M82, M83) and G92 resets. In printer files it keeps only the segments where filament is pushed out. In files with no E word it treats the program as CNC and keeps the G1 to G3 cutting moves. When the slicer wrote layer markers, the start and end G-code is dropped, which removes the purge line. The kept paths are marked in a voxel grid, wrapped in a closed surface by marching cubes at a fixed 0.2 mm radius, and exported with the trimesh library.
This specific output has a problem right now. A .gltf stores its vertex data in separate .bin files. trimesh names ours gltf_buffer_0.bin and gltf_buffer_1.bin, and our download packager does not include them, so you receive the JSON file alone. Viewers then report missing buffers or show an empty scene. Until we fix this, use the GLB target, which packs the mesh into one binary file.
Whichever target you use, the mesh only approximates the paths. It is one merged object with no colors, materials or layers, and supports, skirts, brims and wipe towers stay in. Arcs become straight chords and full circles vanish, because only arc end points are read. G20 inch programs keep their inch numbers. The voxel grid is at least 0.3 mm and gets coarser with job size, reaching 1 mm for a 250 mm print. Coordinates are copied unchanged into a Y-up, meter-based format, so the print appears on its back at about 1000 times its real size.
Typical uses are previewing a G-code file you downloaded without its model, showing a sliced job on a product page, or recovering a rough shape when the original design is lost. It will not give you the designed part back.
How to get a usable glTF from a G-code file today
- Export plain text G-code from your slicer. PrusaSlicer binary .bgcode and FlashForge .gx files are accepted too, but encrypted Prusa Connect files are not.
- Leave the layer comments your slicer writes, such as ;LAYER_CHANGE or ;LAYER:n, in the file so the purge line can be filtered out.
- Upload the file on our Gcode to GLB page rather than this one, because the glTF output is currently incomplete.
- Download the GLB within about 4 hours, before it is deleted.
- If you need .gltf specifically, import the GLB into Blender, rotate it upright, scale it by 0.001, and export it as glTF Separate. That writes the .gltf together with its .bin.
What the converter handles
- Reads .gcode, .g, .gco and FlashForge .gx files, and skips the .gx header and preview thumbnail automatically.
- Decodes PrusaSlicer binary G-code (deflate or heatshrink compression, MeatPack encoding) to text before building the mesh. A CRC check catches damaged files.
- Follows absolute and relative extrusion, including files that switch modes partway through or reset the position with G92.
- Drops start and end G-code and ;TYPE:Custom paths when layer markers are present, so purge lines don't become part of the model.
- Stops with an error instead of a blank file when no extruding moves are found. This check does not catch the missing glTF buffers described above.
- Accepts files up to 50 MB without an account, 100 MB with a free account, 200 MB on Plus and 1 GB on Pro.
Video Tutorial
Convert GCODE to GLTF on any device — PC, Mac, iPhone, or Android! 🔗 https://miconvert.com/en/gcode-to-gltf?utm_source=youtube&utm_medium=social&utm_campaign=gcode-to-gltf No app needed! Just visit
Gcode to glTF questions
Why does my .gltf from this page fail to load?
The download contains only the .gltf JSON. Our packager leaves out the two .bin files it references, which hold the vertices and triangles. This is a known bug, and there is no fix date yet. Convert on our Gcode to GLB page instead: GLB keeps everything in one file and loads in the same viewers.
Can you convert G-code back to STL?
Only approximately. G-code records where the nozzle traveled, not the surfaces you designed, so any converter has to rebuild a shape from the paths. Our Gcode to STL converter wraps the extruded paths in a closed shell at a 0.2 mm radius, with the infill included. Use it for viewing or rough measuring, not as a replacement for your source model.
Can I convert G-code to 3MF and open it in my slicer?
Yes, a slicer can open it, but it holds a reconstruction of the printed paths, not your designed model. You get one object in millimeters, with the infill inside and supports merged in, and no plates, filament assignments or print settings. It is meant for viewing, not re-slicing. Bambu and Orca sliced project files (.gcode.3mf) are not accepted as input on our Gcode to 3MF page.
How do I change the G-code in Cura, Orca Slicer, Bambu Studio or Creality Print?
We don't edit G-code. Start and end code lives in each slicer's printer or machine settings, so change it there, slice again and export. For a one-line tweak, any plain text editor can open a .gcode file. Upload the edited file afterward if you want a mesh of the result.
What does 'No movement/extrusion commands found in G-Code file' mean?
The parser found no moves that lay down material. Common causes are a file with only travel moves, a text file that isn't G-code, a renamed binary file, or a CNC program that happens to contain an E word, which switches the parser to printer mode. Upload the sliced file itself, not a project or preview export.
Why is the model lying flat and enormous in my viewer?
glTF assumes Y points up and units are meters. Slicer coordinates are Z-up millimeters, and we copy them unchanged, so a 100 mm part reads as 100 meters lying on its back. Rotate it 90 degrees and scale it by 0.001 in Blender or your engine.
Does it work with CNC router or laser engraver G-code?
Yes, but you get a thin tube along the tool's center line, not the machined part. G0 rapids are skipped and plunges are kept. Modal motion is not tracked, though, so coordinate-only lines that follow a G0 are drawn as cuts. Cutter diameter, laser power, canned drilling cycles, rotary axes and tool changes are ignored, so a G1 move with the laser off is drawn like an engraving pass. Inch programs are not converted to millimeters.
What happens to my file after conversion?
The upload is deleted once the conversion's final attempt ends. The result can be downloaded for about 4 hours, and then it is removed. Anyone who has the download link can use it during that window, so share it carefully. Processing happens on our servers over HTTPS, and file names and sizes are logged for operations.