Skip to main content

SVG Optimizer

SVG Optimizer trims a scalable-vector graphic's code in your browser: paste the markup or drop an .svg file, choose a few clear options, and select Optimize SVG.

Or drop an .svg file here (max 2 MB)

Up to 2 MB. The file is read into the editor and processed in your browser.

Optimization options

Small rounding can shift sub-pixel details; compare the previews.

Off by default: without width/height an SVG used as an <img> may render at a different size unless CSS sets one.

Your file stays on your device

How to use it

  1. Paste your SVG markup into the editor, or drop an .svg file (up to 2 MB)
  2. Review the options — comments, metadata and number rounding are on by default; removing width/height and pretty output are off
  3. Select Optimize SVG and read the original and optimized sizes and the saving in bytes and percent
  4. Compare the before and after previews, then copy the optimized markup or download the .svg file

It parses the file with the browser's own XML parser and, by default, removes comments, editor metadata such as Inkscape, Sodipodi and Adobe data, and whitespace between elements, and rounds path and coordinate numbers to three decimals; optional switches strip width and height while keeping viewBox, or pretty-print the result. viewBox is never removed, and script elements, on-event handlers and javascript: links are always dropped. It shows the original and optimized byte sizes and the saving in bytes and percent, and reports it honestly, including when the output is not smaller. Two sandboxed previews render the before and after through an image tag so you can compare them; external images and links are listed as a warning and are never loaded by the preview. Copy the optimized markup or download it as original-name-optimized.svg. It is not an XML formatter, an image converter or an image resizer: it rewrites SVG code to be smaller while you check the result visually. Optimization can produce a valid SVG that looks slightly different, so compare the previews before you ship. Everything runs on your device; nothing you paste or upload is sent anywhere.

FAQ

We use cookies to run this site and, with your consent, to understand usage and personalize ads. You can change your choice at any time.