Skip to content
Owais KhanSoftware Reviews

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

SVG preview5 moves · 1 travel · 4 cut

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.

Frequently asked questions

Does this converter support 3D printer G-code or laser/plotter G-code?
Yes. The converter handles G0/G1 linear moves and G2/G3 arc moves, which are the motion commands shared by CNC mills, laser cutters, vinyl plotters, and FDM 3D printers alike. For 3D printer files you can use the Z-filter to isolate a single layer and extract svg from gcode for that slice. Laser and plotter files typically stay at Z=0 and convert directly without any filtering needed.
Are arc commands (G2 and G3) supported in the SVG path conversion?
Yes. G2 (clockwise) and G3 (counter-clockwise) arcs are fully supported. The converter reads the I/J center offsets, computes the radius and subtended angle, and emits an SVG A (arc) command with the correct large-arc-flag and sweep-flag. This means circular pockets, rounded corners, and full circles all render accurately — the result is a true gcode to bezier path representation rather than a polyline approximation.
How are rapid G0 travel paths handled in the exported SVG vector?
G0 rapid moves are emitted as a separate SVG path element styled in a neutral grey (#aaaaaa) at reduced opacity, distinct from the red cut paths. This makes the gcode toolpath to vector output easy to read: you can see the full machine motion including air moves, or hide the travel layer entirely using the toggle. Each move segment starts with an explicit M (moveto) so segments never bleed into each other.
Is my G-code file processed locally or uploaded to a remote server?
Your G-code is processed entirely locally inside your browser. No file is uploaded to a remote server at any point. The conversion logic runs as an inlined JavaScript function on this page, so the text you paste stays on your machine. This is enforced structurally: the page contains no network calls, and the site test suite scans the shipped HTML for any API capable of sending data off-page and fails the build if one is found.
Is anything I paste uploaded or processed on a server?
Nothing you paste is uploaded or processed on a server. The entire gcode to svg converter online free tool runs as a self-contained script embedded in this page. There is no backend, no API endpoint, and no analytics that could capture your toolpath data. You can verify this by opening your browser's network tab while using the tool — you will see zero outbound requests triggered by the conversion.