Skip to content
SVG Encoder

SVG Minifier

Clean up SVG markup without rewriting your paths or text. Paste code, compare file sizes, then copy or download the result. Everything runs in your browser.

Nothing leaves your browser

Minified preview

Paste SVG or try the sample to preview it.

How to minify an SVG

  1. Paste your SVG markup, upload a .svg file, or try the checkmark sample.
  2. Review the minified code, preview, and original versus output sizes. Sizes use UTF-8 bytes, not character counts.
  3. Copy the output or download minified.svg. Compare it with the original before replacing a production asset.

Conservative cleanup, not a full optimizer

This tool removes XML comments and declarations and redundant spacing inside tags. It keeps whitespace between elements because SVG text and xml:space can depend on it. It does not simplify paths, round coordinates, remove metadata elements, or change IDs. Compression savings depend on your input, and an already compact SVG may not shrink.

Need a data URI instead of a file? Use the SVG encoder or generate CSS backgrounds and masks. For a React component, use SVG to JSX. Read about URL encoding versus Base64 before embedding larger assets.

Frequently asked questions

What does this SVG minifier remove?

It removes XML declarations and XML comments, tightens redundant spaces inside tags, and trims whitespace outside the document. Text, quoted attribute values, styles, scripts, and CDATA are preserved. Documents with a DOCTYPE are left unchanged except for outer whitespace.

Why does my SVG sometimes stay the same size?

An already compact SVG may have nothing safe to remove. This tool deliberately preserves text spacing, path precision, metadata elements, IDs, and accessibility attributes rather than making aggressive changes.

Does minification make SVG safe to upload to my website?

No. Minification is not sanitization. Scripts, external references, and event handlers are not removed. Only use SVG files from sources you trust, and sanitize untrusted uploads separately.

Are SVG files uploaded to a server?

No. Minification, size comparison, preview, and download run in your browser. Like the other SVG tools here, the input is saved in this browser so it can be reused between tools. Use Clear on a shared device.