SVG Minifier

Free online SVG minifier. Compress SVG code by removing whitespace, quotes and unnecessary characters. Reduce SVG file size for production. Optimize first, then minify.

Input SVG
Minified Output

How to Use SVG Minifier

1

Paste SVG Code

Paste SVG markup into the input panel. For best results, optimize the SVG first (remove editor metadata), then minify it for production use.

2

Minify the SVG

Click "Minify" to collapse whitespace, remove unnecessary quotes, shorten color values, and compress the SVG to its smallest valid form.

3

Copy the Production SVG

The minified SVG appears as a single compact line. Use this in production — inlined in HTML, embedded in JavaScript, or saved as an .svg file. The visual output is identical to the original.

Example Pipeline

Original export (Illustrator): ~2,400 bytes — full metadata, comments, indentation
→ Optimized: ~800 bytes — metadata removed, structure cleaned
→ Minified: ~500 bytes — whitespace stripped, production-ready

A 2,400-byte icon becomes a 500-byte production asset — 79% reduction.

Frequently Asked Questions

What does SVG minification do?

SVG minification removes: all unnecessary whitespace (spaces, tabs, line breaks between tags), optional quotes around attribute values where the SVG spec allows them, leading zeros from decimal numbers (.5 instead of 0.5), and shortens hex color codes where possible (#fff instead of #ffffff). It also collapses redundant spaces within path data. The output is functionally identical — only formatting changes.

Should I optimize or minify first?

Optimize first, then minify. Optimization removes editor metadata, comments, and unnecessary attributes — reducing both file size and markup complexity. Minification then compresses the remaining markup by removing whitespace and shortening values. Run optimization once when you first export an SVG from a design tool. Run minification as the final step before deploying to production.

Is minified SVG still human-readable?

Barely. Minified SVG is a single line with no indentation or spacing, designed for machines (browsers, build tools), not humans. Keep the unminified version as your source of truth. Add the minified version to your production build output. Most build tools (Webpack, Vite, Parcel) handle SVG minification automatically via SVGO integration.

Will minification break inline styles or scripts?

Our minifier is conservative with content inside style and script tags — it preserves spaces that could affect CSS or JavaScript parsing. However, for SVGs with complex embedded scripts, always test the minified output. Aggressive minification that strips all whitespace from inline CSS can break selectors (e.g., ".class1 .class2" becoming ".class1.class2" which has a different meaning).

Related Articles