Free Device Pixel Ratio Calculator
Calculate the ratio between physical screen pixels and logical CSS pixels for retina & high-DPI displays
Device Pixel Ratio Calculator
DPR = 2
Physical Pixels = Logical Pixels × 2
Common Device Presets:
Understanding Device Pixel Ratio (DPR)
The Device Pixel Ratio (DPR) — also known as CSS pixel ratio or Retina scale factor — measures the relationship between a display's physical hardware pixels and its logical CSS pixel units. Before high-density screens were introduced, there was a direct 1:1 mapping: one CSS pixel represented exactly one physical hardware pixel. Modern high-res screens pack multiple hardware pixels inside each logical layout coordinate to make text and graphics look incredibly sharp.
The Mathematical Formula
To find the device pixel ratio of any display, divide the physical screen resolution width or height by the reported logical CSS resolution:
DPR = Physical Pixels ÷ Logical (CSS) Pixels
For example, the classic **iPhone 15 Pro** has a hardware resolution width of exactly 1179 physical pixels, but its logical screen layout width is set to 393 CSS pixels:
This means that for every single pixel block specified in your CSS stylesheet, the smartphone's screen hardware lights up exactly 9 physical pixels (a 3×3 physical pixel square) to render your UI.
Common Device DPR Reference Table
Compare physical screen dimensions, logical sizes, and exact device pixel ratios across modern popular devices:
| Device Model | Logical CSS Size | Physical Resolution | DPR Factor |
|---|---|---|---|
| Desktop (Standard) | 1920 × 1080 | 1920 × 1080 | 1.0x (1x) |
| MacBook Pro 14" | 1512 × 982 | 3024 × 1964 | 2.0x (2x) |
| iPhone 15 (Base) | 393 × 852 | 1179 × 2556 | 3.0x (3x) |
| iPad Pro 12.9" | 1024 × 1366 | 2048 × 2732 | 2.0x (2x) |
| Samsung Galaxy S23 | 360 × 780 | 1080 × 2340 | 3.0x (3x) |
| Google Pixel 8 Pro | 384 × 832 | 1344 × 2912 | 3.5x (3.5x) |
CSS and JS Implementation for High-DPI Screens
To prevent raster graphics and images from looking blurry on standard 2x and 3x retina displays, always supply responsive multi-density resources.
In **HTML**, use the srcset attribute to offer high-DPI options:
In **JavaScript**, dynamically inspect the system's current device pixel ratio factor:
console.log(`Current screen DPR: ${dpr}x`);