DXF to SVG converter

Choose an ASCII DXF and download an SVG of its lines, arcs and curves at real size, with a list of anything that could not be carried over.

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

How to convert a DXF to SVG

  1. Choose your DXF or drop it on the box.
  2. Check the units. They are read from the file when it states them; if it does not, pick the unit the drawing was made in.
  3. Check the size, and set a line width or a margin if you want one.
  4. Read the notes on what was left out, then download the SVG.

What is drawn

  • LINE, and LWPOLYLINE and POLYLINE with their bulges: a bulged side becomes a true circular arc, not a row of short lines.
  • CIRCLE and ARC, written as SVG arc commands with the same centre and radius.
  • ELLIPSE, whole or part, at any angle.
  • SPLINE of degree one, two or three without weights, worked out from its control points and knots into the Bézier curves that are exactly the same curve.
  • INSERT of blocks: scaled, rotated, mirrored, repeated in rows and columns, and nested inside other blocks. Each copy is written out as plain paths in its final place, so the SVG has no transforms in it.

What is left out

An SVG made for cutting or plotting wants lines, so that is what this tool carries. It counts and leaves out text (TEXT and MTEXT), dimensions and leaders, hatches and solid fills, points, linked pictures, and 3D faces, meshes and solids. Anything in paper space, and anything on a layer that is switched off or hidden by a freeze, is left out too. The notes beside the result give the number of each.

A spline that has weights, or a degree above three, has no exact SVG form. It is drawn as 32 straight pieces for each stretch between two knots, and the notes say how many splines were treated that way. Line types are not carried: a dashed or centre line in the DXF is a solid line in the SVG. Line weights are replaced by the one line width you set.

Only ASCII DXF is read, the kind that opens as text. A binary DXF or a DWG is refused with a message; save it again as ASCII DXF from any CAD program.

Units and size

A DXF may state its unit in the header as $INSUNITS: 1 for inches, 4 for millimetres, 5 for centimetres, 6 for metres. When it does, that is used. When it does not, $MEASUREMENT 0 is taken to mean inches, and otherwise millimetres are assumed and the page says it is assuming. Many DXF files state nothing, so check the size shown against what you know the part to be.

The SVG’s width and height are written in millimetres, and its viewBox is in the drawing’s own units. The numbers in the paths are the numbers in the DXF, moved so the drawing’s lower left corner is at 0, 0 and turned over, because DXF counts y upwards and SVG counts it downwards. The page fits the drawing exactly unless you add a margin.

Layers, colours and joined lines

Each DXF layer becomes a group in the SVG, named after the layer and marked so that Inkscape shows it as a layer. Lines take the colour of their layer or their own colour number. White, and colour 7, which CAD shows as white on a black screen, are drawn black so they show on paper.

CAD drawings are often a heap of separate lines and arcs that only look joined. With “Join lines that meet end to end” ticked, pieces on the same layer whose ends meet are strung into one path, and a chain that returns to its start is closed. A pen plotter then draws the outline in one stroke, and a cutter sees a closed shape. Ends count as meeting when they are within a hundred-thousandth of the drawing’s size.

Questions

Why is the SVG 25 times too big or too small?

The drawing was made in inches and read as millimetres, or the reverse. A DXF often does not say which. Change “Units of the drawing” and the size follows.

Can it convert a DWG file?

No. DWG is a closed binary format. Open it in a CAD program and save it as DXF, choosing ASCII if you are asked, then bring that file here.

Why is the lettering missing?

Text in a DXF is stored as words and a font name, not as shapes, and the font is not in the file. In your CAD program, explode the text to lines or polylines first; those are drawn.

Are the shapes filled?

No. Every path has a stroke and no fill, which is what plotting and cutting software follows. To fill a closed shape, open the SVG in a vector editor and give it a fill.

Related