SVG Optimizer
Shrink SVG markup losslessly in your browser.
How to use
- 1 Paste your SVG markup into the source box.
- 2 Tick the optimizations you want applied.
- 3 Watch the optimized output and the byte savings update live.
- 4 Copy the result into your project.
About SVG Optimizer
The SVG Optimizer trims the fat out of SVG markup so your icons, logos and illustrations load faster and embed more cleanly into HTML, CSS or component files.
Exported SVGs from design tools are usually padded with editor metadata, comments, an XML declaration, a DOCTYPE and generous indentation — none of which the browser needs to draw the image.
This tool removes that overhead while leaving the actual shapes, paths and attributes untouched, so the rendered result is identical.
You control exactly what gets cleaned.
Toggle off comments, the XML and DOCTYPE declarations, and whitespace collapsing between and inside tags.
There is also an option to drop the width and height attributes when a viewBox is present, which lets the SVG scale fluidly to its container — handy for responsive layouts and inline icons sized with CSS.
After each change you see the before-and-after byte count and the percentage saved, so you can judge the trade-offs at a glance.
Everything is computed locally with plain string transforms; your artwork is never uploaded to a server, which makes it safe for unreleased branding and proprietary graphics, and it keeps working offline once loaded.
FAQ
Is the optimization lossless?
Yes. It only removes comments, declarations and redundant whitespace, and optionally width/height when a viewBox exists. The drawn shapes and their attributes are preserved.
Why would I remove the width and height?
When a viewBox is present, dropping width and height lets the SVG scale to whatever size its container or CSS specifies, which is ideal for responsive inline icons.