SVG Optimizer
Free online SVG optimizer tool, clean and compress code
About SVG Optimizer
Shrink SVG markup by stripping content that does not affect rendering: XML declarations, DOCTYPE, comments, metadata blocks, empty <g> and <text> elements, id/data-name attributes, empty style attributes, and redundant whitespace. Paste SVG source, optimize, then preview the result and copy it out. All processing is local.
How to Use
1. Paste your SVG markup into the SVG Input textarea. 2. Click Optimize. 3. Review the byte count and percentage saved, the optimized output, and a live preview rendered via dangerouslySetInnerHTML. 4. Click Copy to copy the optimized SVG to your clipboard.
What Gets Removed (and What Doesn't)
Removed: <?xml ...?>, DOCTYPE, <!-- comments -->, <metadata>...</metadata>, empty <g></g> and <text></text>, id="..." and data-name="..." attributes, empty style="", and all whitespace collapsed to single spaces (including between tags). NOT removed: inline styles with content, presentation attributes, gradients, filters, paths, or numeric precision - this optimizer does not perform path simplification, coordinate rounding, or SVGO-style plugin passes, so savings are typically smaller than dedicated tools.
▶Will optimization change how my SVG looks?
▶How much will the file shrink?
▶Does it round path coordinates or merge paths?
▶Is the live preview safe for untrusted SVG?
▶Why did my referenced gradient stop working?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee