In short
Ahrefs flags "Viewport not set" when a page has no viewport meta tag. Without it, mobile browsers render the page at a desktop width, around 980px, and shrink it to fit, so text is tiny and the layout breaks. Since Google indexes the mobile version of pages, add this line to the <head> of every page: <meta name="viewport" content="width=device-width, initial-scale=1">.
This is one of the quickest fixes in the whole audit, and one of the most important for mobile visitors.
Why it matters
Google uses mobile-first indexing, so it judges your pages as a phone sees them. A page without a viewport tag is effectively a desktop page on a small screen. Visitors pinch, zoom and leave. A missing viewport tag also causes many of the other mobile issues in this category, like small fonts and small tap targets.
The correct tag
<meta name="viewport" content="width=device-width, initial-scale=1">
Place it inside <head>, once per page. Don't add maximum-scale=1 or user-scalable=no, because they stop people from zooming in, which is an accessibility problem.
Where to add it
WordPress: every modern theme includes it. If it's missing, the theme is very old or a header template was edited. Switch to a maintained theme, or add the tag to the theme's header.php in a child theme.
Shopify: check theme.liquid in Online Store > Themes > Edit code. All current Shopify themes include it.
Webflow: Webflow adds it automatically. If it's flagged, check the page for a custom code embed that overrides the head.
Wix: Wix adds it on its mobile-optimized sites. If it's flagged, check whether the page is served from an old or custom setup.
Custom builds: add it to the shared layout or HTML template so every page inherits it. In React with Vite, put it in index.html. In Next.js, it's added by default.
Common mistakes
Adding the tag when the layout isn't responsive. The tag tells the browser to use the screen width. If the CSS uses fixed widths, you'll then see sideways scrolling instead. See "Content is not sized correctly".
Duplicate viewport tags from a theme plus a plugin. Keep one.
This guide isn't affiliated with or endorsed by Ahrefs.
Related issues
Sources and references
Google Search Central, Mobile site and mobile-first indexing best practices
MDN, Viewport meta tag
web.dev, Responsive web design basics

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.



