Skip to content
Announcing the new Pro Zone. Check it out!

DOCTYPE in HTML – What Is a Document Type Declaration?

A DOCTYPE declaration informs browsers about a document’s type and version.

Example of an HTML Document with a Doctype Declaration

The <!DOCTYPE html> preamble in the snippet below tells web browsers that the page is an HTML5 document type.

<!DOCTYPE html>
<html>
<head>
<title>Your document's title</title>
</head>
<body>
<!-- Space for the documents's content such as <p>, <div>, and <img> elements -->
</body>
</html>

Note the following:

  • A <!DOCTYPE> declaration is not an HTML tag. It is a preamble for declaring information about a document to web browsers.
  • It is essential to declare your document type before defining other HTML elements.
  • The <!DOCTYPE> declaration is case-insensitive. So, browsers interpret <!DOCTYPE>, <!doctype>, <!Doctype>, and <!DocType> as equivalent document type declarations.