HTML Guides for legacy doctype
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
A legacy doctype triggers this warning because the document uses an older or non-standard <!DOCTYPE> declaration instead of the simple HTML5 doctype.
The HTML5 doctype is <!DOCTYPE html>. It is case-insensitive, short, and tells the browser to render the page in standards mode. Older doctypes, such as those referencing XHTML 1.0 Transitional, HTML 4.01 Strict, or any DTD URL, are considered legacy. They still work in browsers, but the W3C validator flags them because the modern HTML standard requires only <!DOCTYPE html>.
Common legacy doctypes that cause this warning include:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The fix is to replace the entire doctype line with <!DOCTYPE html>. No DTD reference or public identifier is needed.
HTML examples
Before (legacy doctype)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
"http://www.w3.org/TR/html4/loose.dtd"
<htmllang="en">
<head>
<title>Example</title>
</head>
<body>
<p>Hello world</p>
</body>
</html>
After (HTML5 doctype)
<!DOCTYPE html>
<htmllang="en">
<head>
<title>Example</title>
</head>
<body>
<p>Hello world</p>
</body>
</html>
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries