unstale

npm / svgo

svgo

What changed in svgo 1 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

51 breaking7 security17 new APIs and options5 performance8 behavior and defaults2 tooling25 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

svgo 457 changes

Breaking changes 20

  • Invalid XML numeric character references in text and attributes are now rejected; valid XML documents remain unaffected.

    4.1.0release notes

  • Plugin and preset types now enforce that a preset name starts with preset-.

    4.0.1release notes

  • The array of built-in plugins is available as a top-level export from svgo.

    4.0.0upgrade guiderelease notes

  • Color references other than ID references are now converted to lowercase by default; set convertCase to false to disable this.

    4.0.0release notes

  • The public API no longer has default exports; replace default imports with named exports or a namespace import.

    4.0.0upgrade guide

  • ESM and browser usage must use named imports; CommonJS continues to support default and named exports.

    4.0.0release notes

  • This function is not exported from the browser bundle.

    4.0.0release notes

  • Import from svgo; pass a third argument containing the relevant node tree when selectors depend on parent or sibling nodes.

    4.0.0upgrade guiderelease notes

  • Paths are no longer merged when attributes or styles depend on the node's bounding box.

    4.0.0release notes

  • Transforms are no longer moved when the group has a filter attribute.

    4.0.0release notes

  • SVGO now requires Node.js >=16.0.0.

    4.0.0upgrade guiderelease notes

  • Stringified path data now includes a space before numbers represented in scientific notation.

    4.0.0release notes

  • Import from svgo; pass a third argument containing the relevant node tree when selectors depend on parent or sibling nodes.

    4.0.0upgrade guiderelease notes

  • Queries on a child node use that node and its descendants as context by default; pass rootNode when results may depend on parent or sibling nodes.

    4.0.0release notes

  • The plugin name was replaced by removeScripts; update SVGO configuration that refers to the old name.

    4.0.0release notes

  • The removeScriptElement plugin is renamed to removeScripts, which also removes event handlers and script URIs.

    4.0.0upgrade guiderelease notes

  • removeTitle is no longer enabled by preset-default; configure it explicitly to continue using it.

    4.0.0upgrade guiderelease notes

  • Nodes are no longer removed when a child element has an ID.

    4.0.0release notes

  • removeViewBox is no longer enabled by preset-default; configure it explicitly to continue using it.

    4.0.0upgrade guiderelease notes

  • Use svgo/browser as the public import path for browser usage instead of importing the browser bundle from an internal dist path.

    4.0.0upgrade guiderelease notes

Security 5

  • Filters executable data URLs containing HTML, XHTML, or SVG documents and legacy vbscript URLs, while preserving inert data such as PNG images.

    4.1.0release notes

  • Sanitizes SVG foreignObject content by removing HTML event-handler attributes, srcdoc, and executable URLs from specified URL-bearing attributes.

    2.8.4, 3.3.5, 4.1.0release notessecurity advisory

  • Recognizes namespace-prefixed SVG a elements and removes ASCII tabs and newlines before checking URL schemes, preventing obfuscated script URLs from bypassing detection.

    2.8.4, 3.3.5, 4.1.0release notessecurity advisory

  • SVGO removeScripts plugin leaves some executable scripts intact

    2.8.3, 3.3.4, 4.0.2security advisory

  • SVGO DoS through entity expansion in DOCTYPE (Billion Laughs)

    2.8.1, 3.3.3, 4.0.1security advisory

New APIs and options 7

  • SVGO is now a dual package serving both CommonJS and ESM usage.

    4.0.0release notes

  • A parameter was added to convert colors to a common casing, either lowercase or uppercase.

    4.0.0release notes

  • This helper creates the node-to-parent Map needed as the third argument to selector helpers.

    4.0.0upgrade guiderelease notes

  • Plugins now have isPreset and plugins properties; presets identify themselves and expose their constituent plugins in invocation order.

    4.0.0release notes

  • Import from svgo; pass a third argument containing the relevant node tree when selectors depend on parent or sibling nodes.

    4.0.0upgrade guide

  • A new plugin removes deprecated SVG attributes and is disabled by default.

    4.0.0release notes

  • A runtime export lets applications retrieve the SVGO version.

    4.0.0release notes

