Multiple Body Tags

No Comments
Multiple body tags
TL;DR: An HTML page is only allowed one <body> element. When a template or plugin outputs two or more, browsers and Googlebot quietly merge them into a single body, but the malformed markup can break rendering, drop content, and hint at deeper template problems. Every page should ship exactly one body tag.
Category
Indexation

Valid count
Exactly one

Usual cause
Template or plugin

Detect with
Validator, Frog

Severity
Medium

One body per page, no exceptions

The HTML spec is blunt about this. A document has one <html>, one <head>, and one <body>. The body holds everything the user sees. There is no valid scenario where a single page needs two body elements. So when a crawler reports Multiple Body Tags, it found a page that emitted <body> two or more times, and that page is malformed.

Browsers are forgiving, which is exactly why this bug survives. When a parser meets a second <body>, it does not throw an error and stop. It follows the HTML parsing rules, ignores the extra body start tag, and folds any attributes and content into the one body it already has. Googlebot uses the same parsing model. So the page usually still renders and still indexes. That leniency is a trap: the issue hides because nothing visibly explodes, while the underlying markup is broken and can misbehave in ways that are hard to reproduce.

How the parser handles it

Source HTML (broken) <body> header, main content </body> <body> <!-- second --> footer widget </body>

parser

Parsed DOM (merged) <body> header, main content footer widget </body> second body dropped, content folded in

It usually works, until an attribute or script on the wrong body silently gets ignored.

Why it matters for SEO and rendering

Most of the time nothing dramatic happens, and that is precisely why people wave it off. But there are real failure modes worth taking seriously.

Attributes on the ignored body are lost. If your analytics, tag manager, or a framework hook lives as an attribute on the second <body>, the parser drops it, and that tracking or behavior silently fails. Content placement can shift, because the parser puts the merged content wherever its rules dictate, not necessarily where you intended, which can push key content out of the spot you optimized. JavaScript that targets the body by structure can break when the DOM does not match the source. And when Google renders the page, a malformed body raises the odds that some content is not captured cleanly, which is a bad bet on a page you want fully indexed.

The bigger point: a duplicate body is a symptom. It means a template is being included twice, a plugin is injecting a full document into another, or a partial got nested wrong. Whatever caused two bodies is probably causing other malformed output too. Fixing it usually fixes a class of problems.

Common causes

CauseWhat is happeningWhere to look
Template included twiceHeader or full layout partial rendered two timesTheme header and footer files
Plugin injects a full pageAdd-on outputs its own html and body inside yoursRecently added plugins, disable to test
Page builder conflictBuilder wraps content in its own document shellBuilder templates and global sections
Hardcoded body in contentAn editor pasted a full HTML snippet into a postPost and page body content, custom HTML blocks
Server-side include errorAn include pulls in a whole document, not a fragmentInclude and require statements

How to detect it

  • W3C Nu HTML Checker: paste the URL and it reports "Stray start tag body" or "Cannot have more than one body". This is the definitive check.
  • Screaming Frog: use a custom extraction or custom search to count <body occurrences per page. More than one flags the URL. Run it site-wide to see whether it is one page or a template affecting everything.
  • View source and search: open the raw HTML, not the rendered DOM, and search for <body. The rendered DevTools tree will show one merged body, so you must check the source that the server sent.
  • Sitebulb: its HTML validation hints surface structural errors including duplicate document elements.
  • curl the URL: curl -s URL | grep -o "<body" | wc -l gives you a fast count straight from the server response.

How to fix it, step by step

  1. Confirm it is in the source, not the DOM. Pull the raw response with curl or view-source and count the body tags. Rendered DevTools always shows one, so it will mislead you here.
  2. Decide: template or content. If every page has two bodies, it is a template or plugin. If only one page does, someone pasted full HTML into that page's content.
  3. For content, strip the extra shell. Edit the post, switch to the HTML or code view, and delete the pasted <html>, <head>, and <body> wrapper, keeping only the inner content.
  4. For templates, find the double include. Trace which partial outputs the body tag and make sure it runs once. A layout file should open body exactly one time and a footer should close it once.
  5. For plugins, isolate by disabling. Turn off suspect plugins one at a time and re-check the source. When the second body disappears, you have your culprit.
  6. Move body attributes to the surviving tag. If the second body carried classes, IDs, or event attributes you rely on, put them on the one real body so nothing is lost.
  7. Re-validate. Run the Nu checker again and confirm a clean parse, then re-crawl to make sure the fix held across the whole template.
DO
  • Validate the raw source, not the rendered DOM
  • Ship exactly one body per document
  • Keep only inner content when pasting HTML
  • Isolate offending plugins by disabling them
  • Move needed attributes onto the single body
DON'T
  • Shrug it off because the page still renders
  • Trust DevTools, it hides the merged body
  • Paste full HTML documents into post content
  • Nest one template's document inside another
  • Leave tracking attributes on the dropped body

What good looks like

A clean page validates with zero structural errors: one <html>, one <head>, one <body>. A site-wide crawl counting body tags returns exactly one per URL. All your body-level attributes, analytics hooks, classes, and framework bindings, sit on that single body, so nothing gets silently dropped. When you clean this up you usually find you have also fixed whatever template or plugin was doubling output, which is worth more than the one validation flag on its own.

FAQ

Will two body tags stop my page from indexing?
Usually not, because Googlebot merges them like a browser does. But it raises the risk of content or attributes being dropped during rendering, so it is worth fixing rather than gambling on a clean merge every time.
Why does DevTools only show one body?
DevTools shows the parsed DOM, which is already merged into a single valid body. To see the real problem you have to inspect the raw HTML the server sends, using view-source or curl.
Is one page affected or my whole site?
Count body tags across a crawl. If it is one URL, someone pasted a full HTML document into that page. If it is every URL, a template or plugin is doubling the body and the fix applies site-wide.
Can two head tags cause the same trouble?
Yes, duplicate head elements are the same class of error and often show up alongside duplicate bodies from the same doubled template. Fix the root cause and both tend to resolve together.
Malformed markup hiding across your templates?

Duplicate body tags are rarely alone. An audit validates your markup site-wide, traces the doubled template or plugin, and gives you a clean fix list.

Get an Advanced SEO Audit

Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.

About SEO ProCheck

Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.

Work With Me

Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.

Subscribe to our newsletter!

More from our blog