Home / Technical site audit / Invalid HTML DOCTYPE


The DOCTYPE tag means “document type declaration”. It tells web browsers which version of HTML your page is using. You must always prefix your HTML code with the DOCTYPE in the first line of code on the page. By doing this your HTML page will then be compliant with the DOCTYPE selected.

Although modern browsers don't take minor errors in HTML code into account, incorrect DOCTYPE is a more serious problem, as it can affect the availability of your page's content. The 'invalid HTML DOCTYPE' report in Labrika's dashboard allows you to view any pages with these types of errors.

Report Content

The report in Labrika's dashboard will show you a list of URLs where the DOCTYPE is written incorrectly in the code or the sign “No matches found for your query” if there is no a mistake.


Using the report

Once the URLs with incorrect DOCTYPE are identified you can then enter them correctly.

The syntax should be as follows:

<!DOCTYPE [Top-level Element] [Publicity] "[Registration]//[Organization]//[Type] [Name]//[Language]" "[URL]">

What each of these parameters mean:

  • Top-level element - this specifies the top-level element in the document. For HTML, it is the <html> tag
  • Publicity — this indicates whether the object is a public (PUBLIC value) or a system (SYSTEM value) resource such as a local file. For HTML/XHTML, the value PUBLIC is selected.
  • Registration — this shows whether the developer of the DTD (document type definition) is registered with the International Organization for Standardization (ISO). It takes one of two values: plus (+) — the developer is registered in ISO. Or minus (-) — the developer is not registered. For W3C, it is written like this: “-”
  • Organization — the unique name of the organization that developed the DTD. HTML/XHTML is officially published by the W3C (World Wide Web Consortium). The name of this organization is written in the DOCTYPE tag.
  • The type of document being described. For HTML/XHTML, the DTD value is specified.
  • Name — the unique name of the document to describe the DTD.
  • Language — indicates the language in which the text is written. It consists of two letters, written in uppercase. For an HTML/XHTML document for the English language, you would write: (EN)
  • The URL of the document with the DTD.

There are several types of DOCTYPE; they differ depending on the version of the HyperText Markup Language used on the page.

An Example for HTML Version 4.01:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

The HTML5 specification can be written more simply as:

<!DOCTYPE html>