The biggest DWG file I ever met was 1.4 gigabytes, and it contained, as far as anyone could tell, a single drawing of a single pump station. It had arrived from a consultant who had been working on the project for two years, and it had the slow, apologetic look of a file that knows it has a problem. It took eleven minutes to open. It crashed on save about one time in three. And when I finally got it open and typed ZOOM EXTENTS, the screen showed a tiny scatter of dots at one end and a vast, empty space that seemed to stretch to infinity. Somewhere in that drawing, a very small object had been created at a very large distance from everything else.
The cleanup took an afternoon, and the file came out at 11 megabytes, opening in six seconds. What had been in the other 1,389 megabytes? Orphaned definitions from forty imported drawings, a proxy-object graveyard, a scale list with 800 entries, ten thousand registered applications, and one stray point at a coordinate with twenty zeros in it. None of it was content. All of it was baggage, picked up over two years of copying, pasting, importing and inserting, with nobody ever cleaning up.
That’s the thing about DWG files that every CAD manager learns eventually: they only grow. Every copy-paste from another drawing brings its definitions. Every imported file leaves its styles. Every crashed session may leave a small corruption. A drawing doesn’t forget, and unless you teach it to, it carries its entire history. The results are the two problems of this guide: bloat, where a file is too big and too slow because of what it contains, and corruption, where a file is damaged and misbehaves, refuses to open or crashes. They are related, since bloat makes corruption more likely, and the tools for both overlap: audit, recover and purge.
In this guide I’ll explain what bloat and corruption are, how to diagnose them (with a tested analyzer that reads a DXF and shows where the bytes are and where the stray objects hide), the cleanup ladder from the gentle commands to the radical rebuild, how to salvage a damaged file step by step, how to use backups and autosave files, how to recover what’s inside by other means, and how to prevent the problem across an office. It is part of our Autodesk series. For the related performance problems, see AutoCAD Map 3D and Civil 3D Slow or Crashing, and for archives in bulk, Batch Processing DWG Files: Core Console, Scripts and FME.
A note on facts: command options, prompts and behavior vary between AutoCAD, Map 3D and Civil 3D versions, and I cannot run them here. The command descriptions are patterns to verify (and always work on a copy). The Python analyzer was tested on a synthetic DXF with a bloated objects section and a stray entity.

