SVG minifier

Paste SVG markup from Inkscape, Illustrator, Figma or Sketch and get a lighter copy. Each cleanup is an option, and the viewBox, ids, styles and text are left exactly as they are.

Saved: 364 bytes → 144 bytes (60% smaller).

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste the SVG code, or the sample, into the input box.
  2. Leave the safe options ticked. Lower the decimals if you want a smaller file and are happy to compare the result visually.
  3. Read the saved size under the result, then copy the output into your file or paste it inline in HTML.

How it works

The input is split into comments, tags, attributes and text by a small tokenizer, so the result is the same in every browser. Tags are rewritten with one space between attributes. For path data, the commands and numbers are read, the numbers are rounded, repeated command letters are merged, and the separators are cut to the minimum: M 12 2 L 2 22 H 22 Z becomes M12 2L2 22H22Z. Rounding is limited to size and position attributes and to d, points and transforms; opacity values and the viewBox are never rounded.

Example

A 24 by 24 icon exported from an editor with an XML declaration, a comment, a metadata block and a path with six-digit decimals can shrink a lot, because many of its bytes were never part of the picture. Rounding 21.987654 to three decimals gives 21.988.

Tips

  • View the minified SVG once before you replace the original.
  • If your SVG uses xml:space="preserve", whitespace between tags is kept as written.

Frequently asked questions

What does the SVG minifier remove?

Comments, the XML declaration and DOCTYPE, the metadata element, attributes and elements from editor namespaces such as Inkscape and Sodipodi, namespace declarations that nothing uses, whitespace between tags, and extra spaces in path data. With rounding on, it also shortens numbers in shape and path attributes.

Will it change how my image looks?

Only rounding can, and only slightly at 2 or 3 decimals. The viewBox, the size of the root svg element, ids, classes, styles, colors and text are never rewritten. With 0 decimals, small icons can visibly distort, so check the result.

Why are title and desc kept by default?

They give the image an accessible name and description, and browsers show the title as a tooltip. Tick the option to remove them only for purely decorative graphics.

Does it remove ids or merge paths?

No. Ids may be used by CSS, scripts or other SVGs, and merging shapes needs a full geometry engine. This tool does the safe, mechanical part of minification; for deep optimization use a dedicated optimizer.

Is my SVG uploaded?

No. The cleanup runs in your browser with a small built-in parser, so the code never leaves your device.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.