Viewport Width vs Device Width: A Practical Explanation

Updated November 2026. Testers often say “the phone is 1,080 pixels wide” and then wonder why a page designed at 1,080 CSS pixels looks huge on that same phone. The hardware width, the layout viewport and the visual viewport are not automatically the same number. This article is a practical explanation of viewport width vs device width explained for people who check real sites on Android, using the official live viewport readout and width presets in the free Dev Browser app from My Advisers. Official presets include 390, 820, 1,366, 1,920 and 2,560 pixels, plus custom widths. Those figures are CSS layout widths you can reproduce, not a claim about one manufacturer’s physical panel.

How a desktop layout behaves when you force a large width on a phone is in this blog’s guide to testing a website’s desktop layout on an Android phone. How a user-agent string can make a server or a script pick a different template is in the guide to what a user-agent switch does in mobile testing. Use those two with this one: width, user agent and a live readout are separate official test conditions, and you should change only one of them at a time when you are hunting a layout bug.

Viewport width vs device width explained, starting from what the browser actually uses

Device width, in everyday speech, is often the manufacturer’s pixel count — 1,080, 1,176, 1,440 — or the width printed on a shop label in millimetres. CSS layout does not usually work in those hardware pixels. On a typical modern phone, several hardware pixels are mapped to one CSS pixel. The ratio is the device pixel ratio (sometimes discussed as the “2x” or “3x” screen). A panel that is 1,080 hardware pixels wide can have a CSS width near 390 if the ratio is about 2.76. Those two numbers are both “widths,” and they answer different questions. The first is about the screen’s physical pixel grid. The second is about the CSS coordinate system in which width: 390px and a 390-pixel official Dev Browser preset live.

The layout viewport is the width the page’s CSS uses for layout, including media queries such as max-width: 600px. If a page includes a standard responsive tag such as <meta name="viewport" content="width=device-width, initial-scale=1">, the layout viewport is tied to the device’s CSS width (the “device-width” in that tag is a CSS width, not automatically the hardware pixel count). If that meta tag is missing, many mobile browsers fall back to a much wider layout viewport — historically around 980 CSS pixels on some engines — and then shrink the whole laid-out page to fit the screen. The result can look like a tiny desktop site, even though the hardware width never changed. Official Dev Browser’s live viewport readout is there so you can see the width the page is actually using in that session, rather than guessing from the box on the shop shelf.

The visual viewport is the part of the layout you can see at this moment. When a visitor pinches to zoom, or when the on-screen keyboard covers the lower part of the page, the visual viewport can be smaller than the layout viewport. A position:fixed bar that looks correct at the layout width can sit under a keyboard or drift when the visual viewport changes. MDN’s documentation is the standard public reference for this distinction; this article uses it as a conceptual source and then ties the measurement to official Dev Browser tools you can run on a phone. Official Dev Browser is a complement to desktop tools, not a full replacement for Chrome DevTools.

So a practical glossary for a QA note is: hardware or “device” pixels (the panel), CSS device-width (the CSS pixels used by a proper viewport meta tag), layout viewport (the CSS width the page lays out to), visual viewport (what is on screen now), and the official live readout and presets you used. Write which of those you measured. “Looks fine on a 1,080p phone” is not a complete report if you have not recorded the CSS width and the zoom state.

How to use official Dev Browser presets without mixing up the numbers

Official presets of 390, 820, 1,366, 1,920 and 2,560 pixels give you a repeatable CSS width. 390 is a common phone-sized CSS width; 820 is a common large-tablet or small-laptop breakpoint; 1,366 and 1,920 are common desktop CSS widths; 2,560 is a wide desktop. They are not a promise that every phone, tablet or monitor in India uses those exact figures. If your site’s real breakpoint is 768 or 1,024, add that figure as an official custom width and test it on purpose. The official live viewport should then match the width you asked for, unless a page or a zoom state is doing something else. If the live readout and the preset disagree, write both numbers down before you change anything else.

A worked path: a WordPress landing page “breaks” on a colleague’s phone. In official Dev Browser, set the 390-pixel preset, confirm the official live viewport reads 390 (or record the actual readout if it does not), and look at the hero image and the menu. If the layout is a squashed desktop, view the page source or inspector and check for a responsive viewport meta tag. If the tag is present and the 390-pixel layout is fine, but the colleague’s hardware still looks wrong, you may have a visual-viewport or zoom issue, or a user-agent branch, not a “device width” bug. Switch only the official user agent next, at the same 390-pixel width, and see whether a different template loads. Then repeat at 1,366 pixels. That sequence isolates CSS width from UA sniffing from zoom.

TermWhat to record in a QA noteOfficial Dev Browser hook
Hardware pixel widthThe panel figure, if you mention it at allNot the same thing as an official 390-pixel preset
CSS device-width / layout viewportThe CSS width the page laid out toOfficial live viewport readout; official presets and custom widths
Visual viewportZoom state and whether a keyboard was openRe-check the live readout after zoom or a form focus
User agentWhether you left it default or switched itOfficial user-agent switch, changed on its own step

