Formats / DWG / Inside the file
Inside the file: DWG
We have no example we may redistribute, so this page explains how the format is organized, from public documentation.
How a DWG file is organized
DWG is AutoCAD's native binary drawing format. Autodesk does not publish it; the Open Design Alliance publishes a free description reconstructed by clean-room work, which is what open readers such as LibreDWG follow.
- Version string
- The first six bytes name the release, such as AC1032 for the AutoCAD 2018 format family.
- File header
- Pointers to the sections and, in newer versions, a section map and page map; newer files are split into pages that may be compressed.
- Header variables
- Drawing settings, the same variables DXF writes in its HEADER section.
- Classes
- Definitions of the custom object classes used in the drawing.
- Objects
- Entities and non-graphical objects as bit-packed records, each with a handle.
- Object map
- An index from handles to object positions, so a reader can find any object.
Sources
Samples published by others are linked on the format page.
Parsers here are our own, written from published specifications and public documentation; nothing is decompiled or taken from vendor SDKs. See the method notes.