Compress SVG files

Shorten and clean up the code of an SVG so the file gets smaller while the drawing stays the same. SVGO does the work in your browser.

or drop an image hereYou can also paste with Ctrl+V or ⌘V. SVG files.

Fewer decimals give a smaller file. 2–3 is safe for most icons and logos; check fine curves after.

Your result will appear here. Nothing is uploaded: the file stays on your device.

How to compress an SVG

  1. Choose or drop an .svg file.
  2. Set Number precision. It starts at 3 decimals.
  3. Press Compress SVG. The size before and after appears under the preview.
  4. Check the preview for shifted curves or missing parts, use Show original to compare, then download. The new file name ends in -min.svg.

What each setting does

Number precision
How many decimal places are kept in coordinates and other numbers, from 1 to 5. Fewer decimals make a smaller file. 2 or 3 is safe for most icons and logos. If curves look slightly off, go up one step.

What SVGO changes

SVGO applies its default set of clean-up steps and repeats them until nothing more changes. The savings come from comments, editor metadata, hidden or empty elements, long colour values and numbers, and path data that can be written more briefly. The picture should look the same; only the code is rewritten.

Because the code is rewritten, IDs and the grouping of elements can change. If a web page styles or scripts the SVG from outside by its IDs, test it after compressing.

Files the tool will not open

An SVG is text and can carry code and links. To keep you safe, files with scripts, event handlers such as onclick, links to outside files or style sheets, or XML entity declarations are refused with a message that says why. Links to parts of the same file and embedded data are fine.

Limits

  • If optimising would not make the file smaller, you get your original back.
  • SVG files over 20 MB are not opened.
  • Raster images embedded inside the SVG are not recompressed.
  • Very low precision can bend fine curves or small text drawn as paths, so always check the preview.

Questions

Does compressing an SVG lower its quality?

At the default precision the shapes are kept; only the way they are written changes. At 1 or 2 decimals, very fine detail can move slightly.

Will the SVG still scale without blur?

Yes. It is still a vector file, so it stays sharp at any size.

Why was my SVG refused?

It contains a script, an event handler, a link to an outside file or style sheet, or an entity declaration. The message names the reason. Remove that part in an editor and try again.

What does -min in the file name mean?

It marks the optimised copy so you can tell it apart from your original.

Can I turn a PNG into an SVG here?

No, this page only optimises files that are already SVG. To trace a PNG into a vector, use PNG to SVG.