Яндекс.Метрика

Doctype checker

Check whether a page declares an HTML doctype and which version it uses.

0 of 0 ratings

What a doctype is

The doctype declaration appears at the very beginning of an HTML document. It tells the browser which version of HTML the document follows. Modern pages use the short HTML5 declaration, which is simply written as the word doctype followed by html.

This checker looks for a doctype declaration at the start of the page and reports whether one is present.

Why it matters

The doctype determines how the browser renders the page. A missing or outdated doctype can trigger quirks mode, in which the browser emulates old rendering behavior for backward compatibility. Quirks mode can produce unexpected layout differences, inconsistent box sizing and other issues that are hard to debug. A correct doctype ensures standards mode rendering, where modern CSS behaves predictably.

Interpreting the result

If a doctype is found, confirm that it is the HTML5 declaration. Older declarations for HTML 4 or XHTML still work in modern browsers but offer no benefit and can be simplified. If no doctype is found, add the HTML5 declaration as the first line of the document. This is a small change with a meaningful effect on rendering consistency.

Common problems

  • Content or comments placed before the doctype, which can cause the declaration to be ignored.
  • Legacy doctypes copied from old templates without review.
  • A server-side template that omits the doctype on some pages.
  • Typos in the declaration that invalidate it.

Practical note

The HTML5 doctype is backward compatible and triggers standards mode in all modern browsers. Standardizing on it across templates is a safe, low-effort improvement. After changing a doctype, review pages for layout changes, because switching rendering modes can expose styles that depended on quirks behavior.

Similar tools

Deprecated HTML tags checker

Find obsolete HTML tags that should be replaced with modern equivalents.

2
Language attribute checker

Read the HTML lang attribute of a webpage and confirm the declared language.

17
Meta charset checker

Check whether a page declares its character encoding and which charset it uses.

2

Popular tools