SVG to DXF converter

Choose an SVG, check its size in millimetres, and download a DXF that holds the outline of every shape as a polyline.

Free, no account. The file is read by code running in your browser. It is not uploaded, and nothing about it is stored.

or drop it here, or paste. SVG code works too

How to convert an SVG to DXF

  1. Choose your SVG, drop it on the box, or paste SVG code.
  2. Check the width and height. They start at the size the SVG states for itself; type the real size if you know it.
  3. Leave the curve tolerance at 0.05 mm, or make it smaller for smoother curves and more points.
  4. Look at the preview and the counts, then download the DXF.

What goes into the DXF

Every shape the SVG draws is saved as its outline: paths, rectangles, circles, ellipses, lines, polylines and polygons. Transforms, nested groups and style sheets are worked out by your browser first, so a shape that is rotated, scaled or copied with <use> lands where it is drawn. Shapes that are hidden, or kept in <defs> and never used, are left out.

Each part of a shape becomes one polyline, marked closed if the path closes. A letter O is two closed polylines, a dashed road on a map is one open one. DXF polylines are made of straight pieces, so curves are cut into pieces that stay within the tolerance you set. At the default of 0.05 mm a 50 mm circle becomes 56 pieces, and none is further than 0.04 mm from the true circle. At 0.01 mm it becomes 120.

Size, units and which way is up

A DXF holds bare numbers, and the program that opens it decides what they measure. This one is written in millimetres and says so in its header ($INSUNITS 4 and $MEASUREMENT 1). If a program asks for the units when you import, answer millimetres.

An SVG states its size in its width and height. If those are in mm, cm or inches, that is the real size. If they are in pixels, the tool uses the web standard of 96 pixels to the inch, so 96 pixels become 25.4 mm. Files from old versions of Inkscape were drawn at 90 to the inch and some other programs use 72, so a pixel-sized file can come out a few percent off: type the width you want and the height follows.

SVG counts y downwards from the top and DXF counts it upwards from the bottom. The drawing is turned over so that it looks the same in both, with the bottom left corner of the SVG’s page at 0, 0.

What a DXF outline cannot hold

  • Fills and line widths. A filled shape is saved as its edge. A thick stroke is saved as its centre line, not as the band of ink you see.
  • Dashes. A dashed line is saved as one unbroken polyline.
  • Text. Convert text to paths in your drawing program first; then each letter is an outline like any other.
  • Pictures, clip paths and masks. Embedded pictures are skipped. A clipped or masked shape is saved whole.
  • True curves. There are no arcs or splines in the file, only the short straight pieces described above.

Colours become layers

With “One layer for each colour” ticked, shapes are sorted onto layers by their stroke colour, or their fill colour if they have no stroke. A layer is named after its colour, such as C_FF0000, and given the nearest of the nine basic DXF colour numbers, so red cut lines and blue engraving lines stay apart in laser software that assigns settings by layer or colour. Untick it to put everything on layer 0.

The file is the R12 form of ASCII DXF: POLYLINE entities with their VERTEX points, a layer table and nothing else. It is the oldest form still in use and the one the widest range of CAD, laser, CNC and plasma programs accept.

Questions

Why is my DXF the wrong size when I open it?

Nearly always the program has read the millimetres as inches, which makes it 25.4 times too big, or the SVG was sized in pixels at something other than 96 to the inch. Pick millimetres in the import box, or type the real width here before you download.

Are curves kept as curves?

No. They become polylines of short straight pieces that stay within the curve tolerance, 0.05 mm unless you change it. That is finer than most cutters and routers can follow.

Why do I see shapes in the DXF that I cannot see in the SVG?

A DXF has no fills, so nothing covers anything else. A shape that sat behind another, or was painted white, shows as an outline like the rest. Delete the ones you do not want in your CAD program.

Does it work for a laser or a CNC router?

It gives them what they need: closed outlines at real size. The file has no cut order, kerf or tool width; your laser or CAM program adds those.

Related