SVG validator
Choose an SVG, or paste its code, to see what is wrong with it. Each fault comes with its line and column, a sentence on why it matters and one on how to put it right. Press a fault and its line is selected in the code, where you can fix it.
Free, no account. The file is read by code running in your browser. It is not uploaded, and nothing about it is stored.
How to validate an SVG
- Choose your SVG, drop it on the box, or paste SVG code. The faults are listed at once, in the order they come in the file.
- Press a fault. Its line is selected in the code box underneath.
- Change the code there if you like. The list is made again as you type, so a fault that is fixed leaves it.
- Download the report as a text file to send to whoever made the SVG, or download the changed SVG.
What it checks
- XML that is not well formed: a tag that is never closed, tags closed in the wrong order, a value with no quotes, an attribute written twice, a bare
&, an HTML entity such as , a prefix that was never declared, a blank line before<?xml. Your browser’s own parser is asked as well and its message is quoted, because it is the parser that will open the file. A file like this shows an error or nothing at all, so it is reported alone: nothing else can be judged until it parses. - A missing or misspelt
xmlns. Withoutxmlns="http://www.w3.org/2000/svg"on the outer tag a file is plain XML and draws nothing. SVG copied out of a web page usually lacks it, because inside HTML it is not needed. - Elements and attributes that are not in SVG. A renderer skips an element it does not know, with everything inside it, and ignores an unknown attribute, in both cases without a word.
stroke_width,strokeWidthandviewboxall fail this way. Where a known name is one slip away, the validator names it. - References to ids that do not exist:
url(#…)in a fill, stroke, clip path, mask, filter or marker, in a style attribute or a style sheet, andhref="#…"on<use>, gradients, patterns and text paths. - Ids used twice. Whatever points to the id gets the first element that has it.
- Path data that does not parse, with the character at which it goes wrong. A renderer draws up to the last command it could read and drops the rest.
- A
viewBoxthat is not four numbers, or has a width or height of zero or less. - A size with no viewBox. A width and height alone fix the drawing at one size: shown at any other, it is cropped or left in a corner. With a size in millimetres or inches and no viewBox, one unit of the drawing is still one pixel, which is a common reason for a file coming out the wrong size on a cutter or plotter.
- What will not show when the file is used as a picture: scripts and event handlers, which do not run in an
<img>or a CSS background, and pictures, style sheets and other files the SVG points to, which are not fetched there.
The sample, fault by fault
The sample on this page is a 13 line drawing with four faults, two that stop something drawing and two worth checking. On line 8 the background is filled with url(#skye) and the gradient is called sky, so the background is not painted; the validator points out the id that is one letter away. On line 10 a second circle reuses the id sun. On line 11 the path data reads L120 l30 L180: the first L has one number where it needs two, at character 21, so the hill stops there. On line 12 the stroke width is written stroke_width, which is not an attribute, so the line is drawn one unit wide.
Fix them in the code box, in any order, and the list shrinks as you go. When the last one goes it says “No faults found” and lists what was checked.
What it is not
- It is not the W3C’s validator, and it does not check the file against a DTD or a schema. The W3C’s Markup Validation Service checks SVG 1.1 against its DTD. This tool checks for the faults that stop a file drawing or that a renderer quietly ignores.
- It checks that a name is in SVG, not where it is allowed.
ron a<rect>passes, becauseris an SVG attribute, though a rectangle has no use for it. - It does not check most values. A colour that is misspelt or a number that is out of range is not reported. Path data, the viewBox, ids and what points to them are.
- It skips what is not SVG: an editor’s own elements and attributes in their own namespaces, and HTML inside a
<foreignObject>. The count of what was skipped is shown. - It cannot see your fonts. Text set in a font that is not on the viewer’s device falls back to another one, and no check of the file can tell.
Where the names come from
The lists of names are built from the indexes of the specifications themselves, read on 6 October 2026: the Element Index and the Attribute Index of SVG 2 (W3C Candidate Recommendation), and the Element Index and Attribute Index of SVG 1.1 (Second Edition). That gives 63 elements in SVG 2, 18 more that only SVG 1.1 had, and 393 attributes between the two, presentation attributes such as fill and stroke-width included.
An element from the SVG 1.1 list only, such as <tref> or an SVG font, is reported as taken out of the standard. Any data- or aria- attribute is accepted.
Questions
Is this the W3C SVG validator?
No. The W3C runs its own Markup Validation Service, which checks a document against a DTD. This tool does not check a DTD. It looks for what breaks an SVG in practice and says how to fix each thing.
What does “not well formed” mean?
That the file breaks the rules of XML itself: every tag closed, in order, every attribute value in quotes, every & part of an entity. An XML parser stops at the first such fault, which is why the validator reports it alone.
My SVG shows in the browser. Why are faults listed?
Because renderers ignore what they do not understand and say nothing. An unknown attribute is skipped, a fill that points to a missing gradient is not painted, a broken path is cut short. The picture still appears, just not the one that was meant.
Why is strokeWidth reported?
It is how React spells stroke-width in JSX. In an SVG file the attribute needs its hyphen, and the camel-case name is ignored. The same goes for fillOpacity, strokeLinecap and className.
Why does my SVG not show in an img tag?
The usual causes are all on this page: a missing xmlns, XML that does not parse, or a part that lives in another file. Why an SVG is not showing goes through them one by one.