SVGO Config for Maximum Compression: 300 Icons Tested
The SVGO settings that shrink SVG icons most without breaking them, measured on 300 icons: precision, multipass, IDs, viewBox, plus three tested configs.
On this page
- The test
- How much SVGO saves depends on the source
- What each setting is worth
- Precision: the setting that breaks icons
- Three configs we tested
- Inlined gradient icons need unique IDs
- viewBox, width and height
- Settings that break things quietly
- Where SVGO fits in a faster site
- What this test does not cover
For most icon sets, the SVGO config that compresses hardest without visible damage is multipass: true, floatPrecision: 2 and preset-default. On our 300-icon test it cut 59.7% of the bytes with no icon flagged as changed, and the default preset alone had already done most of that work.
Everything else depends on how you ship the icons. Inline icons can drop more attributes, multicolor icons need unique IDs, and translucent strokes need mergePaths turned off. We measured each setting on SVGO 4.1.0 so you can see what it costs and what it breaks.
Quick answer
- Start with multipass, floatPrecision 2 and preset-default. Total bytes fell 59.7% and 0 of 300 icons were flagged.
- Precision saves the most after the default preset, and it is also what breaks icons. 0 decimals flagged 97 of 300.
- Multipass added only 0.4% on top of the default preset, not the 10 to 15% this page used to claim.
- Inlining many gradient icons on one page? Add prefixIds. The default preset alone drew 39 of 40 icons with the wrong colors.
- removeXMLNS and removeDimensions are for inline SVG only. removeXMLNS rendered 0 of 60 icons in an img tag.
The test
We ran 300 icons through SVGO 4.1.0, 60 each from five sources, then drew every result in Chrome 156 at 16, 24 and 48 px and compared it with the original.
- Lucide (
lucide-static1.69.0, 24 px grid) - Tabler (
@tabler/icons3.50.0, 24 px grid) - Phosphor (
@phosphor-icons/core2.1.1, 256 px grid) - Flat Color Icons (
flat-color-icons1.1.0, 48 px grid, multicolor) - Editor exports: Inkscape files with their metadata still in place, on 16 and 22 px grids
We flagged an icon as changed when a pixel moved by more than 96 of 255 levels on at least 5% of its painted pixels, at any size. That rule catches damage you can see. It ignores small anti-aliasing shifts, so "0 flagged" means no visible break, not identical pixels.
The gzip columns below are the sum of each file compressed alone, which is how separately served SVG files travel. Tested 2026-11-05 on Node 24.
How much SVGO saves depends on the source
The old rule of thumb, "SVGO saves over 50%", only held for the editor exports. Icons from a maintained pack are already clean, so the default preset has far less to remove.
| Feature | Raw bytes | Default preset | Saved |
|---|---|---|---|
| Editor exports | 237,471 | 51,652 | 78.2% |
| Flat Color Icons | 45,350 | 29,767 | 34.4% |
| Lucide | 29,429 | 22,642 | 23.1% |
| Tabler | 34,316 | 28,000 | 18.4% |
| Phosphor | 28,058 | 27,442 | 2.2% |
If your icons come from a tidy pack, expect 2 to 35%. If they come straight from a design tool or an AI generator, expect much more. Our AI SVG cleanup test covers that messier case. To try a single file without a config, paste it into the SVG optimizer.
What each setting is worth
This table shows each setting added to, or removed from, the default preset. The preset gives 159,503 bytes for all 300 icons, or 93,459 bytes with each file gzipped alone.
| Feature | Bytes vs default | Gzip vs default | Icons flagged |
|---|---|---|---|
| multipass | -0.4% | -0.2% | 0 |
| floatPrecision 2 | -4.7% | -3.7% | 0 |
| floatPrecision 1 | -12.2% | -9.3% | 1 |
| floatPrecision 0 | -26.3% | -19.1% | 97 |
| removeXMLNS | -6.6% | -8.3% | see below |
| removeDimensions | -2.4% | -1.8% | see below |
| removeTitle | -0.4% | -0.5% | see below |
| mergePaths force | -0.8% | -0.1% | 1 |
| mergePaths off | +3.7% | +0.3% | 0 |
| convertPathData off | +20.4% | +13.1% | 0 |
Three results stand out:
- Multipass is close to free, and close to worthless. It saved 0.4% overall and 0.2% on the messy editor set, far from the 10 to 15% we used to claim on this page. It costs little, so we keep it. Do not expect much from it.
convertPathDatadoes the heavy lifting. It is in the default preset, and turning it off added 20.4%. Leave it on.- Gzip takes back part of what minifying saves.
mergePaths forcesaves 0.8% of the bytes and 0.1% after gzip. Gzip already compresses repeated attributes, so check the gzip number before you accept a risky setting.
Precision: the setting that breaks icons
floatPrecision rounds path coordinates. It is the strongest setting here and the only one that broke many icons.

