About Binary DXF Files (DXF)

The ASCII DXF file format is a complete representation of an AutoCAD drawing in ASCII text form, and is easily processed by other programs. In addition, AutoCAD can produce or read a binary form of the full DXF file and accept limited input in another binary file format.

The SAVE and SAVEAS commands provide a Binary option that writes binary DXF files. Such a file contains all the information present in an ASCII DXF file but in a more compact form that takes about 25 percent less file space. It can be read and written more quickly (typically, five times faster) by AutoCAD. Unlike ASCII DXF files, which entail a trade-off between size and floating-point accuracy, binary DXF files preserve the accuracy in the drawing database. (AutoCAD Release 10 was the first version to support this form of DXF file; it cannot be read by earlier releases.)

A binary DXF file begins with a 22-byte sentinel consisting of the following:


Following the sentinel are data pairs (group, value) which are the same as those in an ASCII DXF file except they are represented in binary form. The group code is a 2-byte integer value (1 byte in DXF files prior to AutoCAD Release 14) with the least significant byte first. Each group code is followed by its assigned value which can be one of the following:

The type of data following a group is determined from the group code by the same rules used in decoding ASCII DXF files. Translation of angles to degrees and dates to fractional Julian date representation is performed for binary files as well as for ASCII DXF files. The comment group, 999, is not used in binary DXF files.

Extended data group codes are represented in binary DXF as a single byte with the value 255, followed by a 2-byte integer value (least significant byte first) containing the actual group code, followed by the actual value.

Extended data values are represented in the same way as those in an ASCII DXF file. For example, for an extended data long group, the following values would appear, occupying 1, 2, and 4 bytes respectively.

Escape group code
True group code
Value for the 1071 group code

SAVEAS writes binary DXF files with the same file type (.dxf) as for ASCII DXF files. The OPEN and INSERT commands automatically recognize a binary file by means of its sentinel string. The file doesn't need to be identified as a binary file.

If the OPEN and INSERT commands encounter an error in a binary DXF file, AutoCAD reports the byte address within the file where the error was detected.