Packages

svgo

4.1.0 · 24 Aug 2026MIT52.3M / weekRepositoryHomepagenpmAtom feed

Your version

3.0.3

8 Nov 2023Where it was published

3.3.5 is the newest release of 3.x.

In short

1 faster13 fixed5 changed3 internal

Security

4 advisories affect 3.0.3; 3.3.5 fixes them

Release note

Includes various bug fixes and optimizations for existing plugins.

We're also revamped the documentation for the project. You can find it on svgo.dev!
The frontend for svgo.dev is maintained in svg/svgo.dev, contributions are welcome.

What's Changed

Default Behavior

  • removeComments, introduces preservePatterns parameter. Preserves legal comments by default, same as the previous behavior, but can now be overridden.

  • removeDesc, set the removeAny parameter to false by default for accessibility.

Bug Fixes

  • removeRasterImages, removes inline JPEG images.

  • cleanupIds, correctly handle when 2 IDs have been referenced in a single attribute.

  • cleanupIds, correctly handle when we've encountered a reference to a node that doesn't exist.

  • inlineStyles, treat style prop keys as case-insensitive.

  • inlineStyles, remove all classes in multiclass selector.

  • inlineStyles, ignore empty CSS blocks instead of adding empty style attribute.

  • minifyStyles, removes unused class selectors when the document has no classes.

  • prefixIds, reuse the same prefix when encountering an ID multiple times.

  • removeHiddenElems, stops removing non-rendering elements like masks.

  • reusePaths, creates a new ID if the current one is referenced by another element.

  • reusePaths, removes redundant defs children after optimization.

  • reusePaths, stops duplicating attributes into the shared definition.

  • Don't crash on a null, undefined, or empty plugin. Instead, log a warning and ignore it.

SVG Optimization

  • convertTransform, omit spaces between functions.

  • removeScriptElement, removes callbacks (on*) and href attributes with javascript: URIs.

  • convertOneStopGradients, new plugin to convert gradients with one stop to a solid color, disabled by default.

Performance

  • Various optimizations for path handling.

Metrics

Before and after using vectors from various sources, with the default preset of each respective version:

SVGOriginalv3.0.2v3.0.3Delta
Arch Linux Logo8.584 KiB4.748 KiB4.747 KiB⬇️ 0.001 KiB
Blobs50.45 KiB42.949 KiB42.949 KiB
Isometric Madness869.034 KiB550.829 KiB550.699 KiB⬇️ 0.13 KiB
tldr-pages Banner2.071 KiB1.07 KiB1.07 KiB
Wikipedia Logo161.552 KiB118.441 KiB118.441 KiB

Before and after of the browser bundle of each respective version:

v3.0.2v3.0.3Delta
svgo.browser.js643.5 kB651.7 kB⬆️ 8.2 kB

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.