SVG Optimizer & Minifier
Remove editor metadata, compress numbers, and shrink SVG files — all in your browser, nothing sent to any server
Optimized SVG will appear here.
Optimization Options
Your designer exported an SVG icon from Illustrator — it’s 45KB with Illustrator metadata, comments, unused gradient definitions, editor-specific namespaces, and coordinates with 8 decimal places. The same icon optimized is 3KB. You need to strip the bloat without breaking the visual output.
Why This Optimizer (Not SVGO CLI)
SVGO is the standard SVG optimizer but requires Node.js and CLI setup. This tool runs SVGO-equivalent optimizations in your browser — removes metadata, comments, unused IDs, editor data, compresses numbers, and shows a before/after preview with file size comparison. Drag-and-drop your SVG, verify the preview, download the optimized version. No CLI, no installation.
What Is an SVG Optimizer?
An SVG optimizer (also called an SVG minifier or SVG compressor) reduces the file size of SVG images by removing data that does not contribute to the visual output. When you export an SVG from a design tool like Inkscape, Adobe Illustrator, Figma, or Sketch, the file often contains:
- Editor-specific metadata: Inkscape version numbers, document units, layer names, and grid settings embedded in
<sodipodi:namedview>or<inkscape:*>elements - Comments: Human-readable notes left by the design tool (
<!-- Created with Inkscape -->) - Unused IDs:
id="layer1"orid="rect12345"attributes that no other element references - Redundant default values: Attributes like
fill-opacity="1"oropacity="1"that are already the default and can be safely removed - Verbose numbers: Coordinates like
cx="50.00000"whencx="50"is equivalent - RDF/Dublin Core metadata: Licensing and authorship information inside
<metadata>that browsers ignore
This tool applies a sequence of safe, reversible optimizations to remove all of the above, producing a smaller, cleaner SVG file that renders identically in every browser.
How Much Can SVG Optimization Save?
The savings depend on the source tool and how the SVG was created:
| Source | Typical Savings |
|---|---|
| Inkscape export | 30–60% |
| Adobe Illustrator | 20–50% |
| Figma SVG export | 10–30% |
| Hand-written SVG | 5–15% |
| Already optimized | < 5% |
Inkscape and Illustrator add the most metadata, so their exports benefit most from optimization. Figma’s SVG export is already fairly clean compared to desktop tools.
Optimization Options
Remove Comments
Strips all <!-- ... --> comment nodes from the SVG. Design tools often insert comments identifying the tool name, version, and creation date. These add bytes but have no visual effect.
Remove Metadata
Removes editor-specific elements that are invisible in browsers:
<metadata>— RDF/Dublin Core licensing and authorship information<sodipodi:namedview>— Inkscape canvas settings (zoom level, grid, document units)
These elements are meaningless outside the design tool that created them.
Remove Editor Data
Strips attributes and namespace declarations added by specific design tools:
xmlns:inkscape,xmlns:sodipodi,xmlns:sketch,xmlns:dc,xmlns:cc,xmlns:rdf— Namespace declarations for editor-only datainkscape:*— Inkscape-specific attributes (version, connector curvature, etc.)sodipodi:*— Sodipodi attributes embedded by Inkscapesketch:*— Sketch app attributes
Removing these namespaces and attributes eliminates significant bloat without changing the visual output.
Remove Empty Attributes
Removes attributes whose value is an empty string, such as class="" or style="". These are often left behind when styles are cleared in a design tool.
Remove Default Attributes
Removes attributes whose value matches the SVG specification’s default value. For example:
fill-opacity="1"— default is 1stroke-opacity="1"— default is 1opacity="1"— default is 1stroke-linecap="butt"— default is buttdisplay="inline"— default is inline
The rendered output is identical because the browser already applies these defaults.
Remove Unused IDs
Removes id attributes that are not referenced anywhere else in the document. An ID is considered “used” if another element references it via:
href="#id"orxlink:href="#id"— for<use>,<image>, and similar elementsurl(#id)— forfill="url(#gradient)",filter="url(#blur)", clip-path, and masks
IDs used only for CSS or JavaScript targeting in the browser are preserved (this tool cannot determine runtime DOM usage).
Compress Numbers
Shortens numeric values in coordinates, path data, and transform attributes:
- Remove leading zeros:
0.5→.5,-0.5→-.5 - Remove trailing zeros:
1.500→1.5,2.0→2 - Remove unnecessary decimal point:
3.→3
This is a lossless optimization for integer values and a near-lossless optimization for floats (controlled by the precision slider).
Float Precision
Controls how many decimal places to keep for floating-point numbers. Lower values produce smaller files but may introduce rounding differences in complex path data:
- 8 (maximum): No meaningful rounding, safest for complex illustrations
- 3 (default): Good balance for most icons and illustrations
- 1 (aggressive): Best for simple geometric shapes where sub-pixel accuracy is irrelevant
How to Use the SVG Optimizer
- Paste SVG code into the input area, or click Upload SVG to load a file from your computer
- The optimizer runs automatically and shows the optimized output on the right
- Toggle individual optimization options to include or exclude specific transformations
- Switch to the Preview tab to verify the SVG still renders correctly
- Click Copy to copy the optimized SVG to your clipboard, or Download to save it as a file
The optimization runs entirely in your browser — your SVG never leaves your device.
SVG File Size and Web Performance
SVG file size directly affects page load performance. For SVGs used as UI icons, logos, and illustrations:
- Inline SVG (embedded in HTML): Smaller SVGs reduce HTML document size, improving initial parse time
- External SVG (via
<img src>or CSSbackground-image): Smaller files reduce network transfer time and improve LCP (Largest Contentful Paint) - Cached SVGs: Even cached files must be parsed by the browser — a smaller, simpler SVG DOM parses faster
For pages with many SVG icons (navigation bars, feature lists, dashboards), the cumulative savings from optimization can meaningfully improve Core Web Vitals scores.
SVG vs Rasterized Images
| Property | SVG | PNG / WebP / AVIF |
|---|---|---|
| Scalability | Vector — crisp at any size | Raster — pixelates when scaled up |
| File size (simple graphics) | Usually smaller | Usually larger |
| File size (complex illustrations) | Can be large | Often smaller |
| Browser rendering | CPU/GPU path rasterization | Texture decode |
| Animatable | Yes (CSS or SMIL) | No (use GIF/video) |
| Filterable | Yes (SVG filters) | Limited |
| Accessibility | Can embed text, titles, descriptions | Alt text only |
For logos, icons, illustrations, and diagrams with flat colors and geometric shapes, SVG is almost always the right format. For photographs and complex illustrations with gradients and textures, raster formats (WebP, AVIF) produce smaller files.
Common SVG Optimization Mistakes
Removing <defs> contents: The <defs> element contains reusable definitions (gradients, patterns, filters, clip-paths, symbols). Removing it or its children will break any element that references those definitions via url(#...) or <use>.
Over-aggressive number rounding: Setting precision too low (1 or 2) on complex path data can produce visible rounding artifacts in curves and Bézier paths. Use precision 3 or higher for illustrations.
Removing IDs used by CSS or JavaScript: If your SVG is embedded in HTML and styled by external CSS (#my-icon path { fill: red; }), removing id="my-icon" breaks the CSS rule. This tool only removes IDs that are not referenced within the SVG itself.
Stripping CDATA sections: CDATA sections (<![CDATA[...]]>) contain raw character data (often embedded script or style). This tool preserves them unchanged.
Frequently Asked Questions
Is my SVG data sent to a server? No. All optimization runs entirely in your browser using JavaScript. Your SVG code is never transmitted to any server and never leaves your device.
Can I undo the optimization? The optimization is irreversible. Always keep a copy of the original SVG before optimizing. This tool does not modify your original file — it produces a separate optimized version for you to download.
Why does the preview look different after optimization?
Rarely, aggressive optimization can change the visual output. If this happens, try turning off Remove Default Attributes or increasing the Float Precision. The most common cause is removing an id that was referenced by url(#id) — if you see this, disable Remove Unused IDs.
Why is my savings percentage low? If the SVG was created by hand or already optimized, there is little redundant data to remove. Savings are highest for SVGs exported from desktop design tools like Inkscape and Illustrator, which add extensive metadata.
Does this support all SVG features?
Yes. The optimizer preserves all SVG 1.1 and SVG 2.0 features including paths, shapes, gradients, patterns, filters, clip-paths, masks, animations, <use> elements, <symbol> elements, and text. It only removes data that is explicitly identified as redundant.
What is SVGO? SVGO is a popular Node.js-based SVG optimizer. This tool implements a subset of SVGO’s optimizations that are safe to run in the browser without a Node.js runtime. For CI/CD pipelines and build tool integration, SVGO is the standard choice.