Gcode to SVG Converter
Paste any G-code file and get an instant SVG preview with travel and cut paths on separate layers. This gcode to svg converter online free tool handles G0/G1 linear moves and G2/G3 arc interpolation, so circular pockets and rounded profiles render accurately. Use the Z-filter to extract svg from gcode for a single layer of a 3D print or multi-pass engraving job.
Everything runs locally: what you paste never leaves your browser.
Convert your G-code to SVG
How the conversion works
Each line of G-code is parsed for a motion command (G0, G1, G2, or G3) and the axis words that follow it. G0 rapid moves become travel segments; G1/G2/G3 become cut segments. The two groups are emitted as separate <path> elements so you can recolour or hide either layer independently.
Arc commands (G2/G3) are converted using the I/J center-offset method. The converter computes the arc radius, the start and end angles, and the subtended angle to determine the SVG large-arc-flag. G2 (clockwise) maps to sweep-flag=1 and G3 (counter-clockwise) to sweep-flag=0. The result is a truegcode to bezier path representation — not a polyline approximation — so circles and ellipses stay smooth at any zoom level.
The viewBox is computed automatically from the bounding box of all move endpoints, with a small padding, so the preview always fits the geometry. If you need toconvert nc to svg for a specific Z layer, enter Z min and Z max values and only moves whose active Z falls within that range will be included.
Comparing output formats
SVG is the most portable vector format for web use, but some workflows need DXF. Agcode to dxf converter produces a file that CAD packages like AutoCAD or LibreCAD can open directly, whereas SVG is better suited for Inkscape, Illustrator, or embedding in a web page. This tool targets SVG because it renders natively in every modern browser without a plugin, making it ideal for quick visual inspection of agcode toolpath to vector before committing to a cut.
If you need DXF output, the SVG path data produced here can be imported into Inkscape and re-exported as DXF in one step, since both formats share the same underlying path model.
Supported G-code commands
The converter recognises the four universal motion codes: G0 (rapid),G1 (linear feed), G2 (clockwise arc), and G3(counter-clockwise arc). Comments delimited by ; or parentheses are stripped before parsing. All other codes (tool changes, spindle commands, feed-rate words, etc.) are ignored — they produce no geometry and pass through silently.
This covers the motion subset used by Grbl, Marlin, LinuxCNC, and most CAM post-processors, so whether you are working with a CNC router, a laser engraver, or a 3D printer, the same parser handles the file.