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

Paste an SVG or drop an .svg file.

Applied
remove-comments, remove-editor-namespaces
Skipped
collapse-whitespace
Original size
205 bytes
Optimized size
111 bytes
Saved
94 bytes (45.9%)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><rect width="10" height="10" fill="#2563eb"/></svg>

Supported formats

Input
svg, text
Output
svg, text
Files
Local file intake and drag/drop

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

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

  1. Apply a conservative optimization set: strip comments, remove editor-namespace elements/attributes, and collapse whitespace between tags.
  2. Never alter geometry, path data, transforms, styling attributes or accessibility attributes; only comments, editor metadata and inter-tag whitespace are eligible.
  3. Report the applied and skipped optimizations and the exact UTF-8 byte reduction, computed before and after.

Usage

  1. Paste an SVG or drop an .svg file.
  2. Choose which optimizations to apply.
  3. 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

jsonSelect to copy
{
  "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

jsonSelect to copy
{
  "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

  1. Scalable Vector Graphics (SVG) 1.1 Specification — W3C