The HTML <!DOCTYPE> tag is used for specifying which language and version the document is using. This is referred to as the document type declaration (DTD).

With the introduction of HTML5, the <!DOCTYPE> tag is mostly useless, as HTML 5 does not require a reference to a DTD. Having said that, for legacy reasons, the HTML5 specification recommends including the <!DOCTYPE> header at the top of all HTML documents.

In HTML5, the <!DOCTYPE> declaration is much simpler than in previous versions of HTML:

<!DOCTYPE html>

Usage Example

The <!DOCTYPE> declaration must go right at the top of the page, before any other HTML code.

<!DOCTYPE html>
   <p>Page content...</p>

Note that the <!DOCTYPE> declaration is case-insensitive.