HomeAPI StatusFree ToolsSEO Help Articles

Doctype Test

The Doctype Declaration Test verifies that the very first line of your HTML is <!DOCTYPE html> — the modern HTML5 doctype that triggers standards mode in every browser. Missing or wrong doctypes silently switch the browser into quirks mode, where rendering, layout and JavaScript APIs behave inconsistently. The fix is one line of HTML; the impact is consistent rendering across every browser, ever.

What This Tool Checks

  • Presence of <!DOCTYPE html> as the first content
  • Doctype version (HTML5 vs HTML4 vs XHTML)
  • Standards mode vs quirks mode trigger
  • BOM or whitespace before the doctype
  • Doctype casing variations

Why It Matters for SEO

Quirks mode is the legacy rendering mode browsers use for pages without a valid doctype. It produces inconsistent layouts, breaks modern CSS features (box-sizing, flexbox edge cases, viewport units) and disables some JavaScript APIs. Triggering standards mode with <!DOCTYPE html> at the top of every page is mandatory for predictable rendering.

How to Fix It

Make the first line of every HTML response exactly <!DOCTYPE html> with no preceding whitespace, BOM or content. Save HTML files as UTF-8 without BOM. Audit CMS templates and remove any pre-doctype injection.

How It Works

We fetch the URL's HTML and inspect the first non-whitespace bytes. The doctype declaration must come before any other content (no whitespace, no BOM, no comments) to trigger standards mode reliably.

Common Mistakes to Avoid

  • Missing doctype entirely (triggers quirks mode)
  • BOM bytes before <!DOCTYPE> pushing it out of position
  • Old XHTML doctype declarations on modern HTML5 pages
  • CMS injecting whitespace or comments before the doctype
  • Conditional comments around the doctype for legacy IE

Quick Checklist

  • <!DOCTYPE html> on the first line of every page
  • No BOM or whitespace before the doctype
  • Standards mode triggered in DevTools
  • No legacy XHTML doctypes in production
  • CMS templates audited for clean output

Frequently Asked Questions