What is !DOCTYPE in HTML5?

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). This is compliant to trigger standards mode in all modern browsers and will work in any browser.

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.

<!DOCTYPE html>
<title>HTML5 page title</title>
HTML5 page content