SVG Sanitizer
SVG Sanitizer cleans an untrusted SVG by removing scripts, event handlers, embedded web pages, links to other sites and external styles, and lists exactly what was taken out. It runs in your browser. It is a first line of defense, so also sanitize on the server.
How to use SVG Sanitizer
- Paste the SVG or drop the file.
- Read the list of what was removed and check the cleaned picture.
- Copy or download the cleaned file.
Frequently asked questions
Is my file uploaded to be cleaned?
No. The cleaning runs in your browser. The file is not sent anywhere.
Why can an SVG be dangerous?
An SVG is code, not just a picture. It can contain scripts, event handlers, links that run JavaScript, and references to other sites that track whoever opens it. That matters most when you let users upload SVGs or paste them into a page.
What is removed?
Script elements, on-event attributes such as onclick, foreignObject and the HTML inside it, links that are not local to the file, CSS @import and external url(), and animations that could turn a link into script. Shapes, colour fades, clip paths, text and local references are kept.
Is this enough to make an upload feature safe?
It is a strong first step, not a guarantee. Always sanitize on your server too, serve user SVGs with a Content-Security-Policy, and show them through an img tag rather than inline when you can.
Why is my picture different afterwards?
If the picture depended on an external image, external font or script, that part is gone by design. The list of removed items shows what changed.
Next step
Cleaned the file? Optimize it for size next. Open SVG Optimizer.
Related tools
- 109