Skip to content

SVG to G-code and DXF to G-code: from a drawing to a laser or router file

Drop an SVG, DXF, PDF or existing G-code file, switch off unneeded layers and download the outlines as G-code, DXF R12, SVG or a 1:1 PDF. The part does not come out mirrored, and a Cyrillic layer name in DXF arrives intact.

Part of Pro, 15 EUR a month.

What an SVG and DXF to G-code converter is

SVG to G-code means turning a flat drawing into a file of moves for the machine. The EduFacturing 2D CAM bridge is part of Pro, reads SVG, DXF and PDF into a list of contours in mm and writes them as G-code for a laser or router.

It fixes two mistakes that only show after cutting: SVG counts Y downward while the machine counts upward, so the part comes out mirrored; and DXF R12 has no Unicode, so Cyrillic in a layer name needs ANSI_1251.

SVG to G-code: the 2D CAM bridge with a plate drawing loaded, layer 0 with 7 contours, scale 100%, and a preview with a rectangle, four small holes in the corners, one large hole in the middle and a slot below
SVG to G-code: the 2D CAM bridge with a plate drawing loaded, layer 0 with 7 contours, scale 100%, and a preview with a rectangle, four small holes in the corners, one large hole in the middle and a slot below

What the drawing to G-code converter does

Reads SVG, DXF, PDF and G-code

SVG with transforms, DXF (LINE, POLYLINE, LWPOLYLINE, CIRCLE, ARC), PDF with straight lines in an uncompressed stream, and G-code (.nc, .gcode, .ngc, .tap).

Arranges the drawing

Layers switch on and off, the scale is in percent, the part moves to zero (bottom left corner) and can be mirrored along Y.

Writes G-code for a laser or router

G-code for a laser (.nc) or router (.gcode) with speed, power or spindle speed, passes, safe height and pass depth. Also DXF R12, SVG with layers and a 1:1 PDF.

Gives a power and speed test grid

The test grid is G-code with 20 squares: 5 powers by 4 speeds, 52 × 66 mm (56 × 70 mm with the gaps). The overall size, length and cutting time are shown too.

When you need G-code from SVG and DXF

Three things spoil a part silently: mirroring (the Y axis), the scale and Cyrillic.

  • G-code for a school laser

    A teacher takes an SVG from Inkscape, switches off the helper layers and downloads the .nc, or a DXF R12 with a Cyrillic layer name.

  • A template for hand cutting

    A 1:1 PDF is printed at Actual size, stuck onto the material and cut.

  • Engraving and cutting from one drawing

    The engraving layer at low power comes first, the cutting layer at high power second: two G-code files from one drawing.

  • Checking someone else’s G-code

    An existing .nc is read back: G0 and M5 split the contours. You can download it as DXF, SVG or PDF.

How a drawing becomes G-code

Everything goes through a list of contours in mm with Y up: the input builds it, the settings transform it, the output writes it.

  1. Reading

    A Bézier curve is split into 24 segments, an SVG circle and a DXF CIRCLE into 64, an arc in an SVG path into 48 per full turn, and px becomes mm at 96 dpi.

  2. Writing

    G-code starts with G21, G90 and G17. A laser writes M5, G0 to the start, M3 and a run of G1 up to M5; a router lifts to the safe height between contours.

  3. Figures

    Overall size, contour count, length and cutting time: a lower bound, the length times passes divided by the speed.

The formulas in the tool
Applies toFormulaMeaning
Y from SVG to machiney = H − y_SVGH is the SVG height in mm
Polygon deviationf = r · (1 − cos(π / n))n sides on an SVG circle or a DXF CIRCLE; at n = 64 and r = 10 mm it is 0.012 mm, at r = 50 mm it is 0.060 mm
Cutting timet = L · k / Fk passes; at L = 1000 mm, k = 1 and F = 600 mm/min it is 1.7 min

Mirrored parts and Cyrillic in DXF

  • PDF at exact scale

    The sheet follows the part, not A4, and above 60 mm wide it has a 50 mm ruler to check for 100%.

  • What is skipped is reported

    G2 and G3 arcs in G-code and curves in PDF are not lost silently: the count of skipped ones is shown.

What the 2D CAM bridge cannot do

There is no kerf or tool diameter compensation, no bridges, nesting or cutting order: contours are cut in the order of the file, along the center of the line. There are no ready cutting settings either, only a grid for a trial.

A DXF is read as millimeters; $INSUNITS is not read. Text, fills and images are not read, and in DXF neither are blocks (INSERT), ellipses and splines; an arc stored as a bulge in a polyline is read as a straight segment. In SVG a layer is an id or inkscape:label: a file with an id on every shape gives many layers.

Questions about SVG and DXF to G-code

How to convert svg to G-code?

Drop in the SVG, switch off unneeded layers, choose a laser (.nc) or router (.gcode), set speed and power or spindle speed and download the G-code. The moves are straight only.

How to convert dxf to G-code?

Drop in the DXF, switch off the layers you do not cut and download the G-code. The DXF is read as millimeters.

How to make G-code for a laser cutter?

Put engraving and cutting on two layers and switch them on one at a time: you get two G-code files, engraving first at low power, cutting second at high power.

How do I find the laser power and speed?

Download the test grid: 5 powers (S from 200 to 1000) by 4 speeds (300 to 2400 mm/min). Cut it on scrap of the same material and thickness: the clean square is the setting.

Why does my part come out mirrored?

SVG counts Y downward, while DXF and G-code count upward. The tool flips Y when reading an SVG and back when writing one; the Mirror along Y option is for a machine with an inverted axis.

Can I convert a pdf to dxf?

Yes, if the PDF has straight lines in an uncompressed stream. Curves are not read, and the screen shows how many were skipped.

How much does the 2D CAM bridge cost?

It is part of Pro at 15 EUR a month. Pro also opens the other Pro tools in the catalog.

The SVG and DXF to G-code converter is part of Pro

Pro costs 15 EUR a month and opens all 45 Pro tools.

In the Design group:

Prepare your drawing for cutting

Part of Pro, 15 EUR a month.