SVG Optimizer
Strip the prolog, comments and editor metadata out of an SVG and collapse tag whitespace — viewBox and path data untouched.
Editor-exported SVGs carry a lot that is not picture: an XML prolog, a DOCTYPE, comments, and a metadata block naming the software that wrote the file, plus generous indentation between every tag. None of it renders, and all of it ships. This optimizer removes exactly those layers — prolog, DOCTYPE, comments and metadata elements — collapses the whitespace between tags, and trims the ends, while deliberately leaving the geometry alone: viewBox attributes and path data (the d attribute) are preserved character for character. The saving is reported honestly as a byte count: sizeReport compares the two lengths directly, so a snippet cut from 10 bytes to 5 bytes reports savedPct 50 — no rounding theatre, just (before − after) ÷ before.
Optimization happens in this browser: prolog, comments and editor metadata are stripped and tag whitespace is collapsed, while viewBox and path data are preserved. Your SVG is never uploaded, stored or put into a link; it stays in this page on your device only.
Quick answers
How do I optimize an SVG file?
Paste the markup and copy the cleaned result: the prolog, DOCTYPE, comments and metadata are stripped and tag whitespace collapsed, while viewBox and path data stay untouched. The result line reports before and after bytes and the percentage saved.
Path simplification is deliberately out of scope — this pass removes only what never renders, so the image cannot change.
Why is my SVG still large after optimizing?
Because the remaining weight is geometry: thousands of path points from a traced or hand-drawn illustration. Metadata cleanup cannot shrink that — only path simplification in a vector editor can.
Check the reported saving: if it is small, your export was already clean and the file size is an artwork question, not a markup question.
How to use
- Paste the SVG markup — from an editor export, an icon file, or inline SVG copied out of a page.
- Leave the title option off unless you are sure: removing <title> elements shrinks the file but also removes the accessible name screen readers use, so it is opt-in here.
- Read the before and after byte counts and the percentage saved, then copy the optimized markup or download it as a .svg file.
- Preview the downloaded file once before shipping it — the optimizer never changes geometry, but a ten-second visual check is cheap insurance for any automated cleanup.
About this tool
What this tool does not do is equally deliberate. It does not simplify paths, merge shapes, round coordinates or minify attribute values — those transforms can change how an image renders, and a cleanup tool that might alter the picture has to say so loudly; this one simply does not attempt them. If your SVG is still large after this pass, the weight is in the geometry itself, and the fix is a real path-simplification pass in a vector editor. The optional title removal exists for icon systems where titles are supplied by the surrounding page; for a standalone image, keep the title — it is the accessible name of the graphic.
Frequently asked questions
Will optimizing change how my SVG looks?
No. Only non-rendering material is removed — the XML prolog, DOCTYPE, comments and metadata — plus whitespace between tags. The viewBox, every element and every path’s d attribute are preserved exactly, so the rendered image is identical.
Should I remove the <title> element?
Only for icons that get their accessible name from the page around them. For a standalone SVG image, the title is what screen readers announce, so keep it. That is why removal here is an opt-in checkbox, not the default.
How is the saving calculated?
By length, before and after: savedPct is (before − after) ÷ before × 100. Cutting a file from 10 bytes to 5 bytes is a 50% saving. The result line shows both byte counts so you can check the maths yourself.
Is my SVG uploaded for optimization?
No. The markup is cleaned in this browser with plain text transforms, and your SVG is never uploaded, stored or put into a link.
First time embedding? Read the step-by-step guide →
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
JSON Formatter & Validator
Format, minify and validate JSON in one click.
What Is My IP
See your public IP address instantly. No sign-up, nothing stored.
Regex Tester
Test, check and validate regular expressions with live highlighting.
JWT Decoder
Decode a JWT token without the secret — see its header and payload.
SHA-256 Hash Generator
Generate SHA-256 / SHA-512 hashes instantly.