SVG Optimizer
Safely shrink an SVG by removing comments, editor metadata and inter-tag whitespace.
- Runs locally in your browser
- No upload required
Capabilities
- Drag and drop
- Local file intake
- Download result
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Reduced the SVG from 205 to 111 bytes (94 bytes saved).
How it works
- Apply only the enabled optimizations.
- Remove comments, then editor namespaces, then inter-tag whitespace.
- Report the exact byte reduction and list which optimizations applied or were skipped.
- Geometry, styling and accessibility attributes are never changed; an optimization that is not provably safe is skipped.
Methodology
- Apply a conservative optimization set: strip comments, remove editor-namespace elements/attributes, and collapse whitespace between tags.
- Never alter geometry, path data, transforms, styling attributes or accessibility attributes; only comments, editor metadata and inter-tag whitespace are eligible.
- Report the applied and skipped optimizations and the exact UTF-8 byte reduction, computed before and after.
Usage
- Paste an SVG or drop an .svg file.
- Choose which optimizations to apply.
- Run the optimizer to see the applied steps and the byte reduction, then copy the result.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Comments and editor metadata removed
{
"source": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" viewBox=\"0 0 10 10\"><!-- note --><rect width=\"10\" height=\"10\" fill=\"#2563eb\" inkscape:label=\"bg\"/></svg>",
"removeComments": true,
"removeEditorNamespaces": true,
"collapseWhitespace": true
}Only collapse whitespace
{
"source": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 4 4\">\n <rect width=\"4\" height=\"4\"/>\n</svg>",
"removeComments": false,
"removeEditorNamespaces": false,
"collapseWhitespace": true
}Limitations
Conservative by design
Aggressive SVG optimizers rewrite path data and remove definitions, which can change rendering. This optimizer only removes content that cannot affect the rendered result: comments, editor namespaces and inter-tag whitespace.
Each optimization is a toggle, and the tool lists which ones applied and which were skipped, with the exact byte reduction measured from the real source and output.
Frequently asked questions
- Will the optimized SVG look different?
- No. Only comments, editor metadata and whitespace between tags are removed; geometry, styling and accessibility attributes are untouched.
- Why is the saving small?
- The optimizer is intentionally conservative. It prioritises preserving the rendered result over maximum compression, so it will not rewrite path data or drop definitions.
Sources
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.