SVG Optimizer: Minify SVG with SVGO

Shrink SVG files by removing editor data and rewriting the markup more compactly. The engine is SVGO 4, loaded into the page. Add several files, optimize them in one pass, and download each copy.

Loading optimizer…

Runs in your browser: your files and text are not uploaded. Free, no account needed.

Last updated: · Reviewed by the QuickTooly Team

SVG Optimization Guide

What each preset runs

  • Safe: only removeDoctype, removeXMLProcInst, removeEditorsNSData and removeUnusedNS, plus whichever advanced options are ticked. Paths, numbers and structure are left alone.
  • Balanced (default): SVGO's preset-default, which rounds numbers, rewrites path data, converts shapes to paths, merges paths, collapses groups and minifies styles. Numbers keep 3 decimal places. IDs are kept unless you tick Clean up IDs.
  • Aggressive: everything in Balanced, with numbers rounded to 2 decimal places instead of 3, plus convertOneStopGradients, which replaces single-colour gradients with a plain colour, and removeXlink, which rewrites xlink:href as plain href. Very old SVG viewers may not understand the latter.

What the advanced options really do

  • Remove comments, Remove metadata: on by default in every preset. Untick them to keep licence comments or metadata. Comments starting with <!--! are always kept.
  • Remove <title>: off by default. Ticked, it removes the title in every preset.
  • Remove <desc>: unticked keeps every description. Ticked removes all of them, including real written descriptions.
  • Clean up IDs: off by default and applies in every preset when ticked. It shortens or removes IDs, which breaks CSS, JavaScript or <use> references that point at the file from outside.
  • Remove viewBox: off by default. Ticked, it removes the viewBox when it matches the width and height attributes, in every preset. Leave it off for an SVG that should scale with its container, because without a viewBox it stops scaling.

If an inline SVG icon needs an accessible name, keep its <title>. Screen readers can announce it.

Reading the result

The savings figure is 1 − optimized length ÷ original length, counted in text characters. A file already minified by a build tool can show 0%. Balanced and Aggressive round coordinates, Aggressive more so, so compare the preview of detailed artwork that will be shown very large.

Changing any option resets finished files to pending, so the next run uses the new settings. Files can be up to 10 MB and are processed one after another. A file SVGO cannot parse, such as broken XML, is marked as an error with the parser's message. Download All saves each file separately with an -optimized.svg suffix.

Frequently Asked Questions

Why is the viewBox still there after ticking Remove viewBox?

SVGO only removes a viewBox that matches the width and height attributes, because otherwise the drawing would change. A viewBox with a different origin or size is kept.

Should I remove the title?

Only if the SVG is decorative. Screen readers can announce the title as the image's accessible name, so keep it on icons that carry meaning.

My sprite icons stopped showing after optimizing. Why?

Clean up IDs was probably ticked. It renames or removes IDs, so references from your HTML or CSS no longer match. Untick it and optimize again.

Related image tools