Fixed, sticky and 100vw elements are where layout and visual viewports often diverge. A full-width row that uses 100vw can be slightly wider than the layout viewport when a vertical scrollbar is present, and it can also misbehave when the visual viewport zooms. Prefer CSS that follows the layout width, then confirm at an official phone preset and at an official desktop preset. Official Dev Browser also includes an official SEO inspector and a JavaScript console; those are different tools. A missing viewport meta tag can be an on-page issue you also catch in an HTML pass, but the live width readout is still the measurement that tells you what CSS just did.

Do not treat a single official preset as “all Androids.” Test at least one official phone width and one official desktop width, plus any custom breakpoint your theme actually uses. If a page is still in staging, official private tabs and a noindex check belong in that session, as this blog’s staging article describes; they do not change the definition of viewport width, but they do change how you should treat the URL.

Media queries follow the layout viewport, not the hardware pixel count and not, in the usual CSS, the visual viewport after a pinch-zoom. A query written as @media (max-width: 600px) is true or false in CSS pixels of the layout viewport. If a missing official viewport meta tag has left the layout viewport at a wide fallback, the query may think the phone is a desktop, and a “mobile” CSS branch will never run. The official live readout is how you confirm that situation in one glance. After you add a proper width=device-width tag, re-measure at the official 390-pixel preset and at your official custom breakpoint, because the same stylesheet can suddenly apply the phone branch you had never seen on that handset.

Device pixels still matter for image sharpness. A 390 CSS-pixel hero that is only 390 hardware pixels wide can look soft on a 2.5× or 3× panel. Supplying a larger official image, or a srcset, is an asset question, not a viewport-preset question. Conversely, shipping a 3,000-pixel image into a 390 CSS-pixel slot can harm performance without changing the official live width at all. Measure layout at official presets first, then measure weight with the official PageSpeed Insights shortcut if you are already doing a performance pass; this article will not treat that official shortcut as a viewport tool.

Two labelled worked numbers help a QA note stay honest. Phone A is advertised as 1,080 × 2,400. If its official CSS width in a standard viewport is 360 or 390, write that CSS width and, if you know it, the ratio (1,080 / 360 = 3, or 1,080 / 390 ≈ 2.77). Phone B is the same official 390-pixel Dev Browser preset on a tablet-sized panel you are using only as a test bench. The official CSS width is still 390, even though the hardware is large. If a bug reproduces on Phone A at CSS 390 and also at the official 390-pixel preset, you have a layout-width bug. If it reproduces only on Phone A’s default user agent, you may have a UA branch. That is the point of not mixing the words “device width” and “viewport width” in the same sentence without a definition.

Document the official test so a colleague can repeat it: URL, official preset or custom width, official live readout, zoom state, official user-agent setting, and whether a private official tab was used. A screenshot alone rarely contains those facts. If you later open official desktop DevTools, start from the official readout you already have, and set the desktop emulator to the same CSS width, so you are not debugging two different viewports under one bug title.

If you write acceptance criteria for a designer or a developer, state them in CSS pixels and official presets, not in hardware marketing names. “The primary official menu must be usable at the official 390-pixel preset, with the official live viewport recorded, and at 1,366 pixels” is a test you can repeat. “Looks fine on a flagship phone” is not. When a bug ticket includes a screenshot, add the official readout to the official ticket body so the next person does not have to guess the official width from the official picture alone.

Frequently asked questions

Is a 1,080-pixel phone the same as a 1,080 CSS-pixel layout?

Usually not. Hardware pixels and CSS pixels differ by the device pixel ratio. Use the official live viewport, not the shop-label panel size, when you describe a layout bug.

What does width=device-width mean?

In the common responsive viewport tag, it asks the browser to set the layout viewport to the device’s CSS width. It does not by itself print the hardware pixel count into your stylesheet.

Do official Dev Browser presets change the physical screen?

No. They set a CSS width for the test. The official live readout is how you confirm what the page used.

Should I test only at 390 pixels?

No. Official presets also include tablet- and desktop-sized CSS widths. Add a custom width if your theme’s breakpoint is not in the preset list.

Is this a full DevTools replacement?

No. Official Dev Browser complements a desktop. Use it to reproduce and record widths on Android, then continue on a desktop when you need a deeper CSS inspector.

Disclaimer

This article is for education only. It is not a specification of every browser engine, and it is not a guarantee that every phone uses a 390 CSS-pixel width. Confirm current official Dev Browser features on the official product page. Record the official live readout in any QA note that talks about width.

References

  1. My Advisers, Dev Browser (official product page and guide, including live viewport and official width presets): https://myadvisers.in/dev-browser/.
  2. MDN Web Docs, discussion of the layout viewport and the visual viewport (conceptual reference): see the current MDN viewport documentation on developer.mozilla.org.

Comments

Popular posts from this blog

Google Ads Campaign Management for Small Businesses in India (2026)

10 Best No-Code Website Builders for Beginners in 2026

Technology Consulting for Small Business Digital Growth in India