Skip to content
Nazmul Nikhil
Menu

Doctype Not Declared (Semrush): Add <!DOCTYPE html>

Semrush flags pages without a doctype. Browsers then render in quirks mode, which can break layouts. The fix is one line at the top of the HTML.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Doctype Not Declared (Semrush): Add <!DOCTYPE html>
Photo: Fotis Fotopoulos on Unsplash

In short

Semrush flags "Doctype not declared" when a page doesn't start with a doctype. Browsers then use "quirks mode," which mimics very old browser behavior and can change how layouts and sizes render. Add <!DOCTYPE html> as the first line of the page template.

The doctype is the very first line of an HTML page. Without it, browsers fall back to old rendering rules.

The fix

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">

Nothing, not even a blank line or a comment, should come before it ideally.

Where it goes missing

  • Old themes or hand-coded templates.

  • PHP warnings or stray output printed before the template starts.

  • Pages built by hand outside the CMS (landing pages, old static files).

WordPress: check header.php in your theme, and look for plugins printing output early. Shopify: check theme.liquid. Webflow and Wix: added automatically; flags usually point to custom-coded files. Custom builds: add it to the base layout.

This guide isn't affiliated with or endorsed by Semrush.

Sources and references

TAGSSemrush Site AuditSemrush doctype not declaredMissing doctypeQuirks mode
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with Technical SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Site Audit Issues posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com