Invalid element in <head>
Short answer
Invalid element in <head> means: a tag like <img> or <div> in the head ends it early, so title, canonical and robots tags after it are ignored by Google. To fix it: move that element into the <body>, or place it after all SEO tags.
By the SmooxSEO team. Updated on 16 November 2026.
What it means and why it matters
A tag like <img> or <div> in the head ends it early, so title, canonical and robots tags after it are ignored by Google.
How to fix it
Move that element into the <body>, or place it after all SEO tags.
Common causes
- A tracking script, widget or plugin that inserts an <img>, <div> or <iframe> inside the <head>.
- Text or an unclosed tag at the top of the template.
- A cookie banner or A/B testing tool injected too early.
How to spot it
Open the page source and look between <head> and </head>: only elements like title, meta, link, script, style and base belong there. When the browser meets another element, it closes the head early, so the tags after it (canonical, hreflang, robots) are ignored. SmooxSEO detects where the head ends and which tags were cut off.
Example
<head>
<title>Pricing</title>
<img src="/pixel.gif"> <!-- closes the head here -->
<link rel="canonical" href="https://example.com/pricing"> <!-- ignored -->
</head><head>
<title>Pricing</title>
<link rel="canonical" href="https://example.com/pricing">
</head>
<body>
<img src="/pixel.gif" alt="">
</body>Mistakes to avoid
- Checking only the visible page: everything looks fine, while Google ignores your canonical and hreflang tags.
- Moving tracking tags into the head without checking what they insert.
How serious is it?
A page can't be found, indexed or trusted, or search engines can't read part of the site. Fix it soon: it costs traffic.
About html checks
The basic HTML of each page: valid structure, language, character set and the head section search engines read first.
Find this problem on your site
SmooxSEO checks every page of your site for this problem and 311 others, lists the pages concerned, and tells you what to fix first.