---
title: "Start every page with the doctype · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/html-basics/doctype
updated: 2026-10-20
licence: "All rights reserved"
---

# Start every page with the doctype

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [HTML basics](https://agentwranglers.se/playbook/website/html-basics)
- Rule: Start every HTML page with `<!doctype html>` as its very first bytes, so browsers use standards mode (the modern, predictable way of laying out pages).
- How: Put `<!doctype html>` in the one template every page shares. That includes error, maintenance and offline pages. Make the build fail if any page does not start with it.
- Check: `curl -s URL | head -c 15` prints `<!doctype html>`. Lighthouse's `doctype` audit passes.
- Measured: On a reference site, removing it dropped Lighthouse Best Practices from 100 to 96.

Example:

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Page name · Example</title>
  </head>
  <body>…</body>
</html>
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/html-basics/doctype`.

- Next: [Say the page's language](https://agentwranglers.se/playbook/website/html-basics/html-lang)
- [HTML basics](https://agentwranglers.se/playbook/website/html-basics)
