SVG Optimizer

Smaller, and with the script taken out.

Smaller, and with the script taken out.

How to use it

  1. Paste the source. The contents of the file, not a link to it.
  2. Set the decimal places. Three is plenty for most artwork. Fewer means a smaller file.
  3. Copy or download. The size before and after is shown underneath.

When you would use this

SVG files from design tools carry a lot that does nothing: editor metadata, empty groups, comments, and coordinates written to fifteen decimal places when three would do. Removing it typically takes a third to a half off the file size with no visible change. Two things make this version different from the other optimizers online. It runs in your browser. Every other one receives a copy of your file, and SVGs are routinely a company logo, an unreleased icon set or a client's artwork. Pasting one into a website is a data transfer nobody agreed to. And it removes script. This is not the default behaviour of the underlying optimizer: a script element and an onclick attribute both survive the standard preset. An SVG is a document rather than an image and it can carry executable code, so an optimizer that leaves it in produces a file people will inline into a page believing it is safe. The result is shown as text rather than rendered, deliberately, because rendering an SVG that arrived from somewhere else is the exact thing this tool exists to make unnecessary.

Questions

Does this remove script from the file?
Yes, and that is deliberate rather than incidental. SVGO's default settings do not: a script element and an onclick attribute both survive it untouched. Anyone optimising a file from a client or a stock site reasonably expects the result to be safe to inline, so script removal is switched on here.
Is my file uploaded?
No. The optimizer runs in your browser, which is the reason to use this one. Every other online SVG optimizer receives a copy of the file, and SVGs regularly carry a company logo or an unreleased design.
What does removing width and height do?
It leaves the viewBox in place and takes out the fixed pixel dimensions, so the SVG fills whatever container you put it in. Useful for icons on a website, and the wrong choice if you need the file to open at a fixed size.