SVG Optimizer & Minifier — Compress SVG Online
Clean bloated SVG code locally in your browser—strip editor metadata, empty groups, comments, and excess decimals while comparing file savings live.
How It Works
-
01
Paste or Upload SVG Code
Upload an .svg file, paste XML code into the left editor, or click Bloated Logo / Editor Metadata Icon to test immediately.
-
02
Toggle Compression Rules
Toggle metadata stripping, ID removal, responsive viewBox, decimal precision (0–3), and Minify or Pretty-Print formatting.
-
03
Compare & Export Compact SVG
Compare side-by-side Original vs. Optimized previews and download your lightweight .min.svg or copy markup.
Shrink Bloated SVG Markup Without Losing Visual Sharpness
Vector editors like Illustrator, Figma, Inkscape, and Sketch export generous metadata by default—XML preambles, HTML comments, proprietary namespace declarations, unused <defs>, empty grouping wrappers, generated IDs, and five-to-eight decimal places on every Bezier curve coordinate. While helpful inside design software, those leftover bytes bloat web pages, trigger cluttered diffs in Git repositories, and slow down icon sprite bundles. Our SVG Optimizer & Minifier strips dead baggage right inside your browser, comparing original and compressed SVGs side by side with exact byte savings.
Paste raw <svg> markup directly into the editor, upload any .svg file from disk, or test one of the three built-in samples (Bloated Logo, Editor Metadata Icon, or Detailed Badge) to see live compression ratios drop by 35% to 65% in milliseconds.
What Each Optimization Rule Cleans Up
Toggle individual passes on or off and watch both the rendered vector preview and code byte count update immediately:
- Strip XML Header & Comments: Removes leading
<?xml version="1.0"...?>prologues and human-readable<!-- Generator: ... -->notes that browsers ignore inside HTML documents. - Remove Editor Metadata & Namespaces: Deletes
<metadata>,<title>, and<desc>nodes alongside proprietaryxmlns:inkscape,xmlns:sodipodi,xmlns:rdf,inkscape:*, andsketch:*attributes. - Remove Empty
<g>& Unused<defs>: Recursively prunes hollow grouping tags and empty<defs></defs>containers left behind after layer deletion. - Strip IDs &
data-*Attributes: Drops redundant element IDs (id="layer_1") and editor tracking attributes (data-name) unless you rely on CSS selectors targeting specific IDs. - Path Coordinate Precision (
0 / 1 / 2 / 3decimals): Rounds noisy coordinates such as188.12345to concise188.12(at2decimals) or188.1(1decimal) acrossd,viewBox,points,cx,cy,r,width,height, andstroke-width. - Responsive
viewBox: EnsuresviewBoxis preserved, then strips fixedwidthandheightattributes so icons scale naturally to parent CSS boxes. - Minify vs. Pretty-Print: Collapse whitespace between tags into a compact single-line string for production embeds, or indent tags cleanly when debugging XML in code reviews.
Recommended SVG Optimization Profiles by Target
| Destination | Decimal Precision | Output Format | Notes |
|---|---|---|---|
| Web Icons & UI Sprites | 1 or 2 decimals |
Minify | Keep Responsive viewBox ON; strip IDs and metadata |
| Inline Hero Illustrations | 2 decimals |
Minify | Keep precision high enough for smooth diagonal curves |
| Code Review / Git Commit | 2 decimals |
Pretty-Print | Clean 2-space XML indentation without editor noise |
| Vinyl Plotter / CAD Handoff | 3 decimals |
Pretty-Print | Turn off Strip IDs if groups map to cut layers |
Because optimization parses XML natively using your browser's DOMParser and XMLSerializer APIs, proprietary client graphics never leave your computer. Once optimized, download the minified .min.svg file, copy clean markup, or copy a browser-ready Data URI.
Need to trace a PNG or JPG before shrinking it? Start on our Img to SVG Converter. Ready to recolor optimized layers or convert them into React JSX components? Open the SVG Viewer & JSX Editor, or export crisp bitmaps via SVG to PNG and explore our Vectorization Guide.
Frequently Asked Questions
Does the SVG optimizer upload my vector files to a server?
No. All XML parsing, metadata stripping, decimal rounding, and minification execute locally inside your browser tab. Your SVG files are never sent to a server.
Will rounding SVG coordinates to 1 or 2 decimals hurt visual quality?
In most web logos and illustrations under 2000 px, rounding path coordinates to 1 or 2 decimals cuts file weight dramatically with zero visible shift. Keep 3 decimals for tiny icons on fractional grids or micro CAD geometry.
Does it remove Inkscape, Sketch, and Illustrator metadata automatically?
Yes. Toggle Remove Editor Metadata & NS to strip <metadata>, Inkscape/Sodipodi/Sketch namespaces, XML preambles, and comments without altering visible shapes.
How do I make an SVG responsive for CSS sizing?
Switch on Responsive viewBox (Drop W/H). The optimizer guarantees a valid viewBox exists and removes fixed width and height attributes so CSS controls the display size cleanly.
When should I use Minify versus Pretty-Print?
Use Minify (Compact) to collapse whitespace for production HTML/CSS or inline SVG icons, and switch to Pretty-Print when you want clean indented XML for documentation or editing.
Is the SVG optimizer free without limits?
Yes, our SVG optimizer and compressor is completely free with unlimited optimizations, no file size lockouts, and no account required.