This feature has changed significantly in the HTML5 specification. Be sure to read usage details below.

: It's Code For Declaring A DOCTYPE In HTML5

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Element of
HTML Document Structure Before And After HTML5 – Here’s What Changed
What does : It's Code For Declaring A DOCTYPE In HTML5 do?
The <!DOCTYPE html> declaration is used to inform a website visitor's browser that the document being rendered is an HTML document. While not actually an HTML element itself, every HTML document should being with a DOCTYPE declaration to be compliant with HTML standards.
Null element
This element must not contain any content, and does not need a closing tag.

Declaring a DOCTYPE

All HTML need to have a DOCTYPE declared. The DOCTYPE is not actually an element or HTML tag. It lets the browser know how the document should be interpreted, by indicating what version or standard of HTML (or other markup language) is being used.

HTML5 Documents

For HTML5 documents (which nearly all new web documents should be), the DOCTYPE declaration should be:

<!DOCTYPE html>

This needs to be the first thing in your document, before the <html> or <head> elements. Also, there is no closing tag.

<!DOCTYPE html>

Other DOCTYPES you might encounter

There is virtually no reason to compose new HTML documents in an older standard. However, you may see any of the following document types on legacy systems:

HTML 4.01 Strict


HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

HTML 4.01 Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "">

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

XHTML 1.0 Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "">


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for DOCTYPE