b2KIT

SVG Optimizer (SVGO)

Paste or upload SVG code and optimize it by removing metadata, comments, and unnecessary attributes.

Tested tool guide Tested browser tools Checked August 16, 2026

What SVG Optimizer (SVGO) does, with a checked example

SVG Optimizer (SVGO) is a browser-based tool that reduces the size of SVG files by removing metadata, comments, and unnecessary attributes while preserving the visual appearance of the graphic. It applies a series of optimization passes that are common in the SVGO ecosystem, such as cleaning up editor artifacts, merging paths, and compressing numeric precision. The most common surprise is that the optimized SVG may look slightly different due to removal of hidden elements or changes in path data, so always re-render the file after optimization, especially if it contains animations or external styles.

Worked example

A concrete input and expected output from the current implementation.

Input

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
  <!-- Created with Inkscape -->
  <rect x="10" y="10" width="80" height="80" fill="#ff0000"/>
</svg>

Expected output

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect x="10" y="10" width="80" height="80" fill="red"/></svg>

The tool removes the comment (since it's not needed for rendering) and shortens the hex color #ff0000 to the equivalent named color 'red', reducing byte count while keeping the same visual result.

How the result is produced

1

Optimization passes

The tool applies a configurable set of optimization rules, similar to SVGO's defaults. These include removing doctype, XML instructions, comments, and metadata; collapsing redundant groups; simplifying path commands; and reducing numeric precision. Each rule is designed to be safe, meaning it should not change the rendered output, though some rules can be disabled if they cause issues.

2

Input and output

You can either paste SVG code directly into a text area or upload an SVG file from your computer. The tool processes the input in the browser and returns the optimized SVG code as plain text that you can copy into a file or editor. The example at the top of this page goes from 189 bytes to 148 bytes, a reduction of about 22 percent.

Good uses

  • Reducing the file size of an SVG icon or illustration before embedding it in a web page or a mobile app.
  • Cleaning up SVGs exported from design tools like Adobe Illustrator or Inkscape, which often add verbose metadata and unused definitions.
  • Preparing an SVG for hand-editing by removing clutter and normalizing structure, making the code easier to read.

Limits and checks

  • Optimization may remove comments and metadata that are not required for rendering but could be needed for documentation or future editing.
  • Optimization may remove elements that are invisible or hidden (e.g., elements with display:none), including hidden elements that an animation would later reveal. If your SVG depends on such elements, verify the output by re-rendering it.
  • If your SVG uses custom scripts or external CSS, those are not evaluated here, so the optimizer might not handle them correctly; review the output carefully.

Common questions

Does the optimizer preserve animations and JavaScript?

It does not preserve every element: the optimizer can remove whole elements, such as empty groups, unused definitions, and hidden ones, and it may rewrite attributes that animations or scripts depend on. It does not validate that scripts still work after optimization, so you should test interactive SVGs in a browser after optimizing.

Can I control which optimizations are applied?

The rules are a configurable set, and the description notes that individual rules can be disabled when they cause problems, though the exact controls are not documented here. Start with the defaults and re-render the output to check the result.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools