What Is DWG?
DWG (short for DraWinG) is the native binary file format used by Autodesk AutoCAD — the world's most widely deployed CAD software — and the de facto standard for computer-aided design data exchange in architecture, engineering, and manufacturing. Every version of AutoCAD since its 1982 release has used DWG as its primary format, though the format has evolved significantly across those four decades.
The "DWG" name predates AutoCAD itself, originating from early CAD programs in the 1970s that simply named drawings with the .dwg extension. When Autodesk released AutoCAD 1.0 in December 1982, they adopted this convention, and DWG has remained the format's extension ever since.
Why DWG Is Proprietary — and Why It Matters
Unlike IFC or Shapefile, Autodesk has never published the DWG specification. It is a proprietary binary format, and Autodesk aggressively protects its reverse-engineered implementations through litigation. However, the Open Design Alliance (ODA) — a consortium of software vendors — maintains the OpenDWG specification through reverse engineering, enabling open-source and competing tools to read and write DWG files with high (but not 100%) fidelity.
This means:
- Only Autodesk software is guaranteed to read all DWG features correctly
- Third-party tools (LibreCAD, QCAD, FreeCAD, Bentley) handle most DWG content but may misrender advanced features
- Converting DWG to DXF is the recommended interoperability path for non-Autodesk software
DWG Version History
Each major AutoCAD release introduced a new DWG format version. Files saved in newer versions cannot be opened by older software without conversion:
| DWG Version | AutoCAD Version | Year |
|---|---|---|
| R14 | AutoCAD 14 | 1997 |
| 2000 (AC1015) | AutoCAD 2000–2002 | 1999 |
| 2004 (AC1018) | AutoCAD 2004–2006 | 2003 |
| 2007 (AC1021) | AutoCAD 2007–2009 | 2006 |
| 2010 (AC1024) | AutoCAD 2010–2012 | 2009 |
| 2013 (AC1027) | AutoCAD 2013–2017 | 2012 |
| 2018 (AC1032) | AutoCAD 2018–2022 | 2018 — most current widely used |
| 2021+ | AutoCAD 2021–current | 2020 |
When saving in AutoCAD, always check the "Save as type" — by default it saves in the current version. Collaborators using AutoCAD 2015 cannot open a DWG saved in 2021 format.
What a DWG File Contains
A DWG file organizes CAD data into several logical sections:
Entities — the geometric and annotation objects:
| Entity Type | Description |
|---|---|
LINE |
Start point and endpoint |
ARC |
Center, radius, start/end angles |
CIRCLE |
Center and radius |
POLYLINE / LWPOLYLINE |
Sequence of connected line segments and arcs |
SPLINE |
Non-uniform rational B-spline curve |
TEXT / MTEXT |
Single-line and multiline annotation |
DIMENSION |
Automatic dimension annotation with extension lines |
INSERT |
Reference to a block definition (like a stamp) |
HATCH |
Fill patterns bounded by a closed loop |
SOLID / 3DSOLID |
2D filled triangles or ACIS 3D solid bodies |
IMAGE |
Raster image reference (jpeg, png, tiff embedded by reference) |
Layers — named groups controlling visibility, color, linetype, and lineweight:
Layer 0: default, color=white, linetype=Continuous
WALLS: color=red (1), linetype=Continuous, lineweight=0.5mm
DIMENSIONS: color=cyan (4), linetype=Continuous, lineweight=0.18mm
HIDDEN_LINES: color=blue (5), linetype=DASHED, lineweight=0.25mm
A-FLOR-OTLN: AIA Layer Standard format
Blocks — named, reusable symbol definitions inserted with INSERT:
A door symbol defined once as BLOCK DOOR-90CM, then inserted hundreds of times across all floor plans. Editing the block definition updates every insertion automatically.
External References (Xrefs) — linked external DWG files: The architectural floor plan references the structural engineer's column grid as an Xref. Each discipline maintains their own file; the Xref appears overlaid but is not embedded.
Layouts — named print configurations:
- Model Space: where you draw at full scale (1:1)
- Paper Space: one or more named layouts (Plan, Section, Detail) with viewports showing Model Space at different scales and annotations for printing
DXF: The Open Exchange Partner
DXF (Drawing Exchange Format) is AutoCAD's human-readable ASCII (and binary) exchange format, designed specifically to enable data transfer between AutoCAD and other applications. While DWG is the native format, DXF is the interoperability standard.
0
SECTION
2
ENTITIES
0
LINE
8
WALLS
10
0.0
20
0.0
30
0.0
11
100.0
21
0.0
31
0.0
0
ENDSEC
0
EOF
DXF is fully documented by Autodesk and supported by virtually every CAD application. The recommended interoperability workflow: DWG → DXF → target application.
Working with DWG/DXF in Python
ezdxf is the dominant open-source Python library for DXF (and limited DWG) access:
import ezdxf
# Open a DXF file
doc = ezdxf.readfile("floor_plan.dxf")
msp = doc.modelspace()
# List all entities
for entity in msp:
print(f"Type: {entity.dxftype()}, Layer: {entity.dxf.layer}")
# Filter by type
walls = [e for e in msp if e.dxftype() == 'LWPOLYLINE' and e.dxf.layer == 'WALLS']
print(f"Wall segments: {len(walls)}")
# Extract line endpoints
for line in msp.query("LINE"):
start = line.dxf.start # Vec3(x, y, z)
end = line.dxf.end
print(f" ({start.x:.2f}, {start.y:.2f}) → ({end.x:.2f}, {end.y:.2f})")
# Extract text
for text in msp.query("TEXT MTEXT"):
content = text.plain_mtext() if text.dxftype() == 'MTEXT' else text.dxf.text
print(f" Text on layer {text.dxf.layer}: '{content}'")
# Create a new DXF document
new_doc = ezdxf.new(dxfversion="R2010")
new_msp = new_doc.modelspace()
new_msp.add_line((0, 0), (100, 0), dxfattribs={"layer": "WALLS"})
new_msp.add_circle((50, 50), radius=25, dxfattribs={"layer": "COLUMNS"})
new_doc.saveas("output.dxf")
ezdxf reads DXF natively. For DWG input, use the ODA File Converter (free command-line tool from the Open Design Alliance) to batch-convert DWG to DXF first.
Free DWG Viewers
| Tool | Platform | Notes |
|---|---|---|
| Autodesk DWG TrueView | Windows | Official free viewer from Autodesk; converts between DWG versions |
| eDrawings Viewer | Windows/macOS | SOLIDWORKS-family viewer; also handles DWG |
| A360 Viewer | Web | Autodesk online viewer; upload and view in browser |
| LibreCAD | Windows/macOS/Linux | Open-source 2D CAD; reads DXF natively, DWG via ODA |
| FreeCAD | Windows/macOS/Linux | Open-source 3D CAD; reads DXF, limited DWG |
| QCAD Community | Windows/macOS/Linux | 2D CAD; DXF native, DWG via plugin |
| ODA File Converter | Windows/macOS/Linux | CLI batch converter DWG↔DXF, all versions |
Converting DWG to PDF
AutoCAD itself: PLOT command → select PDF plotter → choose layout → publish.
From command line using ODA + Ghostscript or LibreCAD:
# Step 1: Convert DWG to DXF with ODA File Converter
OdaFileConverter.exe input.dwg output_folder/ ACAD2010 DXF 0 1
# Step 2: Import DXF in LibreCAD, export to PDF
# Or use ezdxf + matplotlib for basic rendering:
import ezdxf
from ezdxf.addons.drawing import RenderContext, Frontend
from ezdxf.addons.drawing.matplotlib import MatplotlibBackend
import matplotlib.pyplot as plt
doc = ezdxf.readfile("plan.dxf")
fig = plt.figure(figsize=(20, 14))
ax = fig.add_axes([0, 0, 1, 1])
ctx = RenderContext(doc)
out = MatplotlibBackend(ax)
Frontend(ctx, out).draw_layout(doc.modelspace())
fig.savefig("plan.pdf", dpi=300)
DWG File Sizes
- Simple 2D floor plan (walls, doors, windows, text): 200 KB – 2 MB
- Complex architectural set (multiple sheets, xrefs, hatches): 5–50 MB
- Mechanical assembly with 3D solids: 20–200 MB
- Large infrastructure project with numerous xrefs: hundreds of MB across multiple files
DWG compresses embedded data internally — the binary format is more compact than equivalent DXF, which can be 3–10× larger for the same drawing.
Related conversions
Frequent conversions across the catalogue: