SVG cleaner and repair
Scan your media library and stored icons for unsafe SVGs, see exactly what cleaning would remove, clean with one click, and repair broken SVG files.
The free plugin cleans every SVG that arrives through the uploader. Files that reached your site another way were never cleaned. The SVG cleaner finds them, shows what is wrong and cleans them with one click. It can also repair SVGs that are not dangerous, just broken.
Which files does it find?
Files that skipped the uploader are stored exactly as they arrived:
- files that were already on the site before Easy SVG Support was installed (the normal case on an existing site)
- files restored from a backup or brought in by a migration plugin
- files copied into the
uploadsfolder by FTP or SSH - attachments created by other plugins' code
Before you start
- Your Pro license is active.
- SVG cleaner is on under Icons → Features. For repairs, Repair broken SVGs is on too.
- Make a backup of your site if you plan to clean many files. The cleaner keeps originals, but a backup is always good practice.
Scan and clean
Open the cleaner
Go to Icons → SVG cleaner. Before the first scan, the screen says "Not scanned yet".
Scan
Click Scan all SVGs. The cleaner checks the media library and your stored icons. On a large library this can take a moment; if it stops early, it says so and you click Scan all SVGs again for the rest.
Read the report
The section SVG cleaner shows a line like "120 checked · 4 flagged" and a table. For each flagged file: the Attachment, what Would be removed, and an Action.
Clean a file
Click Clean on a row. The original is saved first, then the file is rewritten clean. The row disappears from the list.
Reading the report
The report names what would be removed, instead of only counting. For example:
| Shown | Meaning |
|---|---|
script | A script that can run code. Clean it. |
onload, onclick | Event handlers that run code. Clean it. |
foreignObject | Embedded HTML inside the SVG. Clean it unless you know why it is there. |
xlink:href to another server | A link to an outside file. |
malformed | The file is not valid SVG at all. |
Names help you decide. They also explain later why a designer's animation stopped working after cleaning. The report uses your site's own allow-list, including anything you added in the Configurator.
Stored icons
The section Stored icons checks the icons in your free icon library, your sets and your icon folders.
- Library and set icons get a Clean button. The original is kept first.
- Folder icons cannot be cleaned here, because the file is the source. The row says Fix this file where it comes from: change the SVG file in your theme or folder.
Kept originals
Every time the cleaner rewrites a file or an icon, it first keeps the original. The section Kept originals lists them.
- Download saves an original to your computer, for example to check it in a vector editor.
- Discard deletes a kept original for good, after a confirmation.
Originals are never put back automatically, because they are exactly what made the file unsafe. Only the very first original is kept, so cleaning a file twice still leaves the untouched copy. Originals are stored with the attachment in the database, not as a file in uploads, so nobody can open them by guessing an address.
Repair broken SVGs
With Repair broken SVGs on, the same screen gets a section Broken SVGs. It finds files that are not dangerous, just broken:
| Problem | What you notice | Can it be repaired? |
|---|---|---|
No viewBox | The SVG shrinks to nothing or does not scale in a flexible layout | Yes |
| Editor leftovers (comments, metadata, editor attributes) | Bigger files, odd attributes | Yes |
| A photo inside | Heavy file | Reported only |
| Text not converted to outlines | Wrong font on other computers | Reported only |
Click Repair on a row. The original is backed up first, and the repaired file goes through the sanitizer before it is written. A file with a photo or unconverted text gets no button, because removing either would throw away part of the drawing: fix it in your design tool.
Good to know
- The scan only reads. Nothing changes until you click Clean or Repair.
- The report shows its age. "last run" with a date tells you when the scan was made.
- Very large libraries. The list shows the first entries and says "Listing the first ... of ...". Clean those, then scan again.
Common questions
Related guides
Developers find the cleaner's hooks in the developer reference.