Two tiny tags that decide how every page renders
The viewport meta tag and the character encoding declaration are two of the smallest pieces of markup on a page, and two of the most consequential. Get them right and nobody notices: the page fits a phone screen and every character displays as intended. Get them wrong and the symptoms are obvious: a shrunken desktop layout on mobile that people have to pinch to read, or text full of garbled symbols where accented letters, curly quotes and emoji should be.
This checker fetches the page, reads the viewport tag and the charset from both the HTML and the HTTP Content-Type header, and checks placement. Because both tags are set once in a template and then forgotten, they are exactly the kind of thing a redesign or framework migration breaks across thousands of pages at once.
width=device-width, initial-scale=1 and why it matters
The viewport tag tells a mobile browser how wide to lay out the page. With width=device-width, initial-scale=1, the browser uses the phone's real width, so your responsive CSS and media queries work. Without the tag, mobile browsers assume a desktop-sized canvas of about 980 pixels and zoom the whole page out to fit, producing tiny text and tap targets.
Google indexes the mobile version of pages (mobile-first indexing), so a page that renders as a desktop miniature on phones is judged as a poor mobile page. Google retired its standalone Mobile-Friendly Test and the Search Console mobile usability report in late 2023, but Lighthouse still checks for a viewport tag, and the user experience problem is the same either way. For a broader mobile check, use the Mobile-Friendly Test.
Five viewport problems the checker flags
No viewport tag at all, the most serious case. Missing width=device-width, so the layout width is not tied to the screen. Zoom disabled through user-scalable=no or a maximum-scale below 5, which stops people with poor eyesight from enlarging text and fails accessibility guidelines (iOS Safari ignores it anyway). A fixed pixel width such as width=1024, which forces a non-responsive layout. And more than one viewport tag, usually a theme and a plugin both adding one, where browsers apply whichever they read last.
UTF-8, the first 1024 bytes and the Content-Type header
The charset tells the browser how to turn bytes into characters. The modern answer is UTF-8, which covers every language plus symbols and emoji; the HTML standard requires UTF-8 for new documents. When the declaration is missing or wrong, the browser has to guess, and a wrong guess produces mojibake: strings like "é" where "é" should be.
Placement matters. A <meta charset> tag only counts if it sits within the first 1024 bytes of the document, so it belongs as the very first element in the head, before the title and any scripts. The checker looks for it there. It also reads the charset in the server's Content-Type header, because a charset in the HTTP header overrides the meta tag. If the two disagree, the header wins and the page can be decoded wrongly even though the HTML looks correct, so the checker reports any mismatch.
The correct head, in order
Charset first, viewport second, then everything else:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page title</title>
...If you control the server, also send Content-Type: text/html; charset=utf-8 so the header and the tag agree. You can see the header your server sends today with the HTTP Header Checker.
# Nginx: add charset=utf-8 to text responses
charset utf-8;
charset_types text/html text/css application/javascript text/plain;
# Apache (.htaccess or virtual host)
AddDefaultCharset UTF-8Fixing the tags on WordPress, Shopify or a custom site
WordPress
Almost every theme prints both tags in header.php or the block theme template, and WordPress sets the charset from Settings (it should be UTF-8). If the checker finds two viewport tags, a plugin is adding a second one; disable that plugin option rather than editing core files. For an old theme with no viewport tag, add it with a header code plugin such as WPCode, or in a child theme's header.php right after the charset line.
Shopify
Both tags live in layout/theme.liquid. Open Online Store, Themes, Edit code, and check that <meta charset="utf-8"> is the first line inside the head and the viewport tag follows it. Shopify sends a UTF-8 header itself, so a mismatch usually means a hard-coded legacy charset in the theme.
Next.js and other frameworks
Next.js adds both tags automatically; adjust the viewport with the viewport export rather than a manual meta tag, which would create a duplicate. Static site generators normally include them in the base layout, so fix it there once.
Where broken encoding usually comes from
A file saved in one encoding but declared as another is the classic cause, for example a template edited on a system that defaults to Windows-1252 but labelled UTF-8. Content stitched together from several sources, such as a database with a legacy collation, an imported CSV or an API response, can corrupt just one field while the rest of the page looks fine. These problems only show on non-ASCII characters, so test pages with accented names, currency symbols and emoji.
What garbled text does to search engines and AI answers
Search engines and AI systems read your page as text before they summarise or quote it. If the encoding is wrong, names, technical terms and prices arrive mangled, and a garbled passage is a poor candidate to quote. Correct UTF-8 is the baseline that makes your content readable by machines at all. To see how your page reads once the markup is stripped away, try Page to Markdown.
After fixing anything here, re-run the check, load the page on a real phone to confirm it fills the screen without sideways scrolling, and add this check to your post-launch routine. Both tags are template-level settings, so one careless deploy can remove them from every page at once.