Logo

MonoCalc

/

SVG Optimizer

Media

Drop .svg or .svgz files here (several at once for a batch), or paste markup below. Up to 10.00 MB per file. Everything runs in your browser; nothing is uploaded.

Preset

Exactly SVGO 4.1's preset-default, so results match the SVGO command line.

Precision

3 decimals

Coordinates move by up to ±0.0005 units.

Keep

Comma-separated; these IDs are never renamed or removed.
IDs starting with these are kept as they are.

Input

Optimized

About This Tool

SVG Optimizer – smaller SVG files you can trust

Design tools write SVG for themselves, not for the web. A two-shape icon exported from Inkscape, Illustrator, Sketch or Figma often carries more bookkeeping than drawing. This SVG optimizer runs SVGO 4.1, the standard SVG minifier, in your browser. It then checks the result instead of asking you to trust it: both files are rendered and compared pixel by pixel, a waterfall chart shows which optimization saved which bytes, and guards catch the ways an optimizer can quietly break links, accessibility or CSS hooks.

Why editor exports are bloated

Most of an exported file is not artwork. Common sources of SVG bloat are:

  • Editor namespaces such as inkscape:, sodipodi: and Illustrator's i: attributes, which store layers, zoom level and guides. They are often the largest single saving.
  • Metadata and comments: RDF licence blocks, "Created with" comments and XML declarations.
  • Over-precise numbers like 32.0000001 or stroke-width:1.00000000, where the trailing digits change nothing on screen.
  • Redundant structure: wrapper groups with no attributes, empty <defs>, and styles repeated on every element.

How path data gets shorter

The d attribute of a <path> is usually the bulk of real artwork, and SVGO rewrites it in its shortest form. Absolute commands become relative ones when that saves characters, so L 52 22 after a point at 12,22 becomes h40. Repeated command letters are dropped (implicit repeats), separators disappear where a minus sign or decimal point already separates numbers, and curve runs that trace a circle can collapse into arcs. A rectangle written as <rect x="12" y="22" width="40" height="20"/> becomes <path d="M12 22h40v20H12z"/>.

Choosing precision for your viewBox

Precision is the one setting that trades quality for size. Rounding to p decimals moves a point by up to ±0.5 × 10^-p user units, and what that means on screen depends entirely on the viewBox. At precision 1, a 24-unit icon drawn 512 px wide can shift by about 1 px, while a 10,000-unit map would not move visibly even at precision 0. The hint under the slider does this conversion for your file, and Explore precision plots bytes against changed pixels so you can see where quality starts to drop.

viewBoxTypical fileStarting precision
0 0 24 24UI icon2–3
0 0 512 512Logo or illustration1–2
0 0 10000 6000Map or technical drawing0–1
0 0 1 1Normalised path data4–5

Presets: Safe, Balanced and Maximum

Balanced is exactly SVGO's preset-default, so results match the SVGO command line. Safe is for animated, scripted or CSS-styled SVGs and sprites: it keeps IDs, classes, groups and element types and only removes junk and compacts numbers. Maximum adds plugins that convert styles to attributes, remove width/height and reuse repeated paths, which can change how the SVG sizes itself, so check the preview.

Read the waterfall, then the gzip numbers
Servers send SVG compressed with gzip or Brotli, and compression already removes some of the repetition an optimizer targets. The stats card shows both raw and gzipped sizes so you can see the saving that actually reaches users.

Inline SVG, .svg file or data URI?

An inline SVG in HTML can be styled and scripted by the page, but it is not cached separately. A .svg file used in <img> or CSS is cached and isolated, which also means page CSS can't reach inside it. A data URI saves a request for small icons. The URL-encoded url("data:image/svg+xml,…") form is usually shorter than base64, which always adds about 33%. For encoding arbitrary files rather than optimized SVG, use the Data URI Generator.

Accessibility is kept by default

A meaningful SVG should have a <title>, role="img" and often aria-labelledby pointing at the title and description IDs. SVGO's defaults remove role and rename or drop those IDs, which leaves screen readers with nothing to announce. With Keep accessibility on, the tool keeps titles, meaningful descriptions, the role attribute and every ID that an ARIA attribute references.

An optimizer is not a sanitizer
Removing scripts makes a file smaller, not safe. Previews here render SVG as images, so nothing in your file runs, but don't rely on any optimizer to make untrusted SVG safe to serve on your site.

Frequently Asked Questions

Is the SVG Optimizer free?

Yes, SVG Optimizer is totally free :)

Can I use the SVG Optimizer offline?

Yes, you can install the webapp as PWA.

Is it safe to use SVG Optimizer?

Yes, any data related to SVG Optimizer only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How does this SVG optimizer work, and is my file uploaded?

Nothing is uploaded. SVGO 4.1 runs in a Web Worker inside your browser, and the before/after preview and pixel check render both files locally as images. The page makes no network requests with your SVG.

Is SVG optimization lossless?

Not entirely. Removing editor data, comments and redundant structure is lossless, but rounding coordinates to the chosen precision moves points slightly. That is why the tool renders the original and the optimized file and reports the share of pixels that changed.

What does the precision setting mean?

It is the number of decimal places kept in coordinates and other numbers. The right value depends on the viewBox: a 24-unit icon needs more decimals than a 10,000-unit map. The hint next to the slider converts the rounding error into pixels at 512 px wide, and Explore precision shows bytes and changed pixels for 0 to 6.

Why did my IDs or classes change, and how do I keep them?

The Balanced preset removes unused IDs and shortens the rest, which breaks page CSS or JavaScript that targets them. Turn on Keep IDs, list specific IDs or prefixes to preserve, or use the Safe preset, which keeps IDs, classes, groups and element types.

Will optimization break my animation or CSS hover effects?

It can: converting shapes to paths, collapsing groups and merging paths change the elements animations and selectors point at, and CSS minification drops rules that match nothing yet. When the tool detects animation it offers the Safe preset, which avoids those changes.

Does it remove malicious scripts, and should I still gzip my SVGs?

Scripts are kept unless you enable Remove scripts, and an optimizer is not a security sanitizer, so don't rely on it to make untrusted SVG safe. Yes, still serve SVGs with gzip or Brotli: the stats card shows both raw and gzipped sizes because compression shrinks the gains.