SVG Compressor
Paste SVG markup and shrink it instantly — comments, whitespace, and empty attributes stripped, validity checked, exact bytes saved. Copy or download the minified SVG. Free, private, no signup.
Paste SVG above to compress it.
How to compress an SVG file
SVG files are XML text, which makes them wonderfully compressible: vector editors routinely export files where a third of the bytes are indentation, comments, and metadata. Minifying removes the bytes that don't affect rendering.
- Paste your SVG markup above. Copy it straight from your editor or from the
.svgfile (open it in a text editor, not an image viewer). - Watch the stats. Before/after byte counts and the percentage saved update live as you type.
- Check the badge. The output is parsed as XML — green means it is still a valid SVG.
- Copy or download. The minified SVG renders identically to the original.
What gets removed
XML comments (<!-- ... -->), which editors use for notes and license blocks. Whitespace between tags — newlines and indentation separating elements. Empty attributes like id="" or class="", which carry no information. Everything else — path data, colors, transforms, and text content — is preserved character for character.
When compression matters most
Small icons and badges embedded directly in HTML pages benefit the most: the SVG travels with the page on every load, so every saved byte counts. For large illustrations, also consider enabling gzip or Brotli on your server — text compresses dramatically on top of minification.
- What does SVG compression do?
- SVG compression removes bytes that don't change how the image looks: XML comments, whitespace between tags, and empty attributes. The drawing itself — shapes, colors, positions — is untouched, so the image renders identically at a smaller size.
- Is minified SVG still editable?
- Yes, but it's harder to read — everything sits on one or two lines. Keep your original commented version as the master copy, and treat the minified file as the published copy you upload to your website.
- Why does my SVG export have so much bloat?
- Vector editors like Inkscape and Illustrator add editor metadata, long decimal numbers, comments, and their own XML namespaces so the file round-trips back into the editor. Browsers ignore almost all of it — this tool strips the comments, whitespace, and empty attributes safely.
- How is the file size measured?
- Sizes are counted in UTF-8 bytes — the real number of bytes sent over the network — not characters. The percentage saved is computed from those byte counts before rounding, so it's exact.
- What does the validity check do?
- After minifying, the tool parses the result as XML and confirms every tag is balanced and properly nested. If the check fails, the output is still shown for inspection, but the badge warns you instead of silently handing you a broken file.
- Does this change my image's appearance?
- No. Only comments, inter-tag whitespace, and empty attributes are removed. Shape data, colors, transforms, and text content are never touched, so the compressed SVG renders pixel-identical to the original.
More from the codex
SVG Compressor
Minify SVG markup, see the bytes saved.
Sitemap Generator
Build a valid sitemap.xml for your site.
Open tool → Liverobots.txt Generator
Build a valid robots.txt file with per-bot rules.
Open tool → LiveURL Encoder / Decoder
Encode/decode URLs and parse query strings.
Open tool → LiveHTML Entity Codec
Encode and decode HTML entities.
Open tool → LiveBase64 Encoder
Encode and decode Base64, URL-safe too.
Open tool → LiveRegex Tester
Test regular expressions live.
Open tool → LiveASCII Table
Every ASCII code, 0–127 — decimal, hex, and HTML entity. Click to copy.
Open tool → LiveWord Counter
Count words and estimate reading time instantly.
Open tool → LiveCase Converter
UPPER, lower, Title Case and more.
Open tool → LiveLorem Ipsum Generator
Placeholder text by paragraph or word.
Open tool → LiveColor Picker
Pick any color, copy its codes, build palettes, and check contrast for accessibility.
Open tool →Support the codex
This tool is free, with no account and no ads. If it saved you a trip to a search engine, consider supporting the indie dev behind it.
Questions about this tool?
Compressed file look wrong or have a suggestion? Email [email protected] — every message is read by the indie dev behind the codex.