Performance 4

Behavior and default changes 5

  • Plugin listings no longer include whether plugins are enabled or disabled by default; the argument appends each plugin's presets to the end of its line.

    4.0.1release notes

  • URI-encoded and non-URI-encoded IDs are now treated as the same.

    4.0.0release notes

  • Group collapsing now checks styles as well as attributes and moves attributes atomically.

    4.0.0release notes

  • Preset plugins expose their constituent plugins in the order they are invoked.

    4.0.0release notes

  • The plugin now removes Boxy SVG and Krita namespaces.

    4.0.0release notes

Tooling 1

  • Type declarations are generated from JSDoc, making them more accurate, documented, and synchronized with the implementation.

    4.0.0release notes

Fixes and other changes 15

  • Parser failures are consistently exposed as SvgoParserError errors with an Invalid character entity reason.

    4.1.0release notes

  • Improves parsing of negative or positive arc radii.

    4.0.2release notes

  • Skips case-normalization for CSS custom properties.

    4.0.2release notes

  • Improves handling of consecutive t commands.

    4.0.2release notes

  • Handles paths more safely.

    4.0.2release notes

  • Encodes a value as a data URI only once when converting to a data URI.

    4.0.2release notes

  • Logs a warning and does nothing when parameters are missing.

    4.0.2release notes

  • Removes JavaScript URIs case-insensitively and handles <script> elements in a namespace-aware way.

    3.3.4, 4.0.2release notesrelease notes

  • Prevents leftover <use> elements from referencing an empty container that was removed.

    4.0.1release notes

  • Preserves attributes referenced in CSS attribute selectors.

    4.0.1release notes

  • Fixes handling of a quadratic control point when an item is removed and preserves vertices for marker-only paths.

    4.0.0release notes

  • SVGO no longer crashes when the output argument ends with a trailing slash to a location that does not exist.

    4.0.0release notes

  • Fixes cases where IDs were not prefixed when a style tag contained XML comments.

    4.0.0release notes

  • Empty containers with filters applied via CSS are no longer removed.

    4.0.0release notes

  • Nodes are retained when child elements have referenced IDs, and path elements with zero opacity are treated as non-rendering.

    4.0.0release notes

svgo 323 changes

Breaking changes 17

  • cleanupIds no longer accepts the prefix parameter; use prefixIds after cleanupIds to add prefixes.

    3.0.0upgrade guiderelease notes

  • The cleanupIDs plugin was renamed to cleanupIds, so configurations using the old name must be amended.

    3.0.0upgrade guiderelease notes

  • createContentItem is removed; nodes are now plain objects, with parentNode needing to be defined to preserve builtin plugin behavior.

    3.0.0release notes

  • The helper utility was removed; disable plugins enabled by preset-default through its overrides parameter instead.

    3.0.0upgrade guiderelease notes

  • The JSAPI class is removed from nodes; nodes are now plain objects, with parentNode needing to be defined to preserve builtin plugin behavior.

    3.0.0release notes

  • SVGO now requires Node.js >=14.0.0.

    3.0.0upgrade guiderelease notes

  • Optimization errors are now thrown; parsing errors can be identified by the SvgoParserError name.

    3.0.0release notes

  • The optimization result no longer includes error or modernError; exceptions are thrown to the caller.

    3.0.0upgrade guiderelease notes

  • The optimization result no longer includes height; it can be obtained with a custom plugin.

    3.0.0release notes

  • The optimization result no longer includes info, so it no longer returns the SVG width and height.

    3.0.0upgrade guide

  • The optimization result no longer includes modernError; errors are thrown instead.

    3.0.0release notes

  • The optimization result no longer includes width; it can be obtained with a custom plugin.

    3.0.0release notes

  • The plugin.active flag is removed.

    3.0.0release notes

  • Default parameters are no longer provided through plugin.params; destructuring with defaults can be used instead.

    3.0.0release notes

  • Plugins in the plugins array no longer accept active; a plugin is enabled if it is named and disabled if it is not named.

    3.0.0upgrade guiderelease notes

  • The sortAttrs plugin is now enabled by default to improve gzip compression; it can be disabled through the SVGO config.

    3.0.0upgrade guiderelease notes

  • Only the visitor plugin API is supported; plugins using full, perItem, or perItemReverse must be migrated.

    3.0.0upgrade guiderelease notes

