Your monitor has 3840 physical pixels across. Your browser reports innerWidth of 1280. Your phone says DPR is 3. None of these numbers is wrong.
They are measuring different layers of the same stack: the glass on your desk, the operating system's scaling policy, and the coordinate system CSS uses for layout. Mix them up and you ship blurry images, wrong breakpoints, or a layout that looks fine on your laptop and breaks on a Retina MacBook.
This post walks through each layer in order: what DPR actually is, why CSS pixels exist, how Retina displays fit in, how PPI differs from DPI, what monitor scaling percentage to pick, and what browser zoom does on top of all of it.
What is device pixel ratio (DPR)?
Device pixel ratio is the number of physical device pixels used to draw one CSS pixel.
In JavaScript you read it as window.devicePixelRatio. A value of 1 means one CSS pixel maps to one physical pixel. A value of 2 means each CSS pixel is rendered with a 2×2 block of physical pixels (four device pixels total). A value of 3 means 3×3 (nine device pixels).
On an iPhone 15, the CSS viewport width is about 393px and DPR is 3. The physical pixel width of that viewport is roughly 393 × 3 = 1179 device pixels. The panel has more pixels than that (status bar, full screen resolution), but the math for layout is always: CSS size × DPR ≈ physical pixels in that region.
DPR answers one question: "How sharp should my assets be relative to my layout size?"
It does not tell you how big the screen is in inches. It does not tell you how wide your browser window is. For those, you need PPI and viewport width respectively.
You can read your live DPR with our device pixel ratio checker.
Why CSS pixels differ from screen resolution
Screen resolution (e.g. 2560×1440) counts physical pixels on the panel.
CSS pixels are the unit browsers use for layout, media queries, and window.innerWidth. They are intentionally not always 1:1 with physical pixels.
The scaling layer in between
Modern operating systems apply display scaling so text stays readable on high-density panels. Windows at 150% on a 4K monitor does not give you a 3840px-wide desktop. It gives you a logical desktop width of about 2560 CSS pixels, while the GPU still drives 3840 physical pixels.
Same panel, two numbers:
| Layer | Example (27" 4K at 150% scaling) |
|---|---|
| Physical resolution | 3840 × 2160 |
| CSS / logical width | ~2560 × 1440 |
| DPR | ~1.5 |
On phones the same idea applies, but the OS and browser hide most of it. You see a viewport of 390px wide with DPR 3, not a 1170px-wide layout with tiny text.
Three widths developers confuse
| API | What it is | Typical use |
|---|---|---|
| screen.width | Physical display width in CSS pixels (often the same as device width on mobile) | Device capability, analytics, "is this a phone?" |
| window.innerWidth | Width of the browser viewport in CSS pixels (scrollbar included) | Layout breakpoints, responsive CSS, "how much space do I have?" |
| window.devicePixelRatio | Ratio of physical pixels to CSS pixels | Sharp images, canvas resolution, "do I need @2x assets?" |
screen.width describes the display in CSS pixels (after OS scaling on desktop). It usually stays fixed when you resize the browser window.
window.innerWidth is the layout viewport: the horizontal space your CSS actually uses right now. It changes when the user resizes the window or when mobile browser chrome appears and disappears.
Physical pixel width for the viewport is approximately innerWidth × devicePixelRatio. That is the number you care about when picking @2x or @3x image assets.
For a live readout of all three, use our viewport checker. For the JavaScript implementation angle, see our viewport vs screen width vs DPR code guide.
How Retina displays work
Apple coined Retina for screens where individual pixels are hard to see at normal viewing distance. The marketing term maps to a practical rule: pack enough physical pixels into each inch that curves and text look smooth, not stair-stepped.
Retina is not a single resolution. It is a density strategy:
- The panel has a high physical resolution (lots of device pixels per inch).
- The OS reports a lower logical resolution to applications (CSS pixels).
- DPR bridges the gap: logical × DPR = physical pixels used for rendering.
A 13-inch MacBook Air with a 2560×1664 panel might report roughly 1280×832 CSS pixels at DPR 2. You design layouts at 1280px wide. The GPU renders at 2× density so type and icons stay sharp.
What Retina means for web developers
- Layout and breakpoints use CSS pixels (
innerWidth, media queries). Do not multiply by DPR for responsive layout. - Raster images and canvas need DPR-aware sizing. A 200×200 CSS pixel image on a 2× display needs a 400×400 source file to look sharp.
- SVG and real text scale cleanly because they are vector or font-rendered. DPR matters less for those.
Phones pushed this further. Flagship devices commonly run DPR 2.5–3.0 with CSS viewports around 360–430px wide. That is why a 400px-wide hero image looks soft on a phone if you only serve a 400px-wide file.
PPI vs DPI vs DPR: three different questions
These three acronyms get thrown together. They answer different questions.
| Term | Measures | Question it answers |
|---|---|---|
| PPI (pixels per inch) | Physical pixels per inch of panel | "How sharp is this hardware?" |
| DPI (dots per inch) | Ink dots per inch (print) | "How fine is this print?" (often misused for screens) |
| DPR (device pixel ratio) | Physical pixels per CSS pixel | "How much should I scale my assets for this browser?" |
PPI is a property of the display: resolution divided by diagonal size in inches. A 6.1-inch phone at 2556×1179 lands around 460 PPI. A 27-inch monitor at 2560×1440 is about 109 PPI. Same pixel count on a bigger panel means lower PPI and visibly larger pixels.
DPI belongs to printing. A 300 DPI photo has 300 ink dots per inch. People say "DPI" for monitors colloquially, but PPI is the correct screen term. When a spec sheet says "326 DPI" for a phone, they mean PPI.
DPR is a runtime browser value. It can change with zoom. Two monitors with identical PPI can report different DPR if OS scaling differs.
None of these replaces the others:
- Shopping for a sharp monitor? Look at PPI (or use our PPI calculator). Deep dive: PPI vs DPI explained.
- Serving images or drawing canvas? Read DPR.
- Confused about print vs screen density? DPI is print; PPI is the screen equivalent.
More hardware context: screen resolution vs size vs pixel density.
Best monitor scaling for readability (Windows and macOS)
OS scaling picks the compromise between usable UI size and sharp text. There is no universal "best" percentage. There is a best choice per panel size and resolution.
Quick reference by panel
| Monitor | Resolution | Approx. PPI | Recommended scaling | Why |
|---|---|---|---|---|
| 24" | 1920×1080 | ~92 | 100% | Text is already large enough; scaling blurs slightly on some setups |
| 27" | 2560×1440 | ~109 | 100% (Windows) / Default (macOS) | The developer sweet spot: sharp at native scaling |
| 27" | 3840×2160 | ~163 | 150–200% | UI is tiny at 100%; 150% is the usual starting point |
| 32" | 3840×2160 | ~138 | 125–150% | More physical space; slightly less scaling than 27" 4K |
| 15" laptop | 1920×1080 | ~141 | 100–125% | Depends on eyesight; 125% is common |
| 15" laptop | 3840×2160 | ~283 | 200% | 100% is unreadable for most people |
Rules that actually help
Prefer whole-number scaling when you can. 100%, 125%, 150%, and 200% tend to produce cleaner results than 110% or 175%. Fractional scaling on Windows and some Linux desktops can make text look slightly fuzzy because the GPU interpolates.
Match scaling to viewing distance. A 32-inch panel on a deep desk can run lower scaling than a 27-inch panel at arm's length.
Test your real workflow before committing. Open a terminal, your IDE, and a browser at the scaling you plan to use. "Looks fine in Settings" and "readable during an eight-hour debug session" are different bars.
Dual monitors: match effective size, not just resolution. Two 27-inch 1440p panels at 100% feel consistent. A 1080p secondary beside a 4K primary at 150% needs alignment tuning or you will drag windows between mismatched text sizes.
Use our monitor size calculator to see what your current setup reports.
How browser zoom works (and why it breaks your assumptions)
Browser zoom is a second scaling layer on top of OS scaling. It affects layout, DPR, and sometimes both at once.
What zoom changes
At 100% browser zoom on a typical setup:
window.innerWidthreflects the layout viewport in CSS pixels.devicePixelRatioreflects OS + browser density policy.
When you zoom in (e.g. 150% in Chrome):
- Layout grows. Effective CSS pixels shrink from the page's perspective:
innerWidthdrops because fewer CSS pixels fit in the same physical space. A 1200px breakpoint may suddenly match "mobile" layout on a desktop window. - DPR may change. Chrome and Firefox often adjust
devicePixelRatiowhen zooming so content stays sharp. You might see DPR go from 2 to ~2.6 at 130% zoom.
When you zoom out, the reverse happens: more CSS pixels fit, breakpoints flip the other direction.
Zoom vs OS scaling
| Control | Who sets it | What it affects |
|---|---|---|
| OS display scaling | Windows / macOS / mobile OS | Global logical resolution, base DPR |
| Browser zoom | User per tab | Viewport width, effective font size, sometimes DPR |
| Pinch zoom (mobile) | User gesture | visualViewport size, scroll position, often not innerWidth |
Mobile Safari adds another wrinkle: the URL bar showing or hiding changes the visual viewport without always changing innerWidth. That is why 100vh misbehaves on phones and why dvh exists. Our CSS viewport units tool measures the difference live.
Practical takeaway for developers
- Test responsive layouts at 100% browser zoom first. That is the baseline users expect when they hit your site.
- If your audience skews accessibility-heavy or older demographics, also test 125% and 150% zoom. Breakpoints will shift.
- Never hard-code
devicePixelRatio === 2for asset selection. Read it at runtime or usesrcsetwithxdescriptors and let the browser choose. - When debugging "it looks blurry only on my machine," check zoom level before rewriting image pipelines.
How the layers stack (from glass to CSS)
Physical panel (3840×2160, ~163 PPI)
↓
OS scaling (150% → ~2560×1440 logical)
↓
Browser (reports innerWidth, devicePixelRatio)
↓
Browser zoom (125% → smaller innerWidth, DPR may shift)
↓
Your CSS layout (media queries, rem, vw)
Each step can change the numbers your JavaScript reads. That is normal. The mistake is treating screen.width or a spec-sheet resolution as "the" width your CSS should target.
FAQ
What is a good device pixel ratio?
There is no "good" DPR. 1 is standard desktop. 2 is common on Retina Macs and many laptops. 2.5–3 is typical on modern phones. Higher DPR means you need higher-resolution image assets for the same CSS display size.
Why does my 4K monitor show less than 3840px width?
OS display scaling reduces the logical desktop size so UI elements stay readable. At 150% on 3840×2160, you get roughly 2560 CSS pixels of width, not 3840.
Is DPI the same as PPI on a monitor?
Not technically. DPI is a print term (ink dots). PPI is pixels per inch on a display. In everyday speech people mix them up. For screens, say PPI.
Does browser zoom change devicePixelRatio?
Often yes, especially in Chromium-based browsers. Zoom can adjust DPR so text and images stay sharp while layout dimensions change. Always read DPR at runtime if you are sizing canvas or picking image URLs in JavaScript.
What monitor scaling is best for coding?
For a 27-inch 1440p panel, 100% scaling is the most common sweet spot among developers (~109 PPI, sharp text, no fractional blur). For 27-inch or 32-inch 4K, start at 150% and adjust to taste.
How do I check my current DPR and viewport?
Use our free tools: DPR checker for devicePixelRatio, viewport checker for innerWidth and safe-area insets, and breakpoint checker to see which CSS breakpoints match your width.
Put it together
Physical resolution, CSS pixels, DPR, PPI, OS scaling, and browser zoom are not competing definitions. They are different layers of the same display stack.
For layout, trust CSS pixels and media queries. For image sharpness and canvas, multiply by DPR. For hardware shopping and sharpness comparisons, use PPI. For desktop comfort, pick OS scaling you can read all day without fractional blur.
When the numbers on your screen do not match the spec sheet, that is usually scaling working as designed, not a bug in your monitor.
Related Articles
Continue reading with these related posts
Understanding Screen Resolution: Why Pixels Matter
A comprehensive guide that helps readers make informed decisions about screen resolution across different devices. The 1500-word blog post breaks down the confusion around technical specifications like 1080p, 4K, and pixel density.
Common Screen Resolutions: A Complete Guide to Choosing the Right Fit for Your Needs 📺
Explore screen resolutions—HD to 4K. Find the perfect fit for gaming, streaming, or designing. Optimize your visual experience with our complete guide! 📺
Best Monitor Size for Developers: Choose the Right Screen for Coding and Productivity
Most developers land on a 27-inch 1440p monitor, but the right answer depends on your desk, workflow, and how many panes you keep open at once. This guide breaks down size, resolution, and setup trade-offs so you can stop guessing.
