How to delete unused <defs> and dead code from svg files
- Step 1Upload your SVG — Drop an SVG that has been exported from a design tool or built up over time — these often accumulate unused defs as designs evolve.
- Step 2Review the unused defs list — The purger lists every unreferenced definition: gradient ids, clipPath ids, symbol ids. You can deselect any to preserve it if needed.
- Step 3Download the cleaned SVG — Download the purged SVG. The file will be smaller and faster to parse — especially significant for SVGs with complex gradient libraries.
Frequently asked questions
How does the tool know a def is unused?+
It collects all id values from <defs> children, then checks every fill, stroke, filter, clip-path, mask, href, and xlink:href attribute across the document for matching url(#id) or #id references.
Can it accidentally remove defs referenced in external CSS?+
The purger only analyses the SVG document itself. If you reference SVG ids from an external CSS file (e.g., fill: url(#gradient)), add those ids to the preserve list in the tool settings.
What tier is required?+
The Unused Defs Purger requires a Pro subscription. The multi-pass DOM traversal required for accurate reference detection is too resource-intensive for the free tier.
Does it work on SVG sprites?+
Yes. Symbol elements in SVG sprites that are never referenced with <use> are considered unused and will be listed. Review carefully before removing symbols — you may reference them from another page.
Privacy first
Every JAD SVG tool runs entirely in your browser using the DOM API and Canvas. Your SVG files never leave your device — verified by zero outbound network requests during processing.