Skip to content

Technical pillar / check doctype

Doctype: does the page start in standards mode?

We check that each page starts with a doctype, the first line that tells a browser to render the page by current standards. Without it, browsers fall back to an older rendering mode.

By , Founder and CEO, Own The Climb · Last updated

This is how we check it

We check that each page starts with a doctype, the first line that tells a browser to follow current standards.

  • We recommend <!DOCTYPE html>. Supported older doctypes that put the browser in standards or almost-standards mode also pass; whitespace and comments may come first.
  • It fails when the doctype is missing, when other text comes before it, or when an old doctype puts browsers into "quirks mode".

Our reasoning behind this

Without a doctype, browsers can fall back to an older layout mode. We recommend a standard doctype in the template so visitors and rendering crawlers use the intended layout rules.

What a pass and a finding look like in our reports

Each example shows a piece of markup and the finding title our audit uses for it. We explain the example underneath so you can understand the result in your own report.

  • <!DOCTYPE html>
    <html lang="en"><head><title>Estate planning</title></head><body><p>This is an example page about estate planning.</p></body></html>

    PassHTML5 doctype comes first

    The page opens with the standard doctype, so there is nothing here for you to change.

  • <html lang="en"><head><title>Estate planning</title></head><body><p>This is an example page about estate planning.</p></body></html>

    lowNo doctype

    The page starts straight with <html>, so browsers fall back to quirks mode.

How we would fix it on your site

  1. Make <!DOCTYPE html> the very first line of every page template.
  2. Check that no plugin or server message prints anything before it.

Once your change is live, run the audit again and review the new findings alongside the pages it covered.

What we want you to review

  • Remove plugin output or PHP warnings that appear before the doctype.
  • Start the document with a doctype before the html element.
  • Check for stray visible characters before the doctype; a harmless blank line or byte-order mark does not have the same effect.

The exact rules our audit applies

We wrote this part for your developer or your SEO specialist. It sets out the inputs, scoring rules and confidence limits we publish for this check, together with the full explanation of how we would fix a finding.

The inputs we describe for this check

The start of the HTML as we received it. A byte order mark, whitespace and comments may come first, as the HTML standard allows; after them the page must open with <!DOCTYPE html> (an older HTML 4 or XHTML doctype that browsers render in standards or almost-standards mode also passes, with a note).

The check fails when there is no doctype, when text or a tag comes before it, in which case browsers ignore it, or when the identifiers of an older doctype put browsers in quirks mode.

Our full reasoning

The HTML standard says a document consists of an optional byte order mark, "Any number of comments and ASCII whitespace", then "A DOCTYPE", then the html element, and that when the doctype is omitted "browsers tend to use a different rendering mode that is incompatible with some specifications". A page in that mode can lay out differently on phones and in the browsers search engines use to render pages.

How we score what we find

Measured, LOW, on every page we read. A page without a doctype loses little, because most browsers still render it; the fix takes one line.

How sure we are of each result

HIGH: read from the first bytes of the page as we received it, before any script runs.

How to fix it, in full

Make <!DOCTYPE html> the first line of every page template, before the <html> tag and before anything a plugin or your server prints.

The sources we rely on

What we have changed on this page

  • · Rewritten in plain words: what we check, why it matters and how to fix it come first, and the full rules sit one click down. We corrected the full rules to describe only what we check today.
  • · An older doctype whose identifiers make browsers use quirks mode now fails, as the HTML parsing rules say; only ASCII whitespace, comments and an XML declaration may come before the doctype.
  • · Initial publication, part of the checks added to match the free Seobility checker and the gaps our 2026-10-21 benchmark found.