Compress repeated images and stencils
⚠️ Experimental. This setting is off by default. Turning it on changes how your
.drawiofiles are saved, and files saved this way can only be opened by draw.io 29.3.1 or later. Please read Before you turn this on below.
What it does
If your diagram uses the same embedded image or custom shape many times, draw.io normally stores a full copy of that image or shape inside every single cell that uses it. A diagram with one 30 KB embedded logo on 50 shapes ends up carrying that logo 50 times, and the file gets much larger than it needs to be.
Style compression stores each repeated image or shape once, in a shared list at the top of the file, and points every cell that uses it at that single copy. The picture on your canvas is exactly the same — only the size of the saved file changes.
It only touches data that is actually duplicated. An image or shape that appears just once is left as-is, and ordinary shapes, colours, fonts, and linked (URL) images are never affected.
The change is fully reversible: when draw.io opens the file again, it restores each shape to its full form before drawing. Saving, closing, and reopening produces an identical diagram.
Which versions can open these files
The ability to read this format was added in:
- draw.io web app — version 29.3.1, released 13 January 2026. (app.diagrams.net always runs the latest version, so it has supported this since then.)
- draw.io desktop app — version 29.3.6, released 30 January 2026. The desktop app doesn't ship every web release, so there is no 29.3.1 desktop build — 29.3.6 is the first desktop version that can open these files.
Any draw.io of these versions or later — web app, desktop app, embedded viewers, and self-hosted installations built from 29.3.1 or newer — opens these files normally. Anything older does not (see Before you turn this on).
When to use it
Turn it on if all of the following are true:
- Your diagrams embed images or custom stencils that are reused across many shapes (logos, icons, repeated custom symbols), and the files have grown uncomfortably large.
- Everyone and everything that opens these files runs draw.io 29.3.1 or newer — including teammates, any Confluence/Jira app, embedded viewers, and any automated tools.
If your diagrams don't reuse embedded images, this setting does nothing useful — leave it off.
Before you turn this on
Older versions of draw.io, and other programs that read .drawio files, will not understand files saved with this setting. When they open such a file, the affected shapes appear blank — with no image or symbol — and if that program then saves the file, the missing artwork is lost permanently.
This affects, among others:
- older self-hosted draw.io installations,
- older versions of the draw.io app for Confluence or Jira (these include their own build of draw.io — check its version),
- other software that reads or converts draw.io files.
Only enable this if you are confident every tool in your workflow is on draw.io 29.3.1 or later.
How to turn it on
This is a deployment setting, added to your draw.io configuration:
{
"compressStyles": true
}
It is also available in Extras ▸ Configuration, under Export & Files, as the Compress Styles switch (marked experimental). Set it back to the default to stop compressing — existing compressed files keep working and are expanded automatically the next time they're opened and saved.
What your saved file looks like
You don't need to read the file yourself, but if you're curious: the shared copies live in a <defs> block, and each shape references one by number.
Before — the same embedded image is stored in full on both shapes:
<mxCell ... style="image=data:image/png;base64,iVBORw0KGgo…(large)…;..."/>
<mxCell ... style="image=data:image/png;base64,iVBORw0KGgo…(large)…;..."/>
After — the image is stored once and each shape points to it:
<defs>
<def data="data:image/png;base64,iVBORw0KGgo…(large)…"/>
</defs>
...
<mxCell ... style="image=def(0);..."/>
<mxCell ... style="image=def(0);..."/>