Rasterlessvector

DXF, explained: what is inside the file and what goes wrong

DXF stands for Drawing Interchange Format, and the second word is the whole point. Autodesk published the specification in the early 1980s so that drawings made in AutoCAD could be opened by software Autodesk had not written. Four decades on, that giveaway is why a laser controller, a sign shop's cutting plotter, a plasma table's nesting software, a CNC router's CAM package and a free CAD program on a laptop can all be handed one file and each make sense of it.

A DXF is a text file. Open one in any editor and you find a long ladder of paired lines: a number saying what sort of thing comes next — the group code — and under it the value. Code 10 is an X coordinate, code 8 is a layer name, code 0 begins a new record. Verbose, unglamorous and completely inspectable: you can read a DXF, diff it in version control, and write something that walks it without a licence or a library in the way.

The file divides into sections. HEADER carries drawing-wide settings as variables with a dollar sign in front of them. TABLES declares the layers. ENTITIES is the drawing itself, one record per LINE, ARC, CIRCLE, LWPOLYLINE, SPLINE or HATCH. Nearly everything that goes wrong with a DXF in practice comes out of the first of those sections rather than the third: which revision of the format the file was written to, and what one unit inside it is meant to stand for.

How it works

  1. Open the file in a text editor first — DXF is plain text, and the code after $ACADVER near the top names the revision it was written to.
  2. If a program refuses it, that revision is the usual reason: ask the sender to export again to an older one, which most CAD software offers at save time.
  3. Look in the same header for $INSUNITS. If it is absent, nothing in the file says what one unit means, and the importer falls back on its own default.
  4. If it is there — ours writes 4, millimetres — let the importer use it; if it is missing, set the unit by hand, then measure a feature whose size you know before cutting material.
  5. Read the layer list last — layers are how a DXF keeps cut lines, fold lines and engraving apart, and what your machine's software hangs operations on.

Who this is for

Most people meet DXF sideways. A fabricator asks for "a DXF" without saying which revision or what units. A file bought from a design marketplace opens in one program and not in the next. A part comes off the machine twenty-five times too big and nobody can find anything wrong with the drawing — because there is nothing wrong with the drawing. It simply never said what a unit was.

Both of those have mechanical answers once you stop treating DXF as one thing. It is a series of revisions, roughly one per AutoCAD release, and a reader built against an older revision will refuse a newer file or open it with pieces missing. Exporting a revision or two down costs nothing on a drawing made of lines, arcs and polylines.

Units are the worse of the two, because that failure is silent. The header variable $INSUNITS is the only thing declaring whether a unit is a millimetre, an inch or nothing in particular, and plenty of files leave it out. The importer then guesses, and a millimetre-scale drawing read as inches lands 25.4 times too large. It is the single most common way a DXF goes wrong, and it stays invisible until somebody measures.

A flat two-colour cut-line graphic and the closed contours a DXF would carry: outlines only, nothing filled. — source image A flat two-colour cut-line graphic and the closed contours a DXF would carry: outlines only, nothing filled. — vector result
A flat two-colour cut-line graphic and the closed contours a DXF would carry: outlines only, nothing filled.

Settings we suggest

If a DXF is what you need and a picture is what you have, the converter below writes one — and since this page is about being specific, here is what it writes.

It is DXF R2010 (AC1024), which AutoCAD 2010 and later, Fusion 360, LightBurn, FreeCAD and Inkscape all open directly. The geometry is LWPOLYLINE where a boundary runs straight and an open degree-3 SPLINE where it curves. Every colour the tracer keeps becomes a layer of its own, named FILL_ followed by that colour's hex digits. There is no HATCH in it at all, so what you get is outlines and nothing else — right for a cutter, wrong if you were expecting filled areas.

Then the part this page keeps coming back to: we do write $INSUNITS, and the value is 4, millimetres. The coordinates sit at millimetre scale — 96 px = 25.4 mm when the millimetre fields are left empty — and the header says so, which is what spares you the 25.4 mistake above: a reader that honours the variable needs nothing from the import dialog. Those millimetre fields reach the DXF writer too, so a badge you want 120 mm across is written 120 mm across.

Two choices matter more than the rest. Colour count is layer count: two colours give one silhouette on a single layer, four to six is enough for a drawing carrying both a cut and an engrave. Keep shape stacking on Cut-outs, so holes come back as genuine closed loops instead of shapes painted over one another.

Drop an image here

or click to choose one

PNG · JPG · WEBP

Questions

What is the difference between DXF and DWG?

DWG is AutoCAD's own working format; DXF is the one Autodesk published so that everything else could read it. DWG is binary, compact and holds everything a drawing can hold, and it is what an AutoCAD user saves by default. DXF is text, larger on disk, and is what you send to somebody who is not in AutoCAD. Reading DWG elsewhere leans on third-party libraries rather than a published specification, which is why DXF remains the safer hand-off.

Why will a DXF not open in my program?

Usually the revision. The format has been extended repeatedly since the early 1980s, and a reader built for an earlier revision cannot interpret records added later — some refuse the file outright, others open it with pieces missing. $ACADVER in the header names it, and the value AC1024 is the AutoCAD 2010 flavour. Ask the sender to export lower. If it opens but looks empty, zoom to extents before giving up: the geometry may simply be a long way from the origin.

My part came out 25.4 times too big. What happened?

Units. A DXF stores bare numbers, and $INSUNITS in the header is the only thing that says what those numbers are. When it is missing the importer applies its own default — inches, in a good deal of software — so a drawing built at millimetre scale arrives 25.4 times too large, or the reverse. Nothing about the geometry is wrong. Set the unit yourself and measure a known feature before committing material.

What can actually be inside one?

Entities. LINE, ARC and CIRCLE are the primitives; LWPOLYLINE is the workhorse, a lightweight chain of vertices that can close into a loop and bulge into arc segments; SPLINE is a real curve through control points; TEXT and MTEXT hold lettering; INSERT places a reusable block; HATCH fills a region with a pattern or a solid colour. Every entity names a layer, which is how one file keeps cutting, folding and engraving apart. There is also an IMAGE record that merely points at a bitmap — a file built from those is a picture in a CAD wrapper, not geometry.

Is a DXF a vector file, and does it carry colour?

It is vector: coordinates and curves, scalable without loss, followable by a machine. Colour exists but means something different than it does in artwork — an entity takes a colour index or a true colour, usually inherited from its layer, and in CAD that is a label saying which operation a contour belongs to. Nothing is filled unless a HATCH says so, so a drawing that looks like a wireframe on screen is behaving normally.

What does the converter on this page put in the file?

DXF R2010 (AC1024), outlines only: LWPOLYLINE for straight runs, open degree-3 SPLINE for curves, one layer per colour named FILL_ plus that colour's hex digits, and no HATCH anywhere. It also writes $INSUNITS = 4, so the millimetre scale of the coordinates is declared in the file rather than left to the import dialog, and a width and height in mm typed before converting are applied to the DXF and to any SVG, PDF or EPS from the same run. Inputs are PNG, JPEG or WEBP, one image per conversion, up to 25 MB and 40 megapixels. Free and watermark-free: preview your result without an account, then a free Google sign-in releases the download. Links expire after 1 hour, and uploaded images and generated files are removed by an automatic 1-day deletion rule.

Related pages