Skip to content

SVG Viewer

Sanitize, preview, and clean SVG locally.

Max 2 MB. Scripts and handlers are stripped before preview.

SVG Viewer / Optimizer previews SVG markup in your browser after stripping scripts and dangerous attributes. Paste or load a file, sanitize for XSS-safe preview, optionally collapse whitespace, and download the cleaned result.

How it works

Paste SVG or choose a local .svg file, then sanitize. The toolkit removes script/foreignObject tags, on* handlers, and javascript: URLs before creating a blob preview. Optional optimize collapses comments and whitespace.

Benefits

  • Script tags and handlers stripped
  • XSS-safe blob preview
  • Basic size cleanup
  • Local-only processing

Use cases

  • Inspect icons before committing
  • Clean SVG exports from design tools
  • Verify untrusted SVG snippets safely
  • Shrink simple markup for embeds

Best practices

  • Always sanitize before previewing unknown SVG
  • Keep a master copy before optimize
  • Prefer inline SVG only after review
  • Re-check accessibility text in complex icons

Common mistakes

  • Assuming optimize equals full SVGO
  • Embedding unsanitized SVG in HTML
  • Expecting external font URLs to load offline
  • Ignoring stripped-handler warnings

Privacy

SVG files and markup stay in your browser. ToolHub does not receive SVG content. History stores text only if you save it on this device.

Frequently asked questions

Is the SVG preview XSS-safe?
Yes. Before preview, ToolHub strips script tags, foreignObject/iframe/object/embed, event handler attributes, javascript: URLs, and data:text/html links. Preview uses a blob URL of the sanitized markup.
What does optimize do?
Basic cleanup removes comments and collapses excess whitespace. It is not a full SVGO pass—just enough to shrink simple markup safely.
Are script tags removed?
Yes. `<script>` and other dangerous tags are stripped. The FAQ and success message list what was removed when sanitization finds threats.
Can I paste untrusted SVG?
You can, but always run Sanitize & preview first. Never paste raw untrusted SVG into other apps without sanitization.
Does this upload my SVG?
No. File reads and sanitization happen locally in your browser.

Version 1.0.0 · Updated 2026-07-27 · 2 minutes