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.

Ready
Original SVG—
Optimized SVG—
Input SVG Markup0 chars
Optimized Output0 chars

How It Works

  1. 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.

  2. 02

    Toggle Compression Rules

    Toggle metadata stripping, ID removal, responsive viewBox, decimal precision (0–3), and Minify or Pretty-Print formatting.

  3. 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 proprietary xmlns:inkscape, xmlns:sodipodi, xmlns:rdf, inkscape:*, and sketch:* 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 / 3 decimals): Rounds noisy coordinates such as 188.12345 to concise 188.12 (at 2 decimals) or 188.1 (1 decimal) across d, viewBox, points, cx, cy, r, width, height, and stroke-width.
  • Responsive viewBox: Ensures viewBox is preserved, then strips fixed width and height attributes 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.