First: Work on a Copy
Every technique in this guide can lose data. Before you do anything:
- Copy the file (and its references, if you need them) to a working folder.
- Keep the original untouched, read-only if possible.
- Note the file’s size and open time before you start, so that you can measure what you gain.
- Don’t clean the only copy in a hurry.
This is the one rule on which everything else depends.
What “Bloated” Means
A DWG is bloated when its size (and often its load time) is out of proportion to its real content. Typical sources:
| Source | What it is | Symptom |
|---|---|---|
| Unused named objects | Blocks, layers, line types, text styles, dimension styles, material, visual styles never used | Larger file, long lists in dialogs |
| Orphaned data | Definitions left behind by deleted or copied objects, no longer referenced | Hidden size, slow open |
| Registered applications (regapps) | Names registered by applications that attach extended data. Imported drawings can bring thousands | Slow open, huge tables |
| Proxy objects and custom data | Placeholders for objects from applications that aren’t installed | Size, warnings, instability |
| Annotation scale list bloat | Hundreds of duplicate scales, often arriving with xrefs | Slow open, save and plot |
| DGN linestyle remnants | Data left by imported MicroStation files | Large, hard to purge by normal means |
| Stray objects | A tiny object at a huge distance, or duplicates stacked on each other | Absurd extents, slow regen, plot errors |
| Duplicate geometry | Many copies on the same place | Size, double counting, slow selection |
| Over-detailed geometry | Polylines with enormous vertex counts, splines, hatches with thousands of islands | Slow regen |
| Embedded raster data | Images pasted in or OLE objects | Size |
| Thumbnails and preview images | Rarely large, but stored | Minor |
| Versions and history | Old drawing versions upgraded repeatedly, carrying junk | Size |
| Long layer, block and style lists | From merging many drawings | Slow dialogs |
| Leftover civil objects | Civil 3D styles, label styles and settings that are never used | Larger drawings, slower open |
Bloat is not corruption, but it makes corruption more likely, by increasing the surface for errors.
What “Corrupted” Means
A DWG is corrupted when its internal structure is damaged. Causes:
- Interrupted saves: a crash, a power failure or a lost network connection during a save.
- Storage or network problems: a failing disk, a flaky network share, sync software interfering with a save.
- Software bugs, especially across versions or with third-party plugins.
- Incompatible round trips: saving between formats or products that don’t agree.
- Bad objects or data: an object with impossible values (a NaN coordinate), invalid references between objects.
- Memory problems during a save.
- Third-party applications that write nonstandard data.
Signs:
- The file won’t open, or reports errors (an “invalid” or “bad” message).
- The software offers to recover the drawing on opening.
- The drawing opens but misbehaves: commands fail, objects vanish, features are missing.
- Crashes on specific actions in that drawing.
- Audit finds errors, often many.
- Strange behavior such as dimensions that won’t edit, blocks that won’t insert, layouts that crash.
Diagnosing Where the Size Is
Before cleaning, find out what is large. A DXF export of the drawing is text, and a small script can read the section structure and show you where the bytes are. The sections of a DXF are HEADER, CLASSES, TABLES, BLOCKS, ENTITIES and OBJECTS, and each tells a story:
| Large section | What it usually means |
|---|---|
| ENTITIES | Real content (lots of geometry), duplicates, over-detail |
| BLOCKS | Many or large block definitions, nested blocks, imported junk |
| TABLES | Huge layer, style, line type and regapp tables |
| OBJECTS | Dictionaries, scale lists, layouts, proxies, extended records: a classic bloat location |
| CLASSES | Many custom classes (often from applications) |
A tested analyzer for the section sizes and the extents of the entities:
def dxf_section_sizes(path):
"""Approximate bytes per DXF section, by summing the group code and value lines."""
sizes, current, expecting_name = {}, None, False
lines = open(path, encoding="latin-1").read().split("\n")
i = 0
while i < len(lines) - 1:
code, value = lines[i].strip(), lines[i + 1].strip()
n = len(lines[i]) + len(lines[i + 1]) + 2
if code == "0" and value == "SECTION":
expecting_name, current = True, None
elif code == "2" and expecting_name:
current, expecting_name = value, False
sizes[current] = 0
elif code == "0" and value == "ENDSEC":
current = None
elif current:
sizes[current] += n
i += 2
return sizes
def entity_extents(path):
"""Minimum and maximum X and Y of the points in the ENTITIES section: find stray objects."""
xs, ys, in_entities = [], [], False
lines = open(path, encoding="latin-1").read().split("\n")
i = 0
while i < len(lines) - 1:
code, value = lines[i].strip(), lines[i + 1].strip()
if code == "2" and value == "ENTITIES":
in_entities = True
elif code == "0" and value == "ENDSEC":
in_entities = False
elif in_entities and code in ("10", "11", "12", "13"):
xs.append(float(value))
elif in_entities and code in ("20", "21", "22", "23"):
ys.append(float(value))
i += 2
return min(xs), min(ys), max(xs), max(ys)
# On a synthetic DXF with 500 junk records in OBJECTS, two LINE entities (one at 1e20) and a tiny HEADER:
# dxf_section_sizes -> {'HEADER': 24, 'OBJECTS': 24228, 'ENTITIES': 128}
# entity_extents -> (1.0, 1.0, 1e+20, 2e+20)On the test file, the analyzer showed at once that the OBJECTS section held almost all of the bytes (24,228 out of about 24,400), and that the entity extents ran from 1.0 to 1e+20: a stray entity at an impossible distance. That is exactly the fingerprint of the monster pump station file, in miniature. (Sizes are approximate, and real DXF files contain more structure than the test. Run it on a conversion of the suspect drawing, as in Batch Processing DWG Files: Core Console, Scripts and FME, and compare sections across drawings.)
Use the extents result as a rule: if the entities’ bounding box is much larger than the area you expect, find the stray object. In the application, use ZOOM EXTENTS to see the problem, then select objects far from the main content (with a crossing window around the stray area, or with a filter by position) and delete them. A simple diagnostic: list the entities with coordinates beyond a sane limit.
The Cleanup Ladder
Work from the gentlest remedy to the most radical, measuring after each step. Stop as soon as the file is healthy.
Rung 1: AUDIT
The AUDIT command checks the drawing’s database for errors and, if you answer yes, fixes them. It finds invalid objects, broken references, bad table entries and so on, and reports a list. Run it first, always, and read the report. A drawing with many audit errors is telling you something. A clean audit doesn’t prove that the file is healthy, but an unclean one proves that it isn’t.
Rung 2: RECOVER
RECOVER opens a damaged drawing, attempts to repair it and reports what it did. A variant recovers the drawing together with its external references, and these are handy when the references are damaged too. Recovery is the first-line treatment for a drawing that won’t open normally, or that the software flagged on opening. Always follow it with an audit.
Rung 3: PURGE (and the options that matter)
The PURGE command removes unused named objects. The command-line version, -PURGE, offers options for each type, including:
- Blocks, dimension styles, groups, layers, line types, materials, multileader styles, plot styles, shapes, text styles, multiline styles, table styles, visual styles.
- Regapps: registered applications. Purging them can remove the thousands of unused entries that imported drawings bring.
- Zero-length geometry and empty text objects: clean-up of meaningless objects.
- Orphaned data: data left behind that nothing refers to.
- All: everything the command can remove.
Purging is iterative: removing a block may leave its layer unused, so run it repeatedly until nothing more is removed. Nested and dependent items need several passes. Check before purging layers or styles that your office standard requires to exist even if unused (some do): purge those you don’t need, and keep what your standard requires.
Rung 4: Clean up the content
OVERKILL: removes duplicate and overlapping objects, and can combine collinear segments. A major space saver for drawings with stacked geometry, and a prerequisite for clean analysis. See Drawing Cleanup in AutoCAD Map 3D Explained.- Stray objects: delete anything far from the model (see the analyzer).
- Simplify polylines with excessive vertices, where the accuracy allows.
- Reduce hatches with thousands of islands, or recreate them.
- Remove unneeded raster images and OLE objects, and clip the ones you need.
- Reset the annotation scale list: the scale list can be reset to the default or edited with the scale list command, and the oversized list that arrives with xrefs is a famous bloat source. After resetting, audit.
- Delete unused layouts and clean up viewports.
Rung 5: The clean-export rebuild (WBLOCK)
When the file is still bloated after the gentle steps, move the content into a brand new drawing, leaving the baggage behind:
- In the bloated drawing, use
WBLOCK, choose to write the entire drawing (the “entire drawing” option, or the option that selects all objects, depending on the version), and save as a new file. - The new file contains the objects and the definitions that they actually use, but not the orphaned data and many accumulated tables.
- Open the new file, and check: layers, styles, layouts (some settings, such as layouts and some drawing properties, may not carry over and need rebuilding or copying), units, the coordinate system (re-assign if necessary, with the evidence) and external references.
- Run audit and purge on the new file, and compare size and open time.
This works astonishingly often. The 1.4-gigabyte file came down to 11 megabytes in this way. Check what you lose: layouts and some settings, Civil 3D object relationships and data shortcut links, dynamic content and anything that depends on the original file’s identity. For Civil 3D drawings in particular, test with care, and prefer to rebuild from the source data. See Civil 3D Data Shortcuts and Xref Problems.
Rung 6: Rebuild by insertion into a template
Create a new drawing from your standard template, and bring the content in: copy and paste with a base point (preserving coordinates), insert the old drawing as a block and explode it, or attach it as a reference and bind it. This gives you a file with your standards from the start. It is a controlled way to move content while leaving everything else behind, and the usual route for drawings from other organizations. Verify coordinates after pasting (use the same base point and the same coordinates) and check the coordinate system.
Rung 7: Reconvert through another format
Save as DXF, then reopen and save as DWG. A text format forces a rebuild of the database, and sometimes strips corruption. It may lose some advanced objects. Or read it with another tool (an independent DWG or DXF reader such as the ODA tools) and re-export. See Batch Processing DWG Files: Core Console, Scripts and FME.
Rung 8: Go back to a good version
If the file is truly damaged, look for earlier copies: the .bak file the software saves, autosaves, backups, versions in your document management system, the file as sent to a client, or a PDF to reconstruct from in the worst case.
Rescuing a Damaged File, Step by Step
For a drawing that won’t open, or opens broken:
- Copy it. Check the file size: a zero-byte or tiny file is beyond recovery, so go to backups.
- Try
RECOVER(or the open dialog’s recovery option, if offered). Note what it reports. - Run
AUDITon the recovered drawing, and read the report. - Try opening it in a different version or product of the same software, or on another machine. Sometimes the problem is in the environment, not the file.
- Open it as an external reference into a new drawing. If the host drawing can read the objects, you can bind or copy them out.
- Insert it into a new drawing (the
INSERTcommand with the drawing file) and explode, if it opens that way. - Use
WBLOCKfrom the recovered drawing, if it opens at all. - Save to DXF from the recovered drawing, if possible, and reopen the DXF.
- Use an independent reader (convert the DWG to DXF with the ODA File Converter, or read the DXF with a recovery-capable library) to extract the geometry, even when the original fails.
- Look for the backup chain: the
.bakfile (rename it with a.dwgextension), the autosave file (typically with a.sv$extension, in the autosave location, which may need renaming), earlier versions on the server, a snapshot from the backup system. - Rebuild from sources: the survey data, the GIS data, the design drawings, the data shortcuts. For Civil 3D, the objects can often be recreated from their source data.
- Last resort: a specialist recovery service.
If you can read the DXF form at all, a recovery-oriented reader (the open-source ezdxf library has a recovery mode designed to read damaged DXF files by skipping what it cannot parse) can extract entities that the standard readers refuse. Check its documentation for the current interface, and test it on a copy.
The Civil 3D Complication
Civil 3D drawings add risks, because their objects are custom, interdependent and often connected to data shortcuts and external data.
- Don’t clean a Civil 3D drawing in a product without Civil 3D (the proxy objects can be damaged on save). Use the proper product.
- WBLOCK and exports can break relationships between surfaces, alignments, profiles, corridors and labels. Test on a copy and check every object.
- Data shortcuts point to drawings and objects by name. Rebuilding a source drawing as a new file may break the shortcuts, so keep file names and object names, and re-validate. See Civil 3D Data Shortcuts and Xref Problems.
- Styles and label styles accumulate in a drawing. Purging unused styles can help, but some office standards want them present.
- Large surfaces and point groups inflate drawings. Thin them, and keep survey data in separate source drawings.
- Export to AutoCAD objects is a one-way street, creating drawings fit for GIS or other software, not for continued Civil 3D work. See DWG Import Errors in QGIS and ArcGIS (Blocks, 3D Faces, Encoding).
Backups and Autosave: Know Where They Are
Before you ever need them, know your safety nets.
- The backup file: most AutoCAD-based products save a
.bakcopy of the previous version whenever you save. Renaming it to.dwgrestores the prior save. Check that the setting is on. - Autosave: the software writes periodic temporary copies (check the interval and the location in the options). After a crash, the autosave file may hold your latest work.
- Incremental saves: save under new names at milestones.
- Server backups and snapshots: your IT group’s backup system, and the time it takes to restore.
- Document management or common data environment versions. See Autodesk Docs and Construction Cloud for Geospatial and CAD Data.
- Recovery testing: once a year, restore a file from backup, to prove that the process works.
Prevention: How to Stop the Growth
The cheapest cleanup is the file that never got bloated.
Habits
- Don’t copy and paste between drawings from unknown sources without care. Prefer inserting content through your template, or use
WBLOCKto extract specific objects. - Don’t insert whole drawings as blocks unnecessarily.
- Purge, audit and save as a routine, at milestones and before issue.
- Don’t use “Save As” repeatedly in a chain of versions without cleaning.
- Bind external references with care (binding brings their definitions in). Prefer to keep them as references. See Civil 3D Data Shortcuts and Xref Problems.
- Import from other formats into a scratch drawing first, clean and then bring it into the project drawing.
- Control the scale list and the number of styles.
- Close drawings properly, and don’t work over unstable network connections.
- Limit third-party tools that add data.
Systems
- A template that starts clean, with only the standard objects.
- A standard that lists what must be present, and what should not be.
- A pre-issue checklist that includes audit, purge, overkill, a stray-object check and a file size check.
- An automated nightly or weekly report on the archive: file size, entity counts, section sizes, extents, open time. Flag outliers and investigate. See the outlier helper in AutoCAD Map 3D and Civil 3D Slow or Crashing.
- A delivery specification for consultants: “Deliveries must be audited, purged and below N megabytes, and must have extents consistent with the project area.”
- Training: an hour on why drawings grow, and what a clean drawing looks like.
- Governance of tools: inventory and review plugins and scripts. See Automating AutoCAD Map 3D: Scripts, AutoLISP and the .NET API.
A pre-issue checklist (the one I used)
- Zoom extents: does the drawing fit the project area?
- Audit, with fixes: errors cleared?
- Purge all, repeated until nothing changes.
- Overkill on drawing geometry (where appropriate).
- Scale list checked and reset if oversized.
- Unused layouts and images removed.
- External references resolved, with valid paths.
- File size compared with similar drawings.
- Open and regen time acceptable.
- Saved, and a backup in place.
A Worked Example: The 1.4-Gigabyte Pump Station
Situation: a pump station drawing from a consultant, 1.4 gigabytes, 11 minutes to open, crashing on one save in three, with absurd extents.
- Copy the file to a local work folder, and note the metrics: 1.4 GB, 11 minutes to open, one crash in three saves.
- Convert to DXF (the file opens, slowly, so a conversion with the standard tools is possible), and run the analyzer. The sections: ENTITIES a few megabytes, BLOCKS about 90 megabytes, TABLES about 60 megabytes (a huge regapp table), and OBJECTS about 1.2 gigabytes. The extents: entities from the project area out to coordinates around 1e+20.
- Open the original drawing and run
ZOOM EXTENTS: a tiny cloud of content at one end, and a vast emptiness. Select the stray points, delete (one point and two text objects at absurd coordinates). Extents now match the site. - Audit: 214 errors, mostly invalid references in dictionaries. Fix them.
- Purge: several passes: blocks, layers, line types, text styles, regapps (over 10,000 removed), zero-length geometry and orphaned data. The file falls to 800 megabytes. Reset the scale list: from 800 entries to a dozen. Down to 600 megabytes.
- Overkill: 23,000 duplicate objects removed. Down to 580 megabytes.
- Still large. The OBJECTS section is the culprit, mostly proxy graphics and extended dictionaries from imported files. Move to Rung 5:
WBLOCKthe entire drawing to a new file. The new file is 11 megabytes. - Check the new file: layers and styles preserved. Layouts: the three layouts were lost and recreated from the original by copying them over (with the plot setups). Coordinate system: the original had none, and a documented system from the project register was assigned, with a control point check. External references re-attached with relative paths.
- Verify: audit shows zero errors, purge finds nothing, and the file opens in 6 seconds, saves without crashes in repeated tests. Compared with the original by overlay: identical geometry (counts and a visual check of the content).
- Record and prevent: the cleanup steps documented in a one-page procedure. Feedback to the consultant, with the delivery specification clauses added. The archive report run on the project’s other 40 drawings found three more bloated files, now cleaned.
- Lesson: the gentle steps cut the file by 60 percent. The rebuild solved the rest. If I’d started with the rebuild, I’d have lost the layouts and learned nothing about the cause.
Eleven minutes to six seconds. The consultant’s next delivery arrived at 9 megabytes.
Common Mistakes
- Cleaning the only copy.
- Skipping the audit report, or ignoring errors.
- Purging once, not repeatedly.
- Purging items that the office standard needs.
- Using
WBLOCKon Civil 3D drawings without testing relationships and data shortcuts. - Cleaning Civil 3D drawings in a product that cannot read the objects.
- Ignoring stray objects and absurd extents.
- Binding external references casually.
- Copying and pasting between drawings from unknown sources.
- Not knowing where backups and autosaves are, until a crash.
- No routine cleaning before issue.
- No archive report, and learning about bloat from complaints.
- Blaming the software for what the habits caused.
Best Practices
- Always work on a copy, and measure before and after.
- Diagnose first: where is the size, and where are the stray objects?
- Climb the ladder: audit, recover, purge (repeatedly), overkill, content cleanup, rebuild.
- Test the rebuild for lost layouts, settings and relationships.
- Keep Civil 3D objects in Civil 3D, and rebuild from source data when needed.
- Know your backups: the
.bak, the autosave, the server snapshots, and test restoring. - Build a clean template and a pre-issue checklist.
- Report on the archive automatically.
- Set delivery requirements for consultants.
- Train the team in why files grow.
Final Thoughts
When I show people the before and after of a cleanup, the number they remember is always the size: 1.4 gigabytes to 11 megabytes. The number I remember is the extent of the stray object: twenty zeros, in a drawing of a building a few dozen meters across. It was a tiny thing, probably created by a misplaced click years earlier, and nobody had noticed because nobody had pressed ZOOM EXTENTS and looked at what came back. Most bloat is like that. It’s not malice or incompetence. It is accumulation, and the only cure is the small habit of looking.
So make it a habit. Zoom to extents on every drawing you receive. Read the audit report. Purge before you issue. Keep one clean template, and one honest checklist. And on the day when a drawing refuses to open, you’ll climb a ladder you already know, from RECOVER through WBLOCK, and find that most of the time, somewhere between the first rung and the last, the file comes back.
Where to go next: see why a bloated file slows the whole office in AutoCAD Map 3D and Civil 3D Slow or Crashing, and how drawings depend on each other in Civil 3D Data Shortcuts and Xref Problems.



