Sitewalk / Guides / Mobile / Viewport meta tag

Viewport meta tag: the right value and zoom fix

For most responsive sites the right viewport meta tag is one line: width=device-width, initial-scale=1. Leave out user-scalable=no and any maximum-scale below 2, because they tell the browser to limit zoom.

Here is the full line to place inside the head of every page:

<meta name="viewport" content="width=device-width, initial-scale=1">

The rest of this guide shows how to check yours, what each setting does, and what to repair when a page still looks wrong on a phone.

What the viewport meta tag does

The viewport is the area of the browser window where your page can be seen. MDN explains that some phones lay a page out in a virtual window wider than the screen, then shrink the result to fit. Its example uses a virtual width of 980 pixels.

That shrinking helps old desktop pages stay visible. It hurts a page built for phones, because style rules written for narrow screens may never apply. The viewport tag tells the browser which width to lay the page out for.

If the tag is missing, a phone can show your desktop layout in miniature. Text becomes tiny and people have to pinch and drag to read it.

Settings and whether to keep them

SettingWhat it doesOur advice
width=device-widthMatches layout width to the screenKeep
initial-scale=1Starts at 100% zoomKeep, it is a safe default
viewport-fit=coverFills the whole display, including around cutoutsUse only with safe area padding
maximum-scale=5Caps zoom at 5 timesAllowed, but you can just leave it out
maximum-scale=1Caps zoom at the starting sizeRemove
user-scalable=noAsks the browser to turn zoom offRemove
width=600 or another fixed numberSets a fixed minimum layout widthRemove on a responsive page

MDN says browser settings can ignore maximum-scale and user-scalable, and that iOS 10 and later ignores them by default. So a locked tag may seem harmless when you test on one phone. Another visitor's browser may obey it.

Why blocked zoom matters

Some people can only read text when it is bigger. MDN warns that setting user-scalable to no prevents people with low vision from reading and understanding the page.

The web accessibility guidelines, called WCAG, include a rule named Resize Text (1.4.4, level AA). It asks that text can be resized up to 200 percent without losing content or features. Captions and images of text are the stated exceptions. MDN adds that enabling zoom up to 5 times is the better practice.

On search, be careful with big promises. Google says it uses the mobile version of a site for indexing, so the phone version of your page should carry the same content and headings as the desktop one. We did not read a Google statement that a zoom setting changes rankings, and we make no such claim. The reason to fix it is the person who needs larger text.

How to check your viewport meta tag

For one page, open it in a desktop browser, open the developer console, and paste this:

document.querySelector('meta[name="viewport"]')?.content

It prints the value of the first viewport tag, or undefined if there is none. On our home page on 26 Nov 2026 it returned width=device-width, initial-scale=1, viewport-fit=cover.

To check several pages at once, save this as zoomcheck.py:

import sys, urllib.request
from html.parser import HTMLParser

class Viewport(HTMLParser):
    def __init__(self):
        super().__init__()
        self.tags = []
    def handle_starttag(self, tag, attrs):
        a = dict(attrs)
        if tag == "meta" and (a.get("name") or "").lower() == "viewport":
            self.tags.append(a.get("content") or "")

def verdict(content):
    pairs = {}
    for part in content.replace(";", ",").split(","):
        if "=" in part:
            k, v = part.split("=", 1)
            pairs[k.strip().lower()] = v.strip().lower()
    problems = []
    if pairs.get("user-scalable") in ("no", "0"):
        problems.append("user-scalable turns zoom off")
    try:
        if float(pairs.get("maximum-scale", "10")) < 2:
            problems.append("maximum-scale is below 2")
    except ValueError:
        problems.append("maximum-scale is not a number")
    return ", ".join(problems) or "zoom allowed"

for url in sys.argv[1:]:
    req = urllib.request.Request(url, headers={"User-Agent": "viewport-check"})
    html = urllib.request.urlopen(req, timeout=15).read().decode("utf-8", "replace")
    p = Viewport()
    p.feed(html)
    if not p.tags:
        print(url, "| no viewport tag")
    for c in p.tags:
        print(url, "|", c, "|", verdict(c))

Run it with the pages you care about:

