DXF to SVG for LINE and LWPOLYLINE drawings
Convert a local ASCII DXF with LINE and LWPOLYLINE entities into an SVG preview in your browser.
Input one ASCII DXF, verify units and 2D entities, then download an SVG scaled to real millimetres. Supported LINE and LWPOLYLINE records become SVG paths with even-odd fill so holes stay open; unsupported entities (such as ARC, CIRCLE, SPLINE, or 3D geometry) stay excluded rather than silently approximated. Need to inspect entity counts and coverage gaps first? Open the DXF checker or follow the Inkscape DXF-to-SVG guide.
1) Choose an ASCII DXF with 2D LINE/LWPOLYLINE geometry · 2) Review units, 2D planarity, and unsupported-entity flags · 3) Download the mm-scaled SVG with even-odd holes after reparse.
Scope: local browser processing; LINE and LWPOLYLINE only. Unknown units and unsupported semantics remain visible.
What the SVG contains
The root carries a width and height in millimetres and a viewBox in drawing units, so a 100 × 70 mm drawing still measures 100 × 70 mm when reopened. The Y axis is flipped to SVG orientation, and every closed polyline is filled with fill-rule evenodd — a hole inside a contour stays a hole instead of turning into a second filled shape.
One entity becomes one path element. LINE and open polylines are stroked and left unfilled, so the difference between a closed contour and an open line survives the translation. No raster image, script or external reference is written into the file.
What is converted and what is left out
| DXF content | How it is treated | In the SVG |
|---|---|---|
| LINE | One stroked path | Converted |
| LWPOLYLINE with the closed flag | One filled path closed with Z | Converted |
| LWPOLYLINE without the closed flag | One stroked open path | Converted |
| $INSUNITS 4, 5, 1, 2 or 6 | Scaled to millimetres for the root size | Converted |
| $INSUNITS 0 or missing | You choose the source unit first | Waits for a unit |
| ARC, CIRCLE, SPLINE, INSERT, HATCH, TEXT | Listed in the report | Not converted |
| Non-zero Z, thickness or extrusion | Blocks the export | Error |
| LWPOLYLINE with a non-zero bulge | Read as a straight chord and flagged | Not checked |
| Binary DXF or CRLF line endings | Refused before parsing | Error |
| Duplicate or self-intersecting geometry | Not detected | Not checked |
Size, units and the 25.4× trap
A DXF number has no unit until the header declares one. When $INSUNITS is 0 the converter asks you to pick millimetres, centimetres, inches, feet or metres. That choice sets the physical SVG size and never rewrites the original file; changing or clearing it invalidates the previous download.
A wrong choice shows up as a clean 25.4× or 1/25.4× size error, not as distorted geometry. Measure a known dimension after import and compare it with the intended width before you cut.
A file you can compare
Transparent island sample: one closed outer contour and two inner contours. After conversion, the inner shapes stay open instead of filling in.
What is missing from the SVG
Entities outside LINE and LWPOLYLINE are left out of the drawing and named in the issue list. This is not a CAD renderer, so a complete-looking SVG can still have gaps.
- Arcs and circles are not converted; explode them to polylines in the source program first.
- Blocks and INSERT references are not expanded into their contents.
- Hatches, dimensions and text are not drawn.
- Curved polyline segments are read as straight chords and flagged, so inspect curved parts before cutting.
Questions this page can answer
Does the SVG keep the original size?
Yes, when the DXF declares a supported unit or you choose one. The width and height are written in millimetres and match the drawing coordinates.
Why are some parts missing from the SVG?
They were ARC, SPLINE, INSERT, HATCH or another type outside the subset. Those entities are listed in the report instead of being silently drawn.
Can I edit the SVG afterwards?
Yes. The output is plain path data with no embedded bitmap, script or external reference, so a vector editor can open and change it.
Is this a DXF viewer?
No. It converts supported geometry. Hatches, dimensions and blocks are not rendered the way CAD software would show them.