Security 1

  • Hardens handling of executable data: and vbscript: URLs, executable HTML in <foreignObject>, namespace-prefixed SVG anchors, and URL schemes containing ASCII tabs or newlines.

    3.3.5release notes

New APIs and options 1

  • Use prefixIds to add ID prefixes, placing it after cleanupIds or cleanupIds will remove the prefixes again.

    3.0.0upgrade guide

Tooling 1

  • SVGO now bundles TypeScript declarations, so users who depended on @types/svgo should uninstall it.

    3.0.0upgrade guiderelease notes

Fixes and other changes 3

svgo 214 changes

Breaking changes 10

  • The flag specifies a JavaScript config file, which may have any name; inline JSON config is no longer supported.

    2.0.0release notes

  • The CLI no longer accepts the --disable flag.

    2.0.0release notes

  • The CLI no longer accepts the --enable flag.

    2.0.0release notes

  • Node.js 10.13 or later is required to run SVGO 2.0.

    2.0.0release notes

  • Loading custom plugins by path in plugin configuration is no longer supported; import or require the plugin manually.

    2.0.0release notes

  • Plugin configuration now uses objects with a name and optional params instead of the previous name-as-key format.

    2.0.0release notes

  • The default behavior is to run only the plugins specified in the plugins list; use extendDefaultPlugins to extend the default list.

    2.0.0release notes

  • The CLI searches for svgo.config.js by default; YAML and JSON configuration files are no longer supported.

    2.0.0release notes

  • The SVGO class is replaced by the optimize function.

    2.0.0release notes

  • The Node API is synchronous, so optimization results can be used without promises or callbacks.

    2.0.0release notes

Security 1

  • Hardens removal of script elements by removing known SVG event attributes, rejecting executable data: and vbscript: URLs, sanitizing executable HTML inside foreignObject elements, and handling namespace-prefixed anchors and URL schemes containing ASCII tabs or newlines.

    2.8.4release notes

New APIs and options 2

  • A Node API function is available to resolve SVGO configuration using the same logic as the CLI.

    2.0.0release notes

  • An official browser-ready ES module bundle is available, supporting optimize, extendDefaultPlugins, and createContentItem.

    2.0.0release notes

Performance 1

svgo 121 changes

Breaking changes 4

  • cleanupNumericValues now rounds values in viewBox.

    1.0.0release notes

  • minifyStyles now removes styles based on usage, with controlling options.

    1.0.0release notes

  • SVGO now requires Node 4 or higher.

    1.0.0release notes

  • SVGO.optimize() now returns a Promise.

    1.0.0release notes

New APIs and options 7

  • The new except option keeps specified IDs.

    1.0.0release notes

  • The new force option lets cleanupIDs run even when an SVG contains style or script elements.

    1.0.0release notes

  • The JS API gains a datauri option.

    1.0.0release notes

  • A new plugin converts styles from a style element to attributes when possible.

    1.0.0release notes

  • A separator character in removeAttrs can now be changed with elemSeparator.

    1.0.0release notes

  • A new plugin removes script elements and is disabled by default.

    1.0.0release notes

  • The plugin gains a keepAriaAttrs option.

    1.0.0release notes

Behavior and default changes 3

  • The plugin can now add values to attributes.

    1.0.0release notes

  • SVG 2 href attributes are now supported.

    1.0.0release notes

  • The CLI treats filenames as input, allowing the svgo *.svg syntax.

    1.0.0release notes

Fixes and other changes 7

  • Fixed arcs transforming with different signed scale parameters.

    1.0.0release notes

  • cleanupIDs no longer removes IDs when an image consists only of defs.

    1.0.0release notes

  • Parsing now accounts for animation syntax.

    1.0.0release notes

  • The color #ff0000 now converts to red, in addition to #f00.

    1.0.0release notes

  • The colors list now includes the gray variation per CSS Color Module Level 4.

    1.0.0release notes

  • Fixed an error on empty files.

    1.0.0release notes

  • The plugin now checks for style or script elements per file.

    1.0.0release notes