About This HTML Issue
The xmlns:svg attribute is not allowed on the <svg> element in HTML5 and causes validation errors.
The SVG specification only requires the xmlns (not xmlns:svg) attribute for embedding SVG in HTML, and custom namespace prefixes like xmlns:svg are not needed or permitted in HTML5. The sole required namespace declaration is xmlns="http://www.w3.org/2000/svg". The xmlns:svg form was only used in extremely outdated XML-based workflows and has no place in current HTML.
Incorrect HTML Example:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<!-- SVG content here -->
</svg>
Correct HTML Example:
<svg xmlns="http://www.w3.org/2000/svg">
<!-- SVG content here -->
</svg>
In summary:
-
Use only
xmlns="http://www.w3.org/2000/svg"in inline SVG within HTML documents. -
Remove
xmlns:svgand any other prefixed namespace attributes unless specifically required for XML workflows, not HTML.
Learn more:
Last reviewed: May 07, 2025
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.