Skip to content

SVG Optimizer

Paste SVG markup or upload a .svg file and get a smaller file: comments gone, whitespace collapsed, safe unused attributes dropped, colors shortened, empty groups removed. Copy or download the result — nothing leaves your machine.

  • Paste SVG code or upload a .svg file
  • Toggles for comments, whitespace, attrs, colors, empty groups
  • Before/after byte count with copy and download
  • Safe minify only — no risky path rewriting
  • Runs fully client-side, nothing uploaded

Optimizer

Optimized locally, nothing uploaded

How to optimize an SVG

  1. 01

    Paste SVG or upload a file

    Drop a .svg file into the upload zone, or paste the markup into the editor.

  2. 02

    Pick which passes to run

    Toggle comments, whitespace, unused attributes, color shortening, and empty groups.

  3. 03

    Copy or download the result

    Compare before/after bytes, then copy the optimized markup or download an .svg file.

What “optimize SVG” usually means — and what this tool actually does#

Search results for “svg optimizer online” and “svg compressor online” mix two very different jobs. Aggressive optimizers (SVGO-style pipelines) rewrite path data, merge shapes, inline styles, strip unused IDs and gradients, and can change how the graphic renders if a pass is too eager. This tool deliberately stays on the safe side: it minifies markup the way a careful hand edit would — remove comments authors left behind, collapse insignificant whitespace between tags, drop a known-safe set of unused or default attributes, shorten colors when the value is equivalent (#ff0000 → #f00, rgb(0,0,0) → #000), and delete empty <g> wrappers that draw nothing.

That is usually enough for CMS exports, icon packs from design tools, and hand-written SVG that grew comments and indentation. If you need path-data compression or shape merging, keep a dedicated SVGO/CLI step in your build; use this page when you want a free, instant “svg minify online” pass without installing anything or uploading assets.

Safe attribute removals (and what we refuse to touch)#

“Remove unused attributes” here is not a full dependency analysis of url(#id) references. A true unused-ID pass needs a graph of fills, strokes, clip-paths, masks, and <use> hrefs — getting it wrong invisibly breaks the icon. The safe set is narrow on purpose: empty attributes (fill=""), SVG root noise like version / baseProfile / enable-background, xml:space="default", default opacities (opacity="1" and friends), and editor namespaces from Inkscape/Sodipodi/Sketch (inkscape:*, sodipodi:*, …). Your xmlns, viewBox, geometry, and presentation attributes stay put.

Whitespace collapse skips significant text containers — <text>, <tspan>, <textPath>, plus <title>, <desc>, <style>, <script>, and <foreignObject> — so label spacing and embedded CSS/JS are not flattened into a single run-on string. Structural tags between shapes collapse to ><, which is where most of the byte savings come from on pretty-printed exports.

Colors, empty groups, and documented limits#

Color shortening only rewrites values that stay visually identical in sRGB: six-digit hex that collapses to three digits, eight-digit hex that collapses to four, and simple rgb() / rgba() with integer channels. Named CSS colors and hsl() are left alone to avoid surprising palette changes. Empty <g> removal is iterative so nested empty wrappers disappear in one optimize pass.

Limits to keep in mind: this is not a path optimizer — d attributes are not rewritten, arcs are not converted, and duplicate path segments are not merged. Stylesheets are not inlined into attributes; unused gradients and filters are not pruned; XML declarations and DOCTYPE lines are left as-is unless you delete them yourself. Treat the before/after byte meter as the source of truth for how much this safe pass bought you, then run a heavier SVGO profile offline if you still need more.

Why browser-side minify beats “upload your logo” compressors#

SVG often embeds product UI, brand marks, and sometimes even text that should not transit a third-party server. Every option on this page runs locally with a lightweight custom minifier — no CDN SVGO dependency, no account, no file stored after you close the tab. Upload is only a convenience to fill the same textarea you could paste into; the bytes never leave the page.

Pair this with gzip/Brotli on the wire: minified SVG still compresses well, and removing repeated indentation often helps more than people expect because pretty-printed exports repeat the same spaces on every line. For icons used as inline HTML, smaller markup also means less DOM parse work on first paint.

Frequently asked questions

Is this the same as SVGO?

No. SVGO can rewrite paths, merge shapes, and strip unused defs. This tool is a safe minify: comments, whitespace, a fixed unused-attr set, color shortening, and empty groups — without risky geometry changes.

Will optimizing SVG break my icon?

The default passes are chosen to avoid visual changes. Whitespace inside text elements is preserved, and attributes that affect painting stay. If you toggle options off, re-check the preview by opening the downloaded file.

Does it optimize SVG path data?

Not in this version. Path `d` strings are left byte-for-byte. For path compression, use an SVGO/CLI pipeline; this page targets markup minify and safe cleanup.

What unused attributes get removed?

Empty attributes, SVG `version` / `baseProfile` / `enable-background`, `xml:space="default"`, default opacity values, and editor namespace attributes (Inkscape, Sodipodi, Sketch). Referenced IDs and presentation attributes are kept.

Can I minify SVG code online for free?

Yes — paste or upload, toggle the passes you want, and copy or download. No signup and no server upload; optimization runs in your browser.

Is my SVG uploaded anywhere?

No. File reading and optimization happen entirely on your device. Closing the tab discards the content.

Developers

UUID Generator

Generate cryptographically random UUID v4 or time-ordered UUID v7, in bulk.

Developers

Base64 Encoder & Decoder

Encode and decode Base64 with correct UTF-8 handling, including the URL-safe alphabet.

Developers

ULID Generator

Generate ULIDs — sortable by creation time like UUID v7, but Crockford Base32 instead of hex.