SVG Sanitizer
Paste or drop an SVG and get a hardened copy with active content removed: script elements, on* event handlers, javascript: URLs, foreignObject and embedded frames, unsafe CSS in style elements or attributes, XML processing instructions, the DOCTYPE and external or data: references. Every change is listed so you can review it, and audit mode reports the changes without producing a file.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Drop a file here, or browse
Accepts: .svg,image/svg+xml,text/xml,application/xml
Files stay on your device.
Ctrl+V to paste an image
Text is processed on this device. If a file is selected, the file is used instead.
Options
Drop a file above to begin
Your file are processed on this device and never uploaded.
How it works
What the cleaner removes
Feed it SVG markup or a dropped .svg file and it strips script elements, on event handler attributes, javascript and vbscript URLs, foreignObject, embedded frames, XML processing instructions, the DOCTYPE and unsafe stylesheet content. You get a hardened copy plus a list naming every element or attribute it changed.
Audit versus clean
Action decides the outcome: Clean and download writes the sanitised file, while Audit only lists the findings and hands back no file, which suits reviewing an asset before committing it. Removing comments is on by default, since comments never render and can hide payloads.
External references
By default references outside the document go: absolute and relative URLs, protocol-relative links and SVG or HTML data URIs. Same-document fragments such as a gradient id and raster data images survive. Switch the option to Keep and the report warns that opening the file may still trigger network requests.
Limits and privacy
Only well-formed SVG parses, the root must be svg, and inputs over 10 MB are refused. This is a hardening filter, not a sandbox, so keep treating the output as untrusted. Parsing and rewriting happen locally in your browser and nothing is uploaded.
Questions
Is the result safe to embed?
It is much safer, but this is a denylist filter rather than a sandbox: it removes the constructs that are known to execute or fetch, and it cannot prove that an SVG renderer will never find another way. Keep treating output from untrusted sources as untrusted, and serve it from a separate origin where you can.
What counts as a reference outside the document?
Anything that is not a same-document fragment such as #gradient or a raster data: image. That means absolute and relative URLs, protocol-relative URLs, and SVG or HTML data: URIs, because fetching them can leak the reader’s IP address and loading them can execute code.
Why remove foreignObject and animation elements?
foreignObject can carry arbitrary HTML including scripts, and the SVG 1.2 handler, listener and animation elements, plus set or animate targeting an href, can install scripted behaviour. Legitimate illustrations rarely need them, and geometric animations that do not touch hrefs are kept.
Will it break my drawing?
Paths, shapes, groups, gradients, filters, text and internal references are left untouched, including formatting and attribute order. If a change would affect the artwork, the report names the element or attribute so you can decide whether to accept it.
Related tools
See categorySVG Optimizer
Minify or pretty-print SVG, rounding coordinates, stripping comments and empty groups.
SVG to PNG
Rasterize an SVG image to a downloadable PNG.
HTTP Security Headers Analyzer
Review pasted HTTP response headers for common browser security protections.
HTML Tag Validator
Check tag balance and well-formedness: unclosed, mismatched, stray and unexpected tags, with line numbers.