SVG Optimizer
Remove bloat from SVGs exported by Figma, Illustrator, and Inkscape — reduce file size without visual change.
Last updated: March 25, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is SVG Optimizer?
SVG files exported from design tools like Figma, Adobe Illustrator, or Inkscape include large amounts of metadata that is entirely useless in a web browser: editor-specific namespaces (xmlns:adobe, xmlns:sketch), editing metadata (sodipodi:, inkscape:), unused definitions and filters, empty groups, default attribute values that are redundant, and XML comments. A complex Figma icon export may be 8KB when the actual path data used for rendering is under 1KB.
SVG optimization removes all of this non-rendering bloat, keeping only the markup that the browser actually needs to draw the graphic. For websites serving dozens of SVG icons, optimized SVGs can reduce the combined transferable weight by 40–70%. Additionally, cleaner SVG markup is safer to embed inline in HTML (avoiding namespace pollution), easier to animate with CSS, and simpler to manipulate with JavaScript. This tool is a browser-based implementation of SVGO — the industry-standard SVG optimization tool used by webpack, Vite, and design-to-code pipelines.
How to Use SVG Optimizer
Paste your SVG code into the input area, or use the file upload button to load an .svg file
The optimization level is set to "Balanced" by default — suitable for most use cases
Toggle individual optimizations as needed: clean IDs, remove metadata, merge paths, round decimals
Click "Optimize" to run the optimization pipeline
Review the before/after code diff and the size reduction percentage, then click "Copy SVG" or "Download .svg"
Common Use Cases
- Stripping Figma export metadata from component icons before adding them to a React icon library
- Optimizing hero SVG illustrations exported from Illustrator to reduce initial page weight
- Cleaning up Inkscape-exported SVGs before embedding inline in HTML to avoid namespace pollution
- Reducing the size of an SVG sprite sheet containing hundreds of icons for a web application
- Preparing SVG animations for web use by removing the non-animatable metadata layers
- Cleaning font-embedded SVGs from design tools that artificially inflate file size
- Making an SVG safe for direct manipulation with JavaScript by removing editor-specific attributes
- Verifying how much your current SVG export workflow (Figma vs Illustrator) leaves behind
Example Input and Output
Optimizing a Figma-exported icon removes ~60% of the markup:
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:figma="http://www.figma.com/figma/1.0">
<!-- Generated by Figma -->
<title>Search Icon</title>
<desc>A magnifying glass icon</desc>
<metadata>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
</rdf:RDF>
</metadata>
<g id="search" transform="translate(0, 0)" fill="none" stroke="none">
<circle cx="11" cy="11" r="8" stroke="#333" stroke-width="2" fill="none"/>
<line x1="16.5" y1="16.5" x2="22" y2="22" stroke="#333" stroke-width="2"/>
</g>
</svg><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8" stroke="#333" stroke-width="2" fill="none"/>
<line x1="16.5" y1="16.5" x2="22" y2="22" stroke="#333" stroke-width="2"/>
</svg>Client-Side Processing
SVG optimization runs locally in your browser using a JavaScript port of SVGO. Your SVG source code — including any unreleased design work or proprietary icon assets — is never sent to our servers.
Inline SVG in React/HTML
When embedding SVGs inline in React JSX, also convert the SVG attributes to camelCase (stroke-width → strokeWidth, class → className). Use a tool like SVGR (npx @svgr/cli icon.svg) to automate this conversion for component libraries. This is separate from file size optimization.
CSS Animation Compatibility
If you plan to animate SVG elements with CSS (targeting paths, groups, circles by class or ID), run the optimizer in "Conservative" mode and explicitly preserve IDs and class names. Aggressive path merging can collapse separate animatable elements into a single path, breaking your animation targets.
Frequently Asked Questions
Will optimizing an SVG change how it looks?
Why are SVG files from Figma and Illustrator so large?
Is it safe to remove SVG IDs?
Can I use this on SVG icon sprites?
What is "decimal precision" and why does it matter?
What is the difference between SVG optimization and PNG conversion?
How This Tool Works
The SVG input string is parsed using a JavaScript XML parser into a DOM-like AST. A configurable pipeline of SVGO "plugins" then transforms the AST: each plugin is a pure function that traverses the node tree and applies a specific transformation (remove metadata nodes, collapse empty groups, remove default attribute values, round coordinate numbers to specified precision). After all plugins run, the AST is serialized back to a clean SVG string. The size reduction percentage is computed by comparing input.length to output.length.
Technical Stack