Utility · Apr 15, 2026 · Updated Oct 14, 2026 · 4 min read

Screen Resolution vs Viewport vs Pixel Ratio

Physical pixels, CSS pixels and the viewport explained with measurements from Chromium 141: what a 3x phone reports, which media queries match, and how a canvas drawn without devicePixelRatio scaling had five times as many blurred pixels as one drawn with it.

Physical, CSS and Viewport Pixels

A screen has three sizes worth knowing. The physical resolution is the panel's pixel grid. The CSS (logical) resolution is what pages lay out against, and screen.width reports it. The viewport is the part of the window the page actually gets, innerWidth wide. The device pixel ratio (DPR) links the first two: physical pixels per CSS pixel along each axis. We emulated five common setups in Chromium 141 and read the values a page sees:

Setupscreen.width (CSS px)DPRPhysical width(min-width: 768px)(min-resolution: 2dppx)
Phone 390 px @3x39031,170 pxnomatches
Phone 390 px @2x3902780 pxnomatches
Tablet 820 px @2x82021,640 pxmatchesmatches
Laptop 1440 px @2x144022,880 pxmatchesmatches
Desktop 1920 px @1x192011,920 pxmatchesno

A phone with a 1,170-pixel-wide panel still reports 390 CSS pixels and falls on the phone side of every width breakpoint; media queries never see physical pixels. To target sharp screens, use the resolution media feature (Chrome 29, Firefox 8, Safari 16 per MDN's compatibility data) or srcset for images.

Images and Canvas at High DPR

An image needs about DPR times its CSS width in real pixels to look sharp: 1,200 CSS pixels wide on a 2x laptop means a 2,400-pixel file. Let the browser choose with srcset; our image guide measured which file Chromium picks at 1x to 3x. SVG and icon fonts scale to any DPR on their own.

Canvas is the classic trap. We drew the same text and a 1-pixel line on two 120 × 60 CSS-pixel canvases at DPR 2. The one with a 120 × 60 backing store was stretched by the browser: 2,034 blurred, partly gray pixels and only 38 solid black ones. The one sized to 240 × 120 and scaled with ctx.scale(devicePixelRatio, devicePixelRatio) had 377 gray and 911 black pixels, crisp edges.

const r = window.devicePixelRatio || 1;
canvas.width = cssWidth * r;
canvas.height = cssHeight * r;
canvas.style.width = cssWidth + 'px';
ctx.scale(r, r); // draw in CSS pixels from here on

Breakpoints

Breakpoints are layout decisions, not device categories. Tailwind CSS's defaults are a common reference: sm 640 px, md 768 px, lg 1024 px, xl 1280 px and 2xl 1536 px, all minimum widths in CSS pixels. Set yours where your content starts to look wrong, and test in between them. The Screen Resolution Checker shows your screen, viewport and DPR and highlights which common breakpoint your window falls in; resize the window to watch it change.

Gotchas

Try the tool

See your screen size, viewport, DPR, aspect ratio — live.

Open Screen Resolution Checker →

Frequently Asked Questions

Why is my viewport smaller than my screen?
Browser chrome (tabs, address bar, status bar, scrollbar) takes space. The viewport is only the inner content area. On mobile, the address bar can collapse on scroll, dynamically changing viewport height.
What's the difference between DPR 1 and DPR 2?
At DPR 1 one CSS pixel is one physical pixel; at DPR 2 it is a 2 × 2 block of four. Layout is identical, but images and canvases need twice the pixel width to look sharp; in our test an unscaled canvas at DPR 2 showed about five times as many blurred pixels as one scaled to the DPR.
How do I detect screen orientation changes?
Listen for the 'orientationchange' event on the window object. Or check window.innerWidth vs innerHeight after any resize event.
Does zoom affect my layout?
In Chrome and Firefox, yes: zooming in raises devicePixelRatio and shrinks the CSS viewport, so width media queries can switch layouts. Safari keeps devicePixelRatio unchanged when zoomed, according to MDN's compatibility data, so do not rely on it to detect zoom.
⚡ Try the free Image Upscaler →

Published Apr 15, 2026 · Updated Oct 14, 2026 by Derek Giordano

📚 References & Further Reading
Browse all utility tools →
⚡Screen Resolution Checker→
CSSHow to Calculate Aspect Ratio for Images and Video→ImageHow to Convert SVG to PNG at Any Resolution (2026)→ColorHow to Pick Any Color from Your Screen→CSSHow to Set CSS Aspect Ratio on Any Element→GuideWhat Your User Agent Reveals (And Why It Matters)→