Skip to content
SVGtoReact

What Optimize keeps

Optimize is off by default on the React converter. When you turn it on, the file is sanitized, then SVGO runs preset-default with multipass: true, then the sanitizer runs again. The SVG optimizer page always uses that same preset. Neither place enables the currentColor plugin. Colors may still be shortened, which is a different edit.

What stays

On the preset this site runs, these parts of a normal icon stay:

What changes or goes away

The same preset removes or rewrites other things. These are the visible ones:

What Optimize does not replace

Optimize does not remove <script> by itself as its job. The sanitizer already removed scripts, event handlers, foreignObject, and unsafe URLs before SVGO runs, and it checks the SVGO output again. If that second sanitize fails, the optimizer reports the error and does not offer the raw input as the download. See What the sanitizer removes.

Optimize does not rewrite class to className. That happens later, when SVGR prints JSX or TSX. With Optimize left off, metadata and comments are still in the component, which is an easy way to see that the preset did not run.

Turning on currentColor at the same time is a separate plugin, documented in What currentColor changes. It can flatten a gradient and then let this preset delete the unused gradient. Leave currentColor off if the gradient is the artwork.