SVG Validator

Check SVG markup for XML well-formedness errors — line numbers, column positions, and structured error messages. Runs entirely in your browser.

Paste SVG to validate

How the validator works

SVG is a subset of XML. This validator uses the browser's built-in DOMParser with the image/svg+xml MIME type, which applies strict XML parsing rules. If the markup is not well-formed XML — unclosed tags, mismatched element names, duplicate attributes, or illegal characters — the parser returns a parsererror element containing a structured error message with the line and column of the first problem found.

Common SVG validation errors

  • Unclosed tags — every element must have a closing tag or self-close with />. A <circle> without a matching </circle> or <circle /> is invalid.
  • Mismatched element names — opening and closing tags must match exactly, including case. <Path> and </path> is an error.
  • Unescaped special characters <, >, and & must be written as &lt;, &gt;, and &amp; in attribute values.
  • Duplicate attributes — an element cannot have the same attribute listed more than once.

Frequently Asked Questions

What does the SVG validator check?+

The validator parses your SVG markup using the browser's built-in DOMParser with the image/svg+xml MIME type. If the parser encounters malformed XML — unclosed tags, mismatched elements, invalid attribute syntax, or illegal characters — it returns a parsererror element. The validator surfaces those errors with line and column numbers when available.

Will it catch all SVG errors?+

The validator catches XML well-formedness errors: unclosed tags, duplicate attributes, malformed entities, and namespace issues. It does not validate SVG-specific semantics — for example, an invalid path d value or a stroke-width of "banana" will pass validation because they are syntactically valid XML attributes.

What does "valid SVG" mean for inline use vs as a file?+

When used inline in HTML, browsers are more permissive and will often render SVGs that are technically invalid XML. As a standalone .svg file or data URI, browsers use the stricter XML parser and invalid markup may fail to render. This validator uses the strict XML parser, matching the file and data URI behavior.

Is my SVG sent to a server?+

No. Validation runs entirely in your browser using the built-in DOMParser. Your SVG markup never leaves your device.

How to use

  • Paste your SVG markup — validation runs instantly as you type.
  • A green checkmark means well-formed, parseable SVG.
  • Red errors show the line and column of the first problem found.
  • Use the Load invalid example button to see what error output looks like.