Open FlatCad

SVG and DXF to G-code converter

Turn an SVG or DXF drawing into G-code for a GRBL laser, a CNC router or a pen plotter. Holes and inner cuts go first, travel moves are kept short, and you see the cut order and the job time before you send it to the machine.

Make G-code

    How to use the G-code

    1. Check the size. The line above the preview shows the job size, the cut length and the estimated time. If the size is wrong, the file had no units: fix it with Scale.

    2. Set the machine. Pick laser, CNC or pen and type the speed, power or depth. For lasers, start from your material test settings.

    3. Download and open the .gcode file in your sender: LaserGRBL, Universal Gcode Sender, CNCjs, OpenBuilds CONTROL, Candle or bCNC.

    4. Zero the machine on the bottom-left corner of the material (or the centre, if you chose that origin), run a frame or a dry run with the laser off, then start.

    The G-code it writes

    Every file starts with two comment lines (file name, machine, size, number of paths and origin), then G21 and G90. What follows depends on the machine:

    MachineStartEach pathEnd
    LaserM8 if air assist, then M4 S0 or M3 S0G0 to the start, then G1 moves; the first carries S and FM5, M9, G0 X0 Y0, M2
    CNC routerG17, M3 S12000, G4 P3 (3 s spin-up), G0 Z safe heightrapid over the start, plunge at the plunge speed, cut, step down, repeat; lift to safe heightM5, G0 X0 Y0, M2
    Pen plotterG0 Z safe heightlower to the pen-down Z at the drawing speed, draw, liftG0 X0 Y0, M2

    There are no tool changes, arcs (G2/G3) or canned cycles: curves are written as short G1 segments, which every GRBL, Marlin and FluidNC machine accepts. The laser S value is power × the S value for 100%: 80% of 1000 is S800. If your GRBL has $30=255, type 255, or every power above about 26% will run at full.

    The Travel speed is only used for the time estimate. G0 lines carry no feed, so the machine travels at its own maximum rate ($110 and $111 in GRBL), which is usually faster than the estimate assumes.

    Passes and depth

    On a laser, Passes repeats the whole job: every path once, then every path again. That gives each cut time to cool between passes, which helps with thick wood and acrylic. On a CNC router the depth is split instead: 3 mm at 1 mm per pass gives cuts at Z −1, −2 and −3, all three finished on one path before moving to the next, so a part is fully cut before its neighbours. Open paths (an engraved line, a groove) are cut back and forth rather than rapid back to the start each time. More than 200 depth passes is refused.

    Cut order, worked through

    With Inner shapes first on, each path is given a depth: how many closed shapes contain it. The deepest paths are cut first and the outer outlines last, and inside each depth the next path is the one whose nearest point is closest to where the head stopped. A closed path starts at that nearest point rather than its first vertex. The sample tag shows it: the heart and the two holes go first, the rounded outline last.

    For the time, a 100 mm square with four 6 mm holes has 400 + 4 × 18.85 = 475 mm of cut. At 1000 mm/min that is 28.5 seconds a pass; three passes take about 1 min 26 s, plus travel. Corners and short segments slow the real machine down, so plan for 10–30% more.

    Things to check before you cut

    Need to draw or fix the part first? FlatCad is a free 2D CAD for laser and CNC parts, with kerf offset and DXF/SVG export. Working from a picture? Image to DXF traces it into lines.

    Open FlatCad, free, no signup

    Questions

    Which machines does the G-code work on?

    Anything that runs GRBL-style G-code: diode lasers (Ortur, Atomstack, Sculpfun, Neje, xTool with GRBL firmware, LaserGRBL), hobby CNC routers (3018, Shapeoko, X-Carve, OpenBuilds), and pen plotters or drawing robots with a Z axis. Marlin and FluidNC read it too. Check the first lines against your machine before cutting.

    What is the difference between M3 and M4 for lasers?

    M4 is dynamic power: GRBL lowers the laser power while the head slows down in corners, so corners don't burn. M3 keeps a constant power. Use M4 when your firmware has laser mode on ($32=1); otherwise M3.

    Why are the inner shapes cut first?

    When the outline of a part is cut, the part can drop or shift. Cutting holes and inner details first keeps everything in place until the last cut. Paths are also sorted so the head travels as little as possible.

    What units and origin does it use?

    Millimetres (G21) and absolute coordinates (G90). By default X0 Y0 is the bottom-left corner of the drawing, so you jog the head to the corner of the material and set zero there. You can keep the file's own coordinates instead.

    Can it engrave filled areas or photos?

    No, this makes vector (line) G-code: cutting, scoring and line engraving. For photo or fill engraving, use LightBurn or LaserGRBL, which can import the same SVG or DXF.

    How accurate is the time estimate?

    It assumes the machine always runs at the set speed and moves at the travel speed between cuts. Real jobs take longer because of acceleration in corners: plan for 10 to 30% more on drawings with many small details.