FormatterHQ

SVG Optimizer (SVGO)

Paste or upload an SVG and get a smaller, cleaner file: SVGO removes editor metadata and redundant markup, rounds coordinates and merges paths — with a live preview.

Input XML
Output XML
Ready.

How to use the SVG Optimizer (SVGO)

  1. Paste SVG markup into the input editor, upload an .svg file, or click Sample.
  2. Choose the Number precision and options such as Multipass or Remove width/height.
  3. Click Optimize (it also runs automatically); the status bar shows the byte savings.
  4. Switch to Preview to check the graphic, then copy or download the optimized SVG.

SVG optimizer: shrink files with SVGO

SVGs exported from Illustrator, Figma, Inkscape or Sketch contain much more than the shapes you drew: editor namespaces, metadata, comments, hidden layers, redundant groups and coordinates with six or more decimals. This SVG optimizer runs SVGO, the standard Node.js optimisation tool, directly in your browser to remove all of that. Savings of 30–70% are common for icons and illustrations.

Example

<!-- before, 380 bytes -->
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">
  <!-- Badge icon -->
  <circle cx="60.000" cy="60.000" r="54" fill="#0f766e" />
  <path d="M 36 62 L 52 78 L 84 42" … />
</svg>

<!-- after -->
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120"><circle cx="60" cy="60" r="54" fill="#0f766e"/><path … d="m36 62 16 16 32-36"/></svg>

What SVGO does

  • Removes comments, metadata, editor-specific attributes and empty elements.
  • Rounds numbers to the chosen precision and rewrites path data with relative and shorthand commands.
  • Collapses unnecessary groups, merges paths where it is safe and shortens colours (#ffffff → #fff).
  • Converts simple shapes to shorter equivalents and removes default attribute values.

Options explained

  • Number precision: 3 decimals is safe for most graphics; icons drawn on a 24-pixel grid often look identical with 1 or 2. Too low a value can distort small details — check the preview.
  • Multipass: repeats optimisation until nothing else changes, which can squeeze out a few more bytes.
  • Remove viewBox: off by default. Without a viewBox the SVG cannot scale responsively, so keep it unless you know you need fixed dimensions.
  • Remove width/height: makes the SVG fill its container, useful for inline icons sized with CSS.
  • Keep IDs: prevents renaming or removing IDs referenced by your CSS or JavaScript.
  • Pretty print: indents the output for readability instead of minifying it onto one line.

After optimising

Serve SVG files with gzip or Brotli compression for further savings. To embed the optimized icon in CSS, convert it with SVG to CSS data URI; for React projects, turn it into a component with SVG to JSX. You can inspect the result with the SVG viewer.

Safe versus aggressive settings

For logos and illustrations that will be edited again, use pretty print and keep IDs so the file stays readable and scriptable. For production icons, minify to one line, keep precision at 2–3 and enable multipass. Always keep a copy of the original export: optimisation is one-way, and editors like Illustrator may not be able to restore layers or text objects that SVGO flattened.

Where the savings come from

For exported icons, most bytes are editor metadata and verbose path data. A path like M 36 62 L 52 78 L 84 42 becomes m36 62 16 16 32-36 using relative coordinates and implicit commands. Colour values, default attributes and whitespace add further savings. The status bar reports the exact before and after sizes in bytes and the percentage saved, so you can compare the effect of different precision settings.

Privacy

The tool runs entirely in your browser. Nothing you type or paste is sent to our servers.

Frequently asked questions

Is SVG optimization lossless?
Structurally it can change the markup a lot, but the rendered image should look the same. Rounding coordinates to very few decimals can cause tiny shifts, so compare the preview.
Why did my SVG stop scaling after optimizing?
The viewBox was probably removed. Keep "Remove viewBox" unticked; the viewBox is what lets an SVG scale to any size.
My CSS animation broke after optimizing. Why?
SVGO may rename or remove IDs and classes it considers unused. Tick "Keep IDs" and avoid relying on removed groups.
Which SVGO version is used?
The browser build of SVGO 4 with its preset-default plugins, plus optional removeViewBox and removeDimensions.

Last updated October 3, 2026

Guides

Related tools

SVG Blob Generator Create random organic SVG blob shapes for backgrounds and illustrations. Adjust complexity and randomness, add a gradient and download the SVG. SVG to Base64 Convert SVG markup or an .svg file to a Base64 data URI for CSS backgrounds, img tags and JSON. SVG to CSS Data URI Encode SVG as an optimized URL-encoded data URI for CSS background-image or mask, with a Base64 version for comparison. SVG to JPG Converter Convert SVG graphics to JPG images with a chosen background colour, scale and quality — directly in your browser. SVG to JSX / React Component Turn SVG markup into a React component: camelCase attributes, className, style objects and {...props}, with optional TypeScript. SVG to PNG Converter Convert SVG to PNG at any size or scale (2×, 4×…) with a transparent or solid background. Paste code or upload an .svg file. SVG to React Native Convert SVG files into react-native-svg components (Svg, Path, G, Circle…) ready to paste into your React Native app. WEBP to JPG Converter Convert WEBP images to JPG online for free. Fast, private, in-browser conversion with preview and size comparison. WEBP to PNG Converter Convert WEBP images to PNG online for free. Fast, private, in-browser conversion with preview and size comparison. BMP to JPG Converter Convert BMP images to JPG online for free. Fast, private, in-browser conversion with preview and size comparison. BMP to PNG Converter Convert BMP images to PNG online for free. Fast, private, in-browser conversion with preview and size comparison. EXIF Remover (Strip Photo Metadata) Remove EXIF, GPS location, XMP and other metadata from photos before sharing. JPEG and PNG are cleaned losslessly, in your browser.