A drawing arrives with 180 layers and perhaps twenty of them in use. Select a spare one, press delete, and nothing happens. Press it again, still nothing. Deleting a layer in AutoCAD turns out not to be a matter of pressing a button.
This article builds a drawing holding eight different kinds of layer on AutoCAD 2027, tries to delete each one, and records exactly which go and which stay. For the whole discipline of organising a drawing, the Institute runs an AutoCAD course for construction.
Three ways to delete, and they do different jobs
Before pressing anything it pays to know how these three differ, because picking the wrong one either deletes nothing or takes a piece of the drawing with it.
| Route | Deletes what | How safe |
|---|---|---|
The Delete Layer button in the layer palette | Only an empty layer | Safest; a layer holding objects is refused |
The PURGE command, aliased PU | Every layer nothing references, in one pass | Safe; it only removes what nobody points at |
The LAYDEL command | The objects and the layer | Dangerous; a piece of the drawing goes |
In other words, deleting a layer in AutoCAD is not one action but three, and they differ in whether geometry is lost. The first two never lose a line. The third does, and that is precisely what it is for.
A layer that will not delete: five reasons, measured
Rather than describe this in general terms, here is a drawing built with eight kinds of layer, each one then put to the test.
| Kind of layer | State | Result |
|---|---|---|
IIC-TRONG | empty, referenced by nothing | deleted |
IIC-KHOA | locked, holds no objects | deleted |
IIC-TAT | switched off, holds no objects | deleted |
0 | a system layer | refused |
Defpoints | created automatically by dimensions | refused |
IIC-TUONG | holds objects | refused |
IIC-HIEN-HANH | is the current layer | refused |
IIC-TRONG-BLOCK | used only inside a block definition | refused |
All five refusals come back with exactly one sentence, whatever the underlying reason.
Object is referenced by other object(s)
The first three rows are the interesting ones. A locked layer deletes. A layer that is switched off deletes. The two most common pieces of advice — unlock it first, turn it back on first — are both unnecessary. The only thing that decides the outcome is whether anything still references the layer.
Which raises the obvious question: if the message never varies, how do you tell the five cases apart? By elimination, and in a fixed order. Check whether the layer is current, because that is a one-click fix. Then check whether anything sits on it, by making it the only visible layer. What survives both checks is either a system layer or something hidden inside a block or an xref.
The five refusals, and what to do about each:
| Reason | What to do |
|---|---|
Layer 0 and Defpoints | Cannot be deleted and should not be; leave them |
| Objects still sit on the layer | Move them to another layer, or use LAYDEL |
| It is the current layer | Make a different layer current, then try again |
| Used only inside a block definition | Delete or edit that block definition first |
| It belongs to an external reference | Detach the xref and the layer goes with it |
The fourth row is the nastiest trap. The layer looks empty on the drawing and the palette says nothing, yet inside a block definition there is geometry sitting on it. Either explode a block to find out, or simply accept that it stays. Managing blocks is covered in our article on blocks in AutoCAD.
The purge command clears unused layers in one pass
When a hundred need clearing rather than one, the right command is PURGE, aliased PU. The command-line version is -PURGE, which is what to write into a script.
Measured on the drawing above, which at that point held 7 layers, two of them spare.
| Run | Layers before | Layers after | Removed |
|---|---|---|---|
| First | 7 | 5 | 2 layers |
| Second | 5 | 5 | 0 layers |
The second run removed nothing, exactly as it should: the command clears only what nothing references, and after the first run no such layer was left.
Worth noting is what it did not remove: the layer used only inside a block, despite that layer looking empty. That is evidence it examines real references rather than appearances. For clearing unused layers it is the safest route available, because it cannot lose geometry. Slimming a drawing down is covered in our article on lightening a CAD drawing.
The laydel command takes the objects too
This is the command for a layer that holds geometry you also want gone. Autodesk describes it on the LAYDEL page in one line: "Deletes all objects on a layer and purges the layer."
The prompts, copied verbatim from the 2027 release.
Command: LAYDEL
Select object on layer to delete or [Name]:
Selected layers: IIC-TUONG.
Select object on layer to delete or [Name/Undo]:
******** WARNING ********
You are about to delete layer "IIC-TUONG" from this drawing.
Do you wish to continue? [Yes No] <No>:
Two details there are worth remembering. First, the command prints an actual WARNING line and names the layer about to disappear. Second, the default is <No>, so pressing Enter to hurry through does nothing at all — a careful piece of design.
What was measured after answering Yes:
| Measured | Before | After |
|---|---|---|
| Objects in model space | 3 | 2 |
| Layers | 5 | 4 |
The line went, the layer went. Exactly Autodesk's one sentence, no more and no less. Reach for it only when you are certain that part of the drawing is not needed.
The order to work in
Put together, this sequence works on any drawing. Go from safe to dangerous, never the other way.
| Step | What to do | Why it sits here |
|---|---|---|
| 1 | Run PU, choose Layers, Purge All | Clears everything unreferenced, no risk |
| 2 | Make a different layer current | Removes the easiest refusal to fix |
| 3 | Run PU again | The old current layer can now go |
| 4 | Look at what is left, one at a time | Only now is inspection worth the effort |
| 5 | Use LAYDEL on what you are sure about | The only step that loses geometry |
Step three is the one people skip. A single PURGE is rarely enough, because clearing one layer can leave another with nothing pointing at it. Run it until it reports zero and the drawing is genuinely clean.
Layers that arrive from somewhere else
A drawing from another firm usually brings hundreds of unfamiliar layers. Two groups among them resist the ordinary route.
Layers belonging to an external reference. Their names carry a |, as in XREF-A|TUONG. They belong to the referenced file rather than this drawing, so deleting them directly does not work. Detach the xref and they go with it. Managing references is covered in our article on xrefs in AutoCAD.
Layers used inside blocks. As measured above, such a layer looks empty and is still refused. If the drawing carries blocks nobody uses any more, purge the blocks first and a second layer purge will clear a good many more.
One practical closing thought: do not try to clear every last one. Spare layers add almost nothing to the file size and change nothing about the plotted sheet. Tidying the list enough to read it is sufficient; leave the stubborn ones alone.
Four things often repeated that are not true
| Often repeated | What was measured on the 2027 release |
|---|---|
| A layer must be unlocked before it can be deleted | A locked but empty layer deleted normally |
| A layer must be switched on before it can be deleted | A switched-off but empty layer deleted normally |
| A layer that looks empty can certainly be deleted | One used only inside a block was refused |
One run of PURGE clears everything | The first run cleared 2; run it until it reports 0 |
Frequently asked questions
I press the delete button and the layer stays. Why?
Because Delete Layer only removes an empty layer. One holding objects, one that is current, and 0 and Defpoints are all refused.
How do I clear a hundred spare layers at once?
Type PU, choose Layers, then Purge All. Run it a few times until it reports that nothing more can be cleared.
The layer looks empty and still will not delete.
It is most likely used inside a block definition, or it belongs to an external reference. Neither shows any geometry on the drawing itself.
How do I remove the objects along with the layer?
Use LAYDEL. Remember it erases every object on that layer, and that the default answer to its final question is No.
I deleted the wrong layer — can I get it back?
Type U to undo immediately; LAYDEL undoes like any other command. Once the drawing has been saved and closed, only a backup file will help.
Why does Defpoints keep coming back?
Because the software recreates it the moment a dimension is placed. It holds the definition points of every dimension, which is also why it never plots.
Should I try to get rid of 0 and Defpoints?
No. Both are system layers, the software always refuses, and every drawing has them.