SVG Inspector
About this tool
About SVG Inspector
Before you inline an SVG into a website, accept it as a user upload or hand it to a developer, it helps to know what is actually inside. The inspector reads the file's code and reports it in plain terms: file size, rendered size and aspect ratio, the viewBox and width/height attributes, the number of elements of each type, how many carry ids, every fill, stroke and gradient colour with how often it is used, the fonts any text depends on, and embedded bitmap images that won't scale like vectors. Its safety check looks for the patterns behind SVG-based attacks and tracking: script elements, inline event handlers such as onload, javascript: links, embedded HTML through foreignObject or iframes, external images, stylesheets and @import rules, XML entity declarations and animations that rewrite links. Each finding says why it matters. The file is analysed as text and previewed as an image, so nothing in it can run, and it never leaves your browser.
Built and maintained by Abhi JainUpdated
How to Inspect an SVG
- 1
Open the SVG
Drop an .svg file or paste its code and press Use code.
- 2
Read the report
Review the size, viewBox, element counts, colours and fonts in the Inspector report tab.
- 3
Act on the safety check
If risks are listed, clean the file with the SVG Optimizer before you use it.
SVG Inspector: questions and answers
Can an SVG file contain a virus?
SVG is a text format that can include JavaScript. It can't infect your computer by itself, but scripts can run when the SVG is opened in a browser tab or inlined into a page, which enables cross-site scripting (XSS). The inspector flags any scripts and handlers.
Is an SVG safe inside an <img> tag?
Yes, mostly. Browsers don't run scripts or load external resources for SVG shown through <img> or CSS backgrounds. The risk is inlining the markup or serving it as a page.
How do I remove scripts from an SVG?
Run it through the SVG Optimizer with Remove scripts and event handlers ticked, then inspect the result again.
How do I find all the colours used in an SVG?
The Colours section lists every fill, stroke, stop and flood colour found in attributes and styles, normalised to hex, with a copy button for each and for the full list.
More SVG Viewer presets
Related tools
- SVG OptimizerMinify and clean SVG files with SVGO: smaller files, same look, side-by-side check.
- SVG to PNGConvert SVG to PNG, JPG or WebP at any scale or exact size, with or without a background.
- SVG to PDFConvert SVG graphics into high-resolution PDF pages.
- Color Picker & ConverterPick a colour and convert it between HEX, RGB, HSL, HSV, OKLCH, CMYK and CSS names.