Online SVG Sanitizer

Optimize and clean SVGs exported from Figma, Adobe Illustrator or Inkscape. Remove metadata, unnecessary attributes and empty groups to get a production-ready SVG.

Utilities Studio

Want this utility on your website?

Customize colors and dark mode for WordPress, Notion or your own site.

Frequently Asked Questions

Can I paste the full HTML of a page with an embedded SVG?

Yes. The sanitizer detects the SVG element inside the HTML and extracts only that block for processing. It also works if you paste the SVG fragment directly.

Does it work with Illustrator SVGs?

Yes. Illustrator exports SVGs with XML declarations, metadata and proprietary namespaces that the sanitizer removes. The result is an SVG compatible with all modern browsers.

What is the difference between cleaning and minifying?

Cleaning removes unnecessary attributes and tags but keeps the indented format so you can read and edit the code. Minifying also collapses everything into a single line to reduce file size to the maximum.

Can removing IDs break the SVG?

Only if an element in the SVG references another by ID, for example through fill="url(#gradient)". In that case, disable the Remove IDs option. It is disabled by default precisely to avoid this problem.

Is my SVG code sent to any server?

No. All processing happens in your browser using the native DOMParser and XMLSerializer APIs. The code never leaves your device.

# SVG Sanitizer: Clean Code from Figma and Illustrator

Paste any SVG exported from Figma, Adobe Illustrator or the browser inspector and get a clean, optimized vector file ready for production.

# Why are exported SVGs so dirty?

When you export an SVG from Figma, you get a file loaded with attributes that only make sense inside the app: data-name, xml:space, references to internal layers and design metadata. The result is an SVG that can weigh 40-70% more than necessary.

# What the Sanitizer removes

  • Editor metadata: metadata, title and desc tags that Figma and Illustrator add automatically.
  • Inkscape namespaces: all elements with inkscape: and sodipodi: prefix.
  • Unnecessary attributes: xml:space, version, superfluous xmlns:* and Figma data-* attributes.
  • Empty groups: <g> elements with no content left as artifacts of deleted layers.
  • XML declarations: the <?xml version="1.0"?> declaration and DOCTYPE unnecessary when embedding SVG in HTML.

Bibliographic References