The HTML doctype
type: TechArticle
description: Every HTML document must start with as its first line. This opts the browser into standards mode; without it, you get quirks mode and broken layout.
language: en
is part of: Web Specification Studio
author: Web Specification Studio
publisher: Web Specification Studio
license: https://creativecommons.org/licenses/by/4.0/
date modified: 2026-07-09T00:00:00.000Z
citation: HTML Living Standard — The DOCTYPE
  type: CreativeWork
  publisher: WHATWG
citation: MDN — Doctype
  type: CreativeWork
  publisher: MDN
citation: MDN — Quirks Mode and Standards Mode
  type: CreativeWork
  publisher: MDN

Web Specification Studio
type: WebSite

Web Specification Studio
type: Organization

breadcrumb
type: BreadcrumbList
item list element: Home
  type: ListItem
  position: 1
  item: https://webspecification.com/
item list element: Spec
  type: ListItem
  position: 2
  item: https://webspecification.com/spec/
item list element: Foundations
  type: ListItem
  position: 3
  item: https://webspecification.com/spec/foundations/
item list element: The HTML doctype
  type: ListItem
  position: 4
  item: https://webspecification.com/spec/foundations/doctype/