HTML Guides for document structure
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
A <body> start tag is stray when it appears where the parser can no longer open a body: after </body> or </html>, after a <frameset>, or inside a <template>.
A document has exactly one <body>. Once the parser has read </body> or </html>, a second <body> tag has nowhere to go. Browsers put the content that follows it back into the first body, and copy over any attributes the first <body> doesn't already have. That is why a second <body> after </body> also gets the "Start tag body seen but an element of the same type was already open" error. That error on its own means the extra <body> showed up while the first body was still open.
When the stray <body> comes after </html>, or carries an attribute the first <body> lacks (an onload handler, for example), the validator stops at that tag with "Cannot recover after last error". The rest of the page isn't checked until you remove it.
The extra tag usually comes from a template or include that wraps its output in its own <body>, such as a footer partial or a tracking snippet added after the layout has already closed the document. Move that content into the single <body>, before </body>, and drop the wrapper.
Old frameset pages trigger the error too. A <frameset> takes the place of the body, so the parser ignores a <body> that follows it, along with everything inside it. The <frameset> and <frame> elements are obsolete, so rebuild the page with one <body> and use <iframe> elements where the frames were. Inside a <template>, leave out the <body> tag and keep only its content.
Invalid example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Opening hours</title>
</head>
<body>
<h1>Opening hours</h1>
<p>Monday to Friday, 9:00 to 17:00.</p>
</body>
<body>
<footer>
<p>Call us on 555-0100.</p>
</footer>
</body>
</html>
Valid example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Opening hours</title>
</head>
<body>
<h1>Opening hours</h1>
<p>Monday to Friday, 9:00 to 17:00.</p>
<footer>
<p>Call us on 555-0100.</p>
</footer>
</body>
</html>
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries