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.
How to use it
- Paste your SVG markup into the editor, or drop an .svg file (up to 2 MB)
- Review the options — comments, metadata and number rounding are on by default; removing width/height and pretty output are off
- Select Optimize SVG and read the original and optimized sizes and the saving in bytes and percent
- 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
By default it removes XML comments, metadata and editor-specific data from Inkscape, Sodipodi or Adobe, and whitespace between elements, and it rounds path and coordinate numbers to three decimals. It always removes script elements, on-event handlers and javascript: links. Everything else is left in place.
It can. Number rounding shifts coordinates by less than a rounded unit, and removing width and height changes how the file sizes when used without CSS. Structure, colours, gradients and filters are kept, but you should compare the before and after previews before using the result.
Yes, always. No option removes viewBox, because dropping it breaks how an SVG scales responsively. The optional remove width and height switch only takes effect when a viewBox is present to fall back on.
References to http, https or protocol-relative URLs in image, use, url() or CSS are detected and listed as a warning. The two previews are sandboxed and never load them. The optimized file keeps such references unless you edit them out yourself.
No. Parsing, optimization, the sandboxed previews and the download are all done in your browser with its built-in XML and sanitization tools. Nothing you paste or upload is sent to Tooliba or a third party, and analytics records only that the tool was used.