Pixelquil logoPixelquil

SVG Viewer & Validator

Preview any SVG and catch invalid markup, security risks, and rendering issues before you ship it.

Code
Preview
Nothing to preview yet

Validation report

  • Paste or upload an SVG to see its validation report.

How it works

  1. 1

    Paste or upload your SVG

    Paste SVG code directly into the box, or click Upload SVG to load a file from your device.

  2. 2

    Check the live preview

    The preview panel renders your SVG exactly as a browser would, so you can confirm it looks right visually.

  3. 3

    Read the validation report

    Each check shows a pass or warning icon with a plain language explanation of what it means and why it matters.

  4. 4

    Fix flagged issues

    If a check fails, use the detail text as a guide, or open the same SVG in our SVG Code Editor to make corrections directly.

About the SVG Viewer & Validator

Before an SVG goes into production, whether as a logo, an icon set, or a piece of user submitted content, it is worth checking two separate things: does it render correctly, and is it safe to embed. This tool checks both at once, rendering a live preview alongside a structured validation report, built around the actual SVG 1.1 specification published by the W3C rather than guesswork about what makes an SVG well formed.

Why SVGs break, and what well formed actually means

SVG is an XML based format, so the first requirement is that the markup is well formed XML, every tag properly closed, every attribute properly quoted, no stray characters breaking the structure. A single unclosed tag or unescaped ampersand is enough to make a parser reject the whole file. This tool runs your code through a real browser XML parser, the same kind of parser that will ultimately render or reject the file in production, so a pass here means the file will actually work, not just look plausible.

The viewBox attribute, and why so many exports miss it

Per the SVG 1.1 specification, the viewBox attribute defines the coordinate system used to scale the graphic inside its container. In practice, this is the single most common issue we see in SVGs exported from design tools: a missing or mismatched viewBox is usually why an icon looks correctly sized in one context and stretched, cropped, or tiny in another. This tool flags that specifically, rather than lumping it in as a generic warning, since it is the fix most likely to actually solve a real rendering bug. If this check fails, our SVG ViewBox Fixer can generate a correct one automatically.

SVGs can contain executable code, this checks for it

Unlike a JPG or a PNG, an SVG is a document, and the SVG specification explicitly allows a <script> element inside it, along with inline event handler attributes like onload or onclick. That means an SVG can carry executable JavaScript, a well documented cross site scripting vector when an application renders untrusted SVGs directly in the browser, for example an SVG uploaded by an end user and displayed without sanitization. This tool explicitly checks for embedded script tags and inline event handlers and flags them separately, so you know exactly why a file was marked as a concern rather than getting a vague security warning.

What this tool does not catch

Being upfront about limits matters as much as the checks themselves. This tool validates structure and flags known risky patterns, but it is not a substitute for server side sanitization if you are accepting SVGs from untrusted users at scale, a dedicated library such as DOMPurify configured for SVG is the right tool for that job. Similarly, a passing validation report confirms the file is well formed and free of the specific risks checked here, it does not guarantee visual correctness across every browser and rendering engine, since some edge cases around filters, fonts, and CSS still vary by implementation.

Runs entirely in your browser

Every check here runs client side using your browser's native XML parser, nothing you paste or upload is sent to a server, logged, or stored. That makes this a safe way to check unreleased branding, client files, or SVGs from a source you do not fully trust yet, without exposing that content to a third party service in the process of checking it.

Fixing what this tool finds

A validation report is only useful if you can act on it. If this tool flags a missing viewBox, the SVG ViewBox Fixer generates a corrected one automatically. For everything else, malformed markup, embedded scripts you want to strip, unnecessary attributes, our SVG Code Editor gives you a live code and preview panel to make the fix directly, part of the same SVG & Design Tools collection this validator belongs to.

Frequently asked questions

What does well formed XML mean, and why does it matter for SVGs?

SVG is built on XML, which requires every tag to be properly closed and every attribute properly quoted. A file that is not well formed XML will fail to parse in most browsers and design tools, so this is checked first, before any other validation.

Why is a missing viewBox flagged as an issue?

The viewBox attribute, defined in the SVG 1.1 specification, controls how the graphic scales inside its container. Without it, an SVG often renders at a fixed size instead of scaling responsively, which is one of the most common causes of layout bugs with SVG icons and logos.

Can an SVG file actually contain a virus or malicious code?

An SVG cannot contain a traditional virus, but it can contain executable JavaScript through a script tag or inline event handler attributes. This is a documented risk when applications render untrusted, user uploaded SVGs directly in the browser without sanitization, which is exactly what this tool checks for.

Does a passing report mean the SVG is completely safe?

It means the checks performed by this tool passed. It is not a replacement for full server side sanitization if you accept SVG uploads from untrusted users at scale, where a dedicated sanitization library is the appropriate tool.

Is my SVG file uploaded to a server when I use this tool?

No. Validation runs entirely in your browser using its built in XML parser. Nothing you paste or upload is sent anywhere or stored.

What should I do if my SVG fails validation?

The detail text under each failed check explains the specific issue. For a missing viewBox, our SVG ViewBox Fixer can generate one automatically. For other issues, the SVG Code Editor lets you make direct corrections while watching a live preview.

Why does the tool check for inline event handlers separately from script tags?

Both can execute JavaScript, but they are different mechanisms, a script tag contains a code block, while an inline event handler like onclick runs code in response to an interaction. Checking them separately makes it clear exactly what was found and where.

Does this tool support SVGs with embedded fonts or filters?

Yes, the preview renders using your browser's native SVG engine, which supports fonts, filters, and gradients. Some visual edge cases in these areas can still vary slightly between browsers, which is a limitation of browser rendering generally, not of this tool's validation checks.