SVG Simplifier & Optimizer
How it works
Drop an SVG file onto the drop zone or paste the code, press Optimize, and you get the cleaned SVG plus a side-by-side preview of the original and the optimized version so you can confirm nothing changed visually. The stats row reports the raw byte count before and after, the percentage saved, and the gzipped size, which is the number that actually matters on the web, because every web server compresses SVG before sending it.
The engine is SVGO itself (v4), the same optimizer used by webpack, Vite, svgr and the CLI most design systems run in CI. It is a JavaScript library, and here it runs entirely inside your browser tab: nothing is uploaded and there is no queue. That means the result is byte-for-byte what `npx svgo` would produce locally with the same settings.
What the optimizer actually does: it parses your SVG into a DOM, walks every node, and applies about thirty independent plugins. The biggest wins come from removing editor metadata (Inkscape's <sodipodi:namedview> and <inkscape:*> attributes, Illustrator's generator comments and xmlns:a namespace, Figma's numeric IDs), collapsing useless groups, stripping default attribute values, merging multiple <path> elements, converting shapes like <rect> and <polygon> into equivalent paths, and rounding coordinate precision from 6 decimals down to 2–3. At default settings every optimization is lossless: the pixels stay identical, the file just gets smaller.
Typical reductions, measured on real icons and illustrations: • Adobe Illustrator export: 60–80% smaller (Illustrator is especially verbose) • Figma export: 40–70% smaller • Sketch export: 35–55% smaller • Hand-written SVG: 10–25% smaller (already lean)
Five settings you can actually change, each re-running the optimization live so you see the cost of every choice: • Numeric precision (0–6, default 3): decimals kept on coordinates. Dropping from 3 to 1 often saves another 10–20% on detailed paths, at the risk of visible distortion on large artwork. Watch the preview as you slide it. • Keep viewBox (on by default): leave it on if you scale the SVG with CSS or HTML, which is almost always. Turning it off saves ~25 bytes and breaks responsive sizing, so it is off-limits for icons. • Keep id attributes (off by default): turn on for SVG sprites, or when CSS/JS selects nodes by id. Dropping IDs is worth 5–15% on Figma exports, which generate one id per layer. • Keep <title> / <desc> (off by default): turn on when the graphic conveys meaning, since screen readers announce <title>. Decorative icons marked aria-hidden do not need it. • Multipass (on by default): repeats the whole pipeline until the output stops shrinking, usually worth a few extra percent for a few extra milliseconds.
Common reasons people clean an SVG: shrinking a hero illustration before inlining it in HTML, stripping author metadata from client deliverables, preparing icons for a sprite where every byte counts, removing Illustrator's auto-generated class names that collide with page CSS, or clearing the clutter so the file is readable for hand-editing. If you want the cleaned SVG as inline styles for an HTML email or a CMS field, pass the result through the SVG Inliner on this site. If path data is the only thing you are trying to shrink, the SVG Path Simplifier on this site is the same engine with a path-first precision default.
Frequently Asked Questions
How much can it reduce file size?
- Usually 40–80% on SVGs exported from Illustrator, 40–70% on Figma exports, 35–55% on Sketch, and 10–25% on hand-written SVG. The biggest wins come from Illustrator's metadata bloat, which the optimizer strips completely. You see the exact saving for your file in the result banner.
Will it change how my SVG looks?
- No. Every default optimization is lossless: the rendered pixels stay identical. The preview on the right shows the cleaned SVG rendered with the same dimensions; use it to visually verify before downloading. If you ever see a difference, it means an aggressive option (e.g. very low numeric precision) is over-simplifying a path, so raise the precision.
What is the difference between SVG optimization and SVG minification?
- Minification just strips whitespace and shortens attribute names. Optimization (what this tool does) also removes unused metadata, collapses paths, converts shapes to the smallest equivalent form, and rounds numeric precision. Optimization typically gives 3–5× bigger savings than minification alone.
Does it remove Illustrator / Inkscape / Figma metadata?
- Yes, by default. It strips the <sodipodi:namedview> element (Inkscape), <inkscape:*> attributes, Illustrator's xmlns:a namespace, Figma-generated numeric IDs, and the "Generator" / "Created with" comments. These are all invisible to the browser but can make up 30–50% of an unoptimized SVG.
Can I keep the viewBox or the IDs?
- Yes, both are toggles. viewBox is KEPT by default because removing it breaks CSS/HTML scaling. It only saves ~25 bytes, so turn it off only for a fixed-size SVG you never resize. IDs are DROPPED by default since they are usually Figma layer noise; turn 'Keep id attributes' on for SVG sprites or when your CSS/JavaScript selects nodes by id.
Is this the same as running SVGO from the command line?
- Yes. It is SVGO v4 itself, the same library the CLI, webpack, Vite and svgr use, running in your browser instead of Node. With matching settings the output is byte-for-byte identical to `npx svgo input.svg`. The difference is convenience: no install, no config file, and a live preview of what each setting costs you.
Why does the tool show a gzipped size?
- Because that is what actually travels to your users: every web server serves SVG with gzip or brotli compression. Raw byte savings can be misleading, because SVGO removes a lot of repetitive text that gzip was already compressing well, so a 70% raw reduction might be 45% after gzip. The gzipped figure is the honest measure of what you saved in load time.
What numeric precision should I use?
- 3 is the default and safe for essentially everything. Drop to 2 for icons and UI graphics, where it is usually invisible and worth another 10–15%. Drop to 1 or 0 only for small, simple shapes, and watch the side-by-side preview: at low precision, curves start visibly flattening. Large-canvas artwork (maps, detailed illustrations) may need 4 or more.
Can I recover the original SVG after optimizing?
- No. The optimization is destructive by design: removed metadata, collapsed nodes and rounded coordinates cannot be recovered. Keep the original in version control before optimizing.
Is my SVG uploaded anywhere?
- No. SVGO runs as JavaScript inside your browser tab. Your file is never uploaded to a server; you can confirm in the DevTools Network tab that no request fires when you optimize. This matters for logos and assets under NDA.
Can I optimize an SVG path specifically (svg path optimizer)?
- Yes. Path-level optimizations are the single biggest source of bytes in most icons. The optimizer's path-focused plugins (convertPathData, mergePaths, removeUselessStrokeAndFill) reduce numeric precision (6 decimals to 2-3), merge consecutive `<path>` elements that share styles, convert absolute commands (`M L`) to relative ones (`m l`) when they're shorter, and drop redundant subpaths. Typical path savings: 30–60% of total file size on icon SVGs.
Does it work for SVG sprites and icon sets?
- Yes, and it's especially useful for sprites because the savings compound across many icons. The optimizer can be run on individual icons before bundling, or on the assembled sprite file. For sprites, keep `cleanupIDs` disabled so your CSS / JavaScript selectors that reference per-icon IDs still work.
Is this an SVG simplifier, and does it reduce the number of points in a path?
- No. It does not remove nodes. A path that arrives with 4,000 anchor points leaves with 4,000 anchor points. What it does is make each of those points cost fewer bytes: coordinates are rounded to your chosen precision, absolute commands become relative, redundant `L` segments collapse into `H` and `V`, and consecutive paths sharing a style are merged. On a traced or auto-generated path that is typically a 50–70% byte reduction with pixel-identical output. If you genuinely need fewer nodes, because the path came from an image trace and is heavy to animate or edit, that is curve refitting (Ramer–Douglas–Peucker), and it is lossy by definition: the shape changes slightly. Use Inkscape's Path → Simplify (Ctrl+L), Illustrator's Object → Path → Simplify, or the `simplify-js` library. Run that first, then bring the result here for the lossless byte pass. The two steps are complementary, not alternatives.
How do I simplify an SVG path with this tool?
- Lower the precision slider. It is by far the biggest lever on path data. Design tools export coordinates at 6 decimal places (`M 12.847362 4.019283`), which is roughly a thousand times finer than any screen can resolve. Dropping to 2 decimals typically cuts path data by half on its own. As a rule of thumb: precision 3 is safe for anything (the default, visually lossless at any zoom), precision 2 is right for icons and logos rendered under ~200 px, and precision 1 works for small monochrome UI icons but can start to visibly shift curves. Turn on multipass so the pipeline re-runs until the output stops shrinking; on complex paths that finds another 3–8% the first pass misses. The side-by-side preview updates live, so lower the value until you can see a difference, then go back one step.
Is this SVGO online?
- Yes. It runs the real SVGO v4 inside your browser tab instead of in Node: the same library you would install with `npm i -D svgo`, the same plugin pipeline, the same `preset-default`, the same output for the same input. The only difference is where the code executes. There is no server, so nothing is uploaded and it works offline once the page is cached. If you already have an `svgo.config.js` in a project, the settings here map onto the plugins it configures.
How does this compare to SVGOMG?
- SVGOMG is Jake Archibald's tool and the reference implementation. If you know it and like it, keep using it. Both run SVGO in the browser and produce near-identical output, because both delegate to the same library. Where this one differs: it shows the gzipped size alongside the raw size, which is the number that actually travels over the wire and is often a very different story (a 40% raw saving can be 15% gzipped, because gzip was already collapsing the repetition SVGO removed). It also exposes precision as a single slider rather than a per-plugin list, which is faster when precision is the only knob you actually want to turn. SVGOMG exposes more individual plugin toggles and has a nicer drag-and-drop demo set. Neither uploads your file.
Can it repair a broken SVG?
- Only in a narrow sense. SVGO has to parse your file before it can do anything, which means the XML must be well-formed: an unclosed tag or a stray `&` will make it fail outright rather than fix it. It is an optimizer, not a recovery tool. What it does reliably clean up: editor cruft that breaks rendering elsewhere (Illustrator's `<foreignObject>` wrappers, Figma's empty groups and clip paths), duplicate or colliding IDs that break a page when two inlined SVGs share them, and missing-viewBox scaling problems. What it will not do: reconstruct malformed markup, recover a truncated file, or convert an embedded raster back into vectors. For genuinely broken XML, open the file in a text editor and fix the parse error first. The browser console will usually point at the exact line.
SVGO plugins: what they do and typical savings
SVGO ships with about 30 independent plugins, most of them bundled in `preset-default`. The five settings above map onto the plugins highlighted in the Notes column; the rest run automatically. "Lossless" plugins never change rendered pixels.
| Plugin | What it does | Typical savings | Notes |
|---|---|---|---|
| removeDoctype | Strips <!DOCTYPE> declaration | ~50 bytes | Lossless. Default on |
| removeXMLProcInst | Strips <?xml version=…?> | ~40 bytes | Lossless. Default on |
| removeComments | Strips <!-- author / license / generator → … --> comments | 20–500 bytes | Lossless. Default on. Disable to preserve license headers |
| removeMetadata | Strips <metadata> blocks | 0–200 bytes | Lossless. Default on |
| removeEditorsNSData | Strips Inkscape, Illustrator, Figma editor namespaces | 300 bytes – 30 KB | Lossless. Default on. Biggest single win on Illustrator exports |
| cleanupAttrs | Normalises whitespace and quotes in attributes | 1–5% | Lossless. Default on |
| mergeStyles | Consolidates multiple <style> blocks into one | 10–200 bytes | Lossless. Default on |
| inlineStyles | Promotes <style> rules to inline `style=` attributes when shorter | Variable | Lossless. Default on |
| removeUselessDefs | Removes <defs> entries no element references | 0–500 bytes | Lossless. Default on |
| cleanupNumericValues | Rounds numeric values to N decimals (default 3) | 5–30% | Lossless at default; lossy if precision set too low |
| convertPathData | Shortens path commands (absolute → relative, removes redundant subpaths) | 20–60% | Biggest path-level win. Default on. Lossless at default precision |
| mergePaths | Merges consecutive `<path>` elements that share styles | 5–20% | Lossless. Default on. Disable if you need per-path animations |
| convertShapeToPath | Converts <rect> <circle> <polygon> to equivalent <path> | Up to 30 bytes saved per shape | Lossless. Default on |
| removeHiddenElems | Removes elements with display:none or visibility:hidden | Variable | Lossless. Default on |
| cleanupIds | Removes / shortens unused `id=` attributes | 5–15% | Lossless. In preset-default. Turn off via 'Keep id attributes' for sprites or CSS-targeted SVGs |
| removeUselessStrokeAndFill | Removes redundant stroke / fill attributes that match defaults | 1–5% | Lossless. In preset-default |
| sortAttrs | Reorders attributes alphabetically (compresses better with gzip) | 1–3% post-gzip | Lossless. In preset-default |
| removeViewBox | Strips the viewBox attribute | 20–40 bytes | NOT in preset-default since v4. This tool applies it only when you untick 'Keep viewBox': breaks CSS scaling |
| removeTitle | Strips <title> elements | 0–200 bytes | NOT in preset-default since v3 (accessibility). Applied only when 'Keep <title>/<desc>' is unticked |
| removeDesc | Strips <desc> elements | 0–500 bytes | NOT in preset-default. Needs removeAny to strip hand-written descriptions, not just editor-generated ones |
| removeDimensions | Strips `width` / `height` so SVG inherits from viewBox | 30–50 bytes | Not in preset-default. Useful for fully responsive icons; not exposed here |
Plugin list and behaviour verified against SVGO v4 (github.com/svg/svgo), the version this tool runs. Note that removeViewBox, removeTitle and removeDesc are no longer part of preset-default: many older tutorials still list them as default-on. Savings are typical ranges measured across icons exported from Illustrator, Figma and Sketch; your results depend on the source file.