Skip to content

SVG Minifier

Collapse an SVG onto one line and cut its file size, with a preview.

Runs in your browserNo account neededFree
Loading tool…

Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.

How to use the svg minifier

  1. Paste your SVG.
  2. Copy the minified output.
  3. Check the preview still looks right.

About this tool

Minifying removes what only a human needs: indentation, line breaks and comments. The result renders identically and is meaningfully smaller, which matters most for SVGs inlined directly in HTML, where every byte is served on every page load rather than cached as a separate file.

For SVGs served as files the gain is smaller than it looks, because gzip already compresses repeated whitespace very effectively. Minifying still helps, but the headline percentage before compression overstates the real-world saving.

Whitespace inside a <code>text</code> element is significant and is not collapsed, since that would change what is displayed.

This works on the markup as text rather than parsing it into a tree, so it performs only the changes that are safe without one. It will not merge paths, remove unused definitions or restructure groups the way a full optimiser such as SVGO does. A live preview is shown so you can confirm the result still renders.

Common uses

  • Inlining an icon in HTML.
  • Putting an SVG into a data URI.
  • Cutting page weight on inlined graphics.

Frequently asked questions

How much smaller will my SVG get?
It depends entirely on how it was exported. Design-tool output often halves; a hand-written icon may barely change.
Is minifying worth it if my server uses gzip?
Less than the raw percentage suggests, since gzip already handles repeated whitespace well. It still helps for inlined SVGs, which are not cached separately.
Does it change how the SVG renders?
No. Only whitespace and comments are removed, and the preview lets you confirm it.

Related tools