python3 zoomcheck.py https://example.com/ https://example.com/contact/

We ran it on four local test pages and our home page. It passed the standard tag and maximum-scale=5, reported both problems on a locked tag, and reported the page with no tag. It reads the HTML as the server sends it, so a tag changed later by JavaScript will not show. It stops with an error if a page does not load.

Check one page of each type: home page, article, product page, form and checkout. Different templates often carry different tags.

How to fix it

  1. Find where the tag comes from. Search your theme or layout files for name="viewport".
  2. Replace its value with width=device-width, initial-scale=1.
  3. Make sure each page has one viewport tag. If two appear, remove the extra one at its source.
  4. Clear your page cache and any CDN cache.
  5. Load the page on a phone and pinch to zoom.

Here is the before and after for the most common problem:

<!-- before: limits zoom -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

<!-- after: zoom works -->
<meta name="viewport" content="width=device-width, initial-scale=1">

In a website builder or CMS, the tag usually comes from the theme, and sometimes from a plugin or a pasted code snippet. Change it there. Adding a second tag in a header box leaves two instructions on the page.

When the layout breaks after the fix

Some teams lock zoom to hide a layout problem, and a correct tag can bring it into view. A common cause is one element that is wider than the screen.

Switch your browser to a phone view, then run this in the console. It lists the elements that stick out past the right edge:

[...document.querySelectorAll('body *')].filter(el => el.getBoundingClientRect().right > document.documentElement.clientWidth + 1)

On a test page 375 pixels wide with a banner fixed at 900 pixels, this check found the banner. This style change cleared it:

.banner { width: 100%; max-width: 900px; }

In our test the old width was written on the element itself. Delete such an inline width first, or the new rule will not win. Wide tables and code blocks often need their own scrolling box. Treat the list as a starting point, since an element inside a scrolling box can appear in it on purpose.

Symptom on a phoneLikely causeFirst thing to try
Whole page looks tinyTag missing or fixed widthUse the standard tag
Sideways scrollingOne element too wideRun the console check
Pinch does nothingZoom limit in the tag or touch scriptsRemove the limit, then test scripts
Text overlaps when enlargedFixed height boxesLet boxes grow with their text
Menu covers the pageFixed menu too tallAllow it to scroll or close

Check it worked

  1. Run the script again. Each page should show one tag and zoom allowed.
  2. Pinch to zoom on a real phone, on more than one browser if you can.
  3. Zoom a desktop browser to 200% and confirm nothing is cut off or covered.
  4. Fill in and send a test form while zoomed.
  5. Run the audit again and confirm the finding is gone.

Phone pages have other common faults. Images that jump while loading are covered in our guide on images without width and height. Content that appears only after scripts run is covered in the guide on pages that need JavaScript. For link and picture text, see images without alt text.

What Sitewalk found on real sites

Counted on 26 Nov 2026: 10 of 103 eligible audited sites (9.7%) had a viewport tag that blocks zoom. Eligible means the site's audit ran with this check, which was added on 4 Nov 2026.

The same count found 2 of 133 audited sites with at least one page that loaded normally and had no viewport tag. It is a small early user group, a first look and not a survey.

Questions people ask

What is the best viewport meta tag?

For a responsive site, use width=device-width, initial-scale=1. Add other settings only when you have a specific reason and have tested it.

Is user-scalable=no bad?

Yes for most pages. It asks the browser to stop people zooming, which people with low vision rely on. Some browsers ignore it, but you should not count on that.

What maximum-scale value is safe?

Leaving it out is simplest. Sitewalk flags values below 2. MDN describes a 5 times zoom as the better practice if you do set one.

Where do I put the viewport meta tag?

Inside the head element of every page. In a CMS or builder it is normally set once in the theme or layout.

Does a viewport tag make a site responsive?

No. It sets the layout width. Your styles still have to fit text, images, tables and menus into that width.

Check your whole site in one sentence

Audit example.com for technical SEO problems

Get started

Checked on 26 Nov 2026. Sources: MDN viewport meta reference, W3C Understanding Resize Text and Google mobile-first indexing, read on 26 Nov 2026. Sitewalk counts are from audits counted on 26 Nov 2026.

More guides

All guides