SVG Optimizer
Minify SVG files in your browser. Strips comments, useless whitespace, default attributes, and rounds long decimals. Files never leave your device.
🔒 Files never leave your browser — no upload, no server, no tracking.
Enter input above to see the result.
What is this for?
This tool runs a tiny set of hand-rolled regex passes over an SVG to shrink its byte size: it strips XML comments, collapses runs of whitespace between tags, drops a handful of attributes that already match their default values, and rounds long fractional coordinates to 2 decimal places. Each pass is a checkbox you can disable. Everything happens in your browser — no upload, no server.
When to use it
- Cleaning up an SVG icon exported by Figma, Illustrator, or Sketch before checking it into a repo.
- Trimming the <svg> payload before inlining it into HTML or CSS (where every byte ships with every page).
- Stripping the chatty XML comments that some design tools embed in their export ("Generator: Adobe Illustrator…").
- Quick sanity-pass before encoding an SVG as a data: URL.
Common gotchas
- Not as aggressive as SVGO. The real SVGO library can do path optimisation, viewBox cleanup, and dozens of other passes. This tool deliberately does only the safe, obvious passes — to keep it 0-dependency and 100% in-browser.
- Default-attr dropping is conservative. It only removes a short list of well-known defaults (
stroke="none",fill-rule="nonzero", etc.). If your SVG depends on those being explicit (e.g. for CSS-targeted styling), uncheck the option. - Coordinate rounding is lossy. Rounding to 2 dp is safe for icons and logos; for high-precision diagrams or charts, you may want to disable it.
- Whitespace collapse can break
<text>. SVG<text>elements that rely on multiple spaces will lose them. For icon SVGs (no text), this is never an issue.