Precision is relative to the viewBox. Rounding to whole numbers moves a point by up to half a unit, which is a small move on a 256 unit grid and a large one on a 24 unit grid.
| Feature | Grid | 16 px | 24 px | 48 px |
|---|---|---|---|---|
| Phosphor | 256 | 0 | 0 | 0 |
| Flat Color Icons | 48 | 0 | 0 | 4 |
| Lucide | 24 | 8 | 20 | 28 |
| Tabler | 24 | 12 | 27 | 38 |
| Editor exports | 16 and 22 | 3 | 14 | 26 |
So a global rule would be wrong in both directions. Use 2 decimals on 24 px grids. A 256 px grid can go lower, and Phosphor took 0 decimals without a single flag in this test.
1 decimal saves 12.2% against 4.7% for 2 decimals, but check the output by eye. It flagged 1 icon of 300, and your set may have more fine detail than ours.
Three configs we tested
Save one of these as svgo.config.mjs and run svgo -rf src -o dist --config svgo.config.mjs. Each one flagged 0 of 300 icons. For the inline config, the pixel check put xmlns back, because our test drew icons through img tags.
| Feature | Bytes | Saved | Gzip, each file |
|---|---|---|---|
| Raw | 374,624 | n/a | 169,033 |
| Files | 151,099 | 59.7% | 89,816 |
| Inline | 137,685 | 63.2% | 80,514 |
| Multicolor | 166,359 | 55.6% | 93,765 |
Files: for SVGs served as img tags, CSS backgrounds or sprites. This is the safe default.
export default {
multipass: true,
floatPrecision: 2,
plugins: ['preset-default'],
};Inline: for SVG markup pasted into HTML or JSX, with size set by CSS or attributes in your component. It is 8.9% smaller than the files config. Do not serve its output as files.
export default {
multipass: true,
floatPrecision: 2,
plugins: [
'preset-default',
'removeDimensions',
'removeXMLNS',
{ name: 'prefixIds', params: { prefixClassNames: false } },
],
};Multicolor: for gradient icons, or icons you draw with translucent strokes. Precision stays at the default and path merging stays off.
export default {
multipass: true,
plugins: [
{ name: 'preset-default', params: { overrides: { mergePaths: false } } },
{ name: 'prefixIds', params: { prefixClassNames: false } },
],
};In a package with "type": "module", a svgo.config.js that uses module.exports failed with "ReferenceError: module is not defined in ES module scope". svgo.config.mjs with export default worked. Older guides mention .svgo.yml. SVGO 4.1.0 ignored that file in our test.
Inlined gradient icons need unique IDs
SVGO shortens IDs, so gradient IDs in different files all become a, b and so on. That is harmless for separate files. Once the icons sit in the same HTML document, every url(#a) points at the first a on the page.
We inlined 40 Fluent Color icons on one page and compared each with the same icon drawn alone.
| Feature | Wrong icons of 40 | Bytes |
|---|---|---|
| Raw files | 0 | 73,096 |
| Default preset | 39 | 69,523 |
| cleanupIds off | 0 | 72,993 |
| prefixIds with file path | 0 | 76,390 |
| prefixIds with no path | 39 | n/a |
| prefixIds with a prefix function | 0 | 71,196 |

Three traps showed up with prefixIds:
- It needs a path. With no
pathpassed tooptimize(), every icon got the sameprefix__a, and 39 of 40 stayed wrong. The CLI passes the path for you. In your own script, pass it yourself. - It uses the file's base name.
a/x.svgandb/x.svgboth producedx_svg__a, so same-named files in different folders still collide. Use aprefixfunction that builds on the full path if your set has those. - It renames classes by default.
class="lucide lucide-bell"becameclass="bell_svg__lucide bell_svg__lucide-bell", which breaks any CSS that targets.lucide. SetprefixClassNames: false, as in the configs above.
Avoid a counter or random prefix. The SVGO docs warn that unpredictable IDs can cause mismatches between server and client HTML in React and frameworks built on it.
This only matters for icons that have IDs. In our five-source test only 8 IDs in 2 editor files survived the default preset. The risk sits with gradient and multicolor packs like Fluent Color.
viewBox, width and height
SVGO 4 keeps the viewBox. SVGO 3's default preset removed it, and guides written for that version tell you to protect it. We drew 60 Lucide and 60 Tabler icons inline with a CSS size at 16 and 48 px, and all 120 came out different under v3's default output compared with v4's.
On v4, removeViewBox: false in overrides now only prints a warning: "You are trying to configure removeViewBox which is not part of preset-default." The migration guide lists removeViewBox and removeTitle as moved out of the preset. Delete that override when you upgrade, and do not add the plugin back. Its own docs warn that it stops SVGs from scaling.
removeDimensions changes layout. It removes width and height, and adds a viewBox if the file has none. Without a CSS size, the same Lucide icon stopped being 24 by 24:
| Where the icon sits (600 px wide container) | With dimensions | Without |
|---|---|---|
| Block | 24 x 24 | 600 x 600 |
img tag | 24 x 24 | 600 x 600 |
| Flex row beside text | 24 x 24 | 576 x 576 |
inline-flex button, no padding | 24 x 24 | 0 x 0 |
Use it only when your component or CSS always sets the size.
Settings that break things quietly
removeXMLNS breaks standalone files. It saved 6.6%, and inline rendering stayed identical on all 60 icons. In an img tag 0 of 60 rendered, and the same was true for CSS backgrounds. The plugin docs say the same. Use it only for icons you paste into HTML.
mergePaths changes translucent strokes. It joins paths, so lines that cross no longer double up where they overlap. With stroke-opacity: .5 on the SVG, the default preset changed 36 of 60 Lucide icons and 50 of 60 Tabler icons compared with raw. With mergePaths off, 0 Lucide icons changed. Our pixel rule did not catch this, because all those icons were drawn fully opaque in the main test. If you style strokes with opacity, turn it off.
removeTitle is not in the default preset anymore. It saves 0.4%. Titles can carry the accessible name for standalone icons, so read the accessible SVG guide before you remove them.
Where SVGO fits in a faster site
SVGO is one small part of icon performance. Lucide icons averaged 490 bytes raw and 369 after the files config, so saving about 120 bytes per icon only adds up if you ship many of them.
- Ship fewer icons first. Import single icons rather than a whole set. Removing an icon you do not use saves more than any setting here.
- Pick a delivery method. Inline, sprite or font changes your page weight more than a config does. We measured that in icon fonts vs sprites vs inline SVG.
- Check gzip the way you ship. If icons travel together in one bundle or sprite, attribute removal nearly disappears:
removeXMLNSsaved 8.3% per file but 0.7% across a set, andremoveDimensions1.8% against 0.2%. Precision goes the other way, because rounded numbers repeat more:floatPrecision: 2saved 3.7% per file and 8.0% across a set. - Delay icons below the fold if you have hundreds. See our guide to lazy loading SVGs.
If you are deciding whether SVG is right at all, SVG vs PNG compares the two formats.
What this test does not cover
- We rendered in Chrome only. Firefox and Safari were not tested, including for the inline ID results.
- 60 icons per source is a sample. A set with finer detail may flag at settings that passed here.
- The editor exports are Inkscape files from one icon theme. Exports from Illustrator, Figma or Sketch may behave differently.
- The flag rule looks for visible damage, not exact pixels. Check your own hero icons by eye after any precision change.
What is the best SVGO config for icons?
Does SVGO remove the viewBox?
Is multipass worth turning on?
What floatPrecision should I use?
Why do my icons show the wrong colors after SVGO?
Where does SVGO look for its config?
Related posts