SVG Optimizer

SVG files saved from Illustrator, Inkscape, Figma or Sketch carry comments, editor metadata, long decimals and unused ids that the browser never needs. Drop a file to strip them, round coordinates to the precision you choose, and see the size saved with a before-and-after preview. Scripts and event handlers are removed too, so the result is safer to put on a website.

Loading image tool...

Features

  • Removes the XML header, comments, <metadata> and editor data from Inkscape, Illustrator, Sketch and others

  • Rounds coordinates and numbers to 0 to 5 decimal places

  • Drops unused ids and empty or attribute-less groups; keeps ids that gradients and clips refer to

  • Removes <script>, onclick-style handlers and javascript: links (can be turned off)

  • Optional: drop width and height so the SVG scales to its container

  • Before and after preview, size saved, copy or download the result

When to optimise an SVG

Icons and logos for websites

Smaller SVGs load faster and are easier to inline in HTML or React.

Exports from design apps

Clean out the layers, names and metadata your design app adds.

SVGs from outside sources

Remove scripts and event handlers before using an SVG on your own site.

What the optimiser changes

Always safe

  • Comments, the <?xml ?> header and the DOCTYPE.
  • <metadata> blocks and editor namespaces (inkscape:, sodipodi:, sketch: and Illustrator's).
  • Whitespace between tags (spaces inside text are kept).

Worth checking

  • Rounding: 1 or 2 decimal places is invisible for icons drawn on a 24 to 1000 unit grid. For tiny viewBoxes (like 0 0 1 1) raise it to 3 or more. Compare the before and after previews.
  • Unused ids: removed unless something in the file refers to them. If your CSS or JavaScript targets an id from outside the file, keep a copy of the original.
  • Removing width and height makes the SVG fill its container; a viewBox is added first if missing.

Related tools

SVG Optimizer - FAQ