An SVG validator checks your SVG markup for XML well-formedness, correct SVG namespace, valid element names, security risks, and attribute requirements. Valid SVG renders correctly across all browsers, graphic editors, and document processors — paste your markup below to catch issues before they cause problems.
Validation Checks
Preview
Common SVG Elements Reference
Valid SVG elements include: svg g path circle rect line polyline polygon ellipse text tspan defs use symbol clipPath mask filter linearGradient radialGradient stop pattern image title desc animate animateTransform and more.
The SVG namespace is http://www.w3.org/2000/svg — the root <svg> element must declare this with xmlns="http://www.w3.org/2000/svg".
How to Validate SVG Markup
An SVG validator catches markup issues that can cause your SVG to fail in strict rendering contexts like Adobe Illustrator, Inkscape, or SVG processors — even when browsers render it fine. This SVG validator uses the browser's DOMParser API to check your SVG without uploading it.
Step 1: Paste Your SVG Markup
Copy your SVG markup (the full <svg>...</svg>
block) and paste it into the input area. You can use the "Load example" button to see what valid SVG looks like.
Step 2: Click Validate SVG
The validator runs six checks: XML well-formedness, SVG root element and namespace, element whitelist
(no HTML elements inside SVG), security check for <script>
tags and event handlers, viewBox format, and required attributes on elements like
<path d="...">.
Step 3: Review Results and Preview
If valid, the tool renders an inline preview of your SVG and shows element stats (count by type). If invalid, each failed check is highlighted with a specific description of what went wrong and how to fix it. Security warnings are shown separately — they don't block rendering but indicate potential XSS risks when embedding SVGs in web pages.
SVG Namespace is Required
The most common SVG validation error is a missing or incorrect namespace. Every SVG root element must
declare xmlns="http://www.w3.org/2000/svg".
Without this, SVG processors cannot distinguish SVG content from generic XML.
viewBox vs width/height
The viewBox attribute must contain exactly
four numbers: min-x min-y width height
(e.g., viewBox="0 0 24 24"). It defines
the SVG coordinate system and is needed for responsive scaling. While width
and height set the rendered size,
viewBox makes your SVG scale correctly at any size.
FAQ
Is this SVG validator free to use?
Yes, completely free with no account required. Paste your SVG markup and validate instantly. All processing runs in your browser — nothing is uploaded to any server.
Is my SVG code safe and private?
Yes. Validation runs entirely in your browser using the built-in DOMParser API. Your SVG code never leaves your device and is not stored anywhere.
What does the SVG validator check?
It checks: XML well-formedness (no parse errors), root element is `<svg>` with correct SVG namespace, all elements are valid SVG elements, no security-risky elements like `<script>` or on* event handlers, viewBox format if present, and required attributes on key elements.
Why does my SVG render in the browser but fail validation?
Browsers are very lenient and will try to display nearly any SVG even with errors. The validator catches standards violations that might cause problems in stricter rendering environments, SVG editors, or when embedding SVG in other documents.
What are the most common SVG validation errors?
Common issues include: incorrect or missing SVG namespace (xmlns), using HTML elements inside SVG instead of SVG equivalents, malformed viewBox attribute (needs exactly 4 numbers), missing `d` attribute on `<path>` elements, and embedded `<script>` tags which are a security risk.
Can I use SVG with `<script>` tags on my website?
SVG with embedded scripts (SVGs) pose XSS security risks when embedded in web pages or accepted as user uploads. The validator flags `<script>` tags and event handler attributes as security warnings. For web use, prefer CSS animations and JavaScript DOM manipulation over inline SVG scripts.