Why Exported SVGs Are Bloated, and What Minification Safely Strips

A logo that is four shapes and two colours has no business being 40 KB of markup. Yet that is what design tools routinely hand you, because an export is optimised for round-tripping back into the editor, not for shipping to a browser. Understanding where the extra bytes hide makes it obvious which ones the SVG Optimizer can safely remove and which ones you need to protect.

Where the bytes actually go

Open any editor export in a text editor and you will usually find the same five culprits.

What the optimizer does

The tool loads your file into an editable text pane, runs a set of conservative text transforms, and shows the before and after byte count side by side so you can see the effect immediately. Two options are exposed as checkboxes:

Whitespace is collapsed on every run, and the XML declaration and DOCTYPE are dropped, since neither is required for an SVG served to a browser or inlined in HTML. Because the whole thing runs on your machine, unreleased brand assets and client artwork never get uploaded to a third party just to save a few kilobytes.

Precision has a floor. Two decimal places is safe for the usual case, where the viewBox is measured in tens or hundreds of units. If your file uses a unit-scale viewBox such as 0 0 1 1, every coordinate is a fraction and rounding will visibly deform the shapes. Check the preview after rounding rather than assuming.

What you must not strip

Aggressive minifiers have a reputation for breaking icons, and it is almost always one of these:

Minify first, compress second

SVG is text, so your server will gzip or brotli it in transit. That changes how you should read the savings. Repetitive indentation compresses extremely well, so removing it looks dramatic in raw bytes and matters much less over the wire. Removing metadata and shortening coordinates is different: those bytes are high entropy, and cutting them reduces the compressed size too. If you are measuring the impact of an optimisation, compare compressed sizes, not raw ones.

One thing minification cannot fix is a raster image embedded inside the SVG as a Base64 data URI. If your 300 KB "vector" is mostly one giant <image> element, no amount of decimal rounding will help - the fix is to remove the bitmap or ship it separately, and the tradeoffs there are covered in the article on when data URI inlining helps or hurts.

A sensible workflow

Export from your design tool at the smallest sensible artboard, delete hidden layers before exporting rather than after, run the file through the optimizer, then paste the result straight into your component or icon sprite. Keep the original export in version control so you always have something to re-edit. If you also need a raster fallback for older email clients, the SVG to PNG converter handles that locally too, and if you are slicing a large exported graphic into pieces, see the guide to splitting images into tiles.

Optimize Vectors

Minify SVG
← All Articles