Autodesk publishes a DXF Reference with each AutoCAD release. This page follows the AutoCAD 2012 edition (reference version u19.1.01), whose layout later editions keep; version numbers of later releases come from those editions. Readers should not rely on the order of group codes within an object and should ignore codes they do not know, as Autodesk adds new ones in every release.
Group code and value pairs
- An ASCII DXF file is a sequence of pairs, each on two lines: an integer group
code, then its value. Leading spaces before the code are normal
(
0). - The code’s range fixes the value’s type (below); the code and the object it belongs to fix its meaning.
- Code 0 begins every object, entity, table, table entry and section marker; an object ends where the next 0 begins.
- Strings are limited to 256 characters per line in the file (2049 single-byte
characters for extended symbol names since AutoCAD 2000). Control characters are
written as a caret and a letter (
^Gfor BEL); a real caret is written^. - Code 999 is a comment, ignored when reading and never written by AutoCAD.
- Angles are in degrees in DXF files (radians in AutoLISP and ObjectARX).
Sections
Each section starts with 0 SECTION, 2 name
and ends with 0 ENDSEC. The file ends with 0 EOF.
| Section | Holds |
|---|---|
HEADER | Drawing settings: each a 9 group with the variable name (such as $ACADVER) followed by its value groups |
CLASSES | Application-defined classes: 0 CLASS, then 1 DXF record name, 2 C++ class name, 3 application name, 90 proxy capability flags, 91 instance count, 280 was-a-proxy flag, 281 is-an-entity flag |
TABLES | Symbol tables: APPID, BLOCK_RECORD, DIMSTYLE, LAYER, LTYPE, STYLE, UCS, VIEW and VPORT. Each is 0 TABLE, 2 table name, common codes, its entries, then 0 ENDTAB |
BLOCKS | Block definitions: 0 BLOCK, its entities, 0 ENDBLK |
ENTITIES | The drawing’s graphical objects, including block references (INSERT) |
OBJECTS | Non-graphical objects: dictionaries, layouts, groups, styles and so on. The first is the root dictionary |
THUMBNAILIMAGE | Optional preview: 90 byte count, then 310 lines of hexadecimal image data |
The reference’s rules for files written by other programs: HEADER may be left
out; any table, and the whole TABLES section, may be left out; LTYPE must come
before LAYER if both are given; BLOCKS may be left out if no blocks are used, and
must come before ENTITIES; layers named in entities but not defined are created
with colour 7 and linetype CONTINUOUS; EOF must be present. A file of
just an ENTITIES section and EOF is therefore valid.
Versions
The header variable $ACADVER (group 1) names the drawing database
version:
| Value | AutoCAD release |
|---|---|
AC1006 | Release 10 |
AC1009 | Releases 11 and 12 |
AC1012 | Release 13 |
AC1014 | Release 14 |
AC1015 | AutoCAD 2000 |
AC1018 | AutoCAD 2004 |
AC1021 | AutoCAD 2007 |
AC1024 | AutoCAD 2010 |
AC1027 | AutoCAD 2013 |
AC1032 | AutoCAD 2018 |
From AC1021 on, text in a DXF file is UTF-8; earlier files use the code page named
by $DWGCODEPAGE.
Group code value types
| Codes | Value |
|---|---|
| 0–9 | String (up to 2049 single-byte characters) |
| 10–39 | Double-precision 3D point coordinate |
| 40–59 | Double-precision floating point |
| 60–79 | 16-bit integer |
| 90–99 | 32-bit integer |
| 100 | String (up to 255 characters): subclass marker |
| 102 | String (up to 255 characters): control string |
| 105 | Hexadecimal handle |
| 110–119 | Double-precision floating point |
| 120–129 | Double-precision floating point |
| 130–139 | Double-precision floating point |
| 140–149 | Double-precision scalar |
| 160–169 | 64-bit integer |
| 170–179 | 16-bit integer |
| 210–239 | Double-precision floating point |
| 270–279 | 16-bit integer |
| 280–289 | 16-bit integer |
| 290–299 | Boolean flag |
| 300–309 | Arbitrary text string |
| 310–319 | Hexadecimal binary chunk |
| 320–329 | Hexadecimal handle |
| 330–369 | Hexadecimal object IDs |
| 370–379 | 16-bit integer |
| 380–389 | 16-bit integer |
| 390–399 | Hexadecimal handle |
| 400–409 | 16-bit integer |
| 410–419 | String |
| 420–429 | 32-bit integer |
| 430–439 | String |
| 440–449 | 32-bit integer |
| 450–459 | Long |
| 460–469 | Double-precision floating point |
| 470–479 | String |
| 480–481 | Hexadecimal handle |
| 999 | Comment |
| 1000–1009 | String |
| 1010–1059 | Double-precision floating point |
| 1060–1070 | 16-bit integer |
| 1071 | 32-bit integer |
Group codes in numerical order
“Fixed” codes always mean the same thing; the others depend on the object. Negative codes appear only in AutoLISP and ObjectARX, never in files.
| Code | Meaning |
|---|---|
| −5 | Persistent reactor chain (applications) |
| −4 | Conditional operator, for selection sets (applications) |
| −3 | Extended data sentinel (applications; fixed) |
| −2 | Entity name reference (applications; fixed) |
| −1 | Entity name, changing on every open, never saved (applications; fixed) |
| 0 | Entity or object type, or section marker (fixed) |
| 1 | Primary text value |
| 2 | Name: attribute tag, block name and so on |
| 3–4 | Other text or name values |
| 5 | Entity handle: up to 16 hexadecimal digits (fixed) |
| 6 | Linetype name (fixed) |
| 7 | Text style name (fixed) |
| 8 | Layer name (fixed) |
| 9 | Header variable name (HEADER section only) |
| 10 | X of the primary point (start of a line, centre of a circle…); Y and Z follow as 20 and 30 |
| 11–18 | X of other points; Y and Z as 21–28 and 31–37 |
| 20, 30 | Y and Z of the primary point |
| 21–28, 31–37 | Y and Z of other points |
| 38 | Entity elevation, if not zero |
| 39 | Entity thickness, if not zero (fixed) |
| 40–47 | Doubles: text height, scale factors and so on |
| 48 | Linetype scale |
| 49 | Repeated double, such as LTYPE dash lengths; a 7x count group comes first |
| 50–58 | Angles, in degrees |
| 60 | Visibility: absent or 0 visible, 1 invisible |
| 62 | Colour number (fixed): 0 BYBLOCK, 256 BYLAYER; on a layer, negative means the layer is off |
| 66 | “Entities follow” flag (fixed) |
| 67 | Space: absent or 0 model space, 1 paper space (fixed) |
| 68 | Viewport status (applications) |
| 69 | Viewport identification number (applications) |
| 70–78 | Integers: repeat counts, flag bits, modes |
| 90–99 | 32-bit integers |
| 100 | Subclass marker, naming the C++ class (such as AcDbEntity, AcDbLine) whose data follows |
| 102 | Control string {name … } grouping application data, such as {ACAD_REACTORS and {ACAD_XDICTIONARY |
| 105 | Handle of a DIMSTYLE table entry |
| 110, 120, 130 | UCS origin X, Y, Z (when code 72 is 1) |
| 111, 121, 131 | UCS X axis |
| 112, 122, 132 | UCS Y axis |
| 140–149 | Doubles: points, elevation, DIMSTYLE settings |
| 160–169 | 64-bit integers |
| 170–179 | 16-bit integers, such as DIMSTYLE flags |
| 210, 220, 230 | Extrusion direction X, Y, Z (fixed); default (0, 0, 1) |
| 270–279 | 16-bit integers |
| 280–289 | 16-bit integers |
| 290–299 | Booleans |
| 300–309 | Arbitrary text strings |
| 310–319 | Binary chunks: up to 254 hexadecimal characters for up to 127 bytes |
| 320–329 | Arbitrary handles, kept as they are on INSERT and XREF |
| 330–339 | Soft-pointer handles, translated on INSERT and XREF (330 is the owner) |
| 340–349 | Hard-pointer handles |
| 350–359 | Soft-owner handles |
| 360–369 | Hard-owner handles |
| 370–379 | Lineweight enum (370 is the entity’s) |
| 380–389 | Plot style name type |
| 390–399 | Handle of a plot style name object |
| 400–409 | 16-bit integers |
| 410–419 | Strings (410 is the layout name) |
| 420–427 | True colour, 0x00RRGGBB as a 32-bit integer: red 200, green 100, blue 50 is 0x00C86432 = 13132850 |
| 430–437 | Colour name |
| 440–447 | Transparency, as a 32-bit integer |
| 450–459 | Long |
| 460–469 | Doubles |
| 470–479 | Strings |
| 480–481 | Hard-pointer handles |
| 999 | Comment |
| 1000 | Extended data string, up to 255 bytes |
| 1001 | Extended data application name, up to 31 bytes; starts each application’s data |
| 1002 | Extended data control string, { or } |
| 1003 | Extended data layer name |
| 1004 | Extended data binary chunk, up to 127 bytes |
| 1005 | Extended data entity handle |
| 1010, 1020, 1030 | Extended data point |
| 1011, 1021, 1031 | Extended data world-space position |
| 1012, 1022, 1032 | Extended data world-space displacement |
| 1013, 1023, 1033 | Extended data world-space direction |
| 1040 | Extended data real |
| 1041 | Extended data distance (scaled with the entity) |
| 1042 | Extended data scale factor |
| 1070 | Extended data 16-bit integer |
| 1071 | Extended data 32-bit integer |
Tables and handles
0
TABLE
2
LAYER
5
2
100
AcDbSymbolTable
70
1
0
LAYER
5
10
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
2
0
70
0
62
7
6
CONTINUOUS
0
ENDTAB
0 in colour 7. Each
table and entry has its own handle (group 5); 70 in the table is the maximum
number of entries.Every object has a handle, a hexadecimal number unique in the drawing; the header
variable $HANDSEED is larger than any handle in use. Group 330 gives
the owner’s handle, and 102 groups {ACAD_REACTORS and
{ACAD_XDICTIONARY list reactors and the extension dictionary. The
DIMSTYLE table is an exception: its entries use group 105 for their handle.
Binary DXF
A binary DXF file, written by AutoCAD with the same .dxf extension,
starts with a 22-byte sentinel:
41 75 74 6F 43 41 44 20 42 69 6E 61 72 79 20 44 58 46 0D 0A 1A 00
A u t o C A D B i n a r y D X F CR LF SUB NUL
Pairs follow in binary form. The group code is 2 bytes, little-endian (1 byte before Release 14, when extended data codes were written as a 255 byte followed by the 2-byte code). The value’s form follows from the code’s type:
| Value type | Bytes |
|---|---|
| 16-bit integer | 2, little-endian |
| 32-bit integer (90–99, 420–429, 440–449, 1071) | 4 |
| 64-bit integer (160–169) | 8 |
| Double | 8, IEEE 754, little-endian |
| Boolean (290–299) | 1 |
| Binary chunk (310–319, 1004) | 1-byte length, then that many bytes |
| String and handle | Bytes ending in a 0 byte |
The 999 comment is not used. Binary DXF keeps full double precision and is about a quarter smaller than ASCII. The sizes of the 32-bit, 64-bit and boolean values are not spelt out in the 2012 reference; they are those used by the ezdxf library’s binary reader.
Object coordinate systems
Planar entities (circles, arcs, 2D polylines, text, inserts and others) store their points in an object coordinate system defined only by the extrusion direction (210/220/230). Its axes come from the “arbitrary axis algorithm”: if the extrusion direction N has |Nx| < 1/64 and |Ny| < 1/64, the X axis is (0, 1, 0) × N, otherwise (0, 0, 1) × N, normalised; the Y axis is N × X. LINE, POINT, 3DFACE and 3D polylines use world coordinates.
Sections in detail
- Header variables – every HEADER variable, its group code and values
- Classes, tables and blocks – class records and default classes, every symbol table, BLOCK and ENDBLK
- Entities – the common entity codes and every entity
- Objects – the common object codes, every object, the thumbnail and extended data
Those pages follow the AutoCAD 2014 DXF Reference (March 2013), the newest edition
Autodesk offers as a PDF; its structure chapters match the 2012 edition used
here. Later editions are online help only; the 2018 one adds
AC1032.