GoWin Tools
Tools
← px to rem Converter

px to rem Converter Β· 5 min read

Retina Displays and Device Pixel Ratio: What 2x Actually Means

When Apple called the iPhone 4 display 'Retina,' they invented a new category of display and a new problem for web developers. Here is how device pixel ratio works and what it means for designing web content.

The Retina Claim

Apple introduced the term "Retina display" with the iPhone 4 in June 2010. The marketing claim: at the display's intended viewing distance (approximately 10–12 inches for a phone), the pixel density is high enough that the human eye cannot resolve individual pixels. The display appears continuous rather than pixelated β€” "retina quality" because it matches or exceeds the resolving power of the human retina at normal viewing distance.

The iPhone 4's display had 326 pixels per inch (ppi) β€” exactly double the 163 ppi of the iPhone 3GS. This doubling was not accidental: it maintained perfect backward compatibility. Every image and element that had been one CSS pixel wide now appeared at the same visual size but was rendered with four times as many physical pixels (2Γ—2), appearing noticeably sharper.

What Device Pixel Ratio Means

Device Pixel Ratio (DPR) is the ratio of physical pixels to CSS pixels:

DPR = physical pixels / CSS pixels

On a DPR=2 display:

  • A 100Γ—100 CSS pixel element is rendered with 200Γ—200 physical pixels
  • A CSS pixel is 2Γ—2 physical pixels
  • An image specified at 100px wide needs to be 200 physical pixels wide to appear sharp

DPR values encountered in practice:

  • 1.0: Most desktop and laptop monitors at default scaling (standard 1080p, many 4K at 100% scale)
  • 1.25, 1.5: Some Windows laptops with medium-density displays at default scaling
  • 2.0: MacBook Retina displays, iPhone 8/SE, many iPad models, high-DPI desktop monitors at 200% scale
  • 2.75, 3.0: iPhone Plus/Pro Max models, many Android flagships (Samsung Galaxy S series, Pixel phones)
  • 4.0: Some high-end Android phones

The Sharp Image Problem

When high-density displays became mainstream, web images faced a problem: a 100Γ—100 pixel image displayed at 100 CSS pixels on a DPR=2 display would be stretched to 200Γ—200 physical pixels by the display hardware β€” making it appear blurry. The same image that looked sharp on a 1x display appeared noticeably blurry on a Retina display.

Web developers had to provide high-resolution versions of images for high-density displays. HTML5 introduced two mechanisms for this:

  • srcset attribute: Allows multiple image versions to be specified with their DPR or width descriptor. The browser selects the appropriate version based on the device's DPR and display size.
  • CSS image-set(): Allows CSS background images to specify multiple resolution versions.

A typical responsive image tag for Retina support:

<img src="image.jpg"
     srcset="image.jpg 1x, [email protected] 2x, [email protected] 3x"
     width="300" height="200">

The browser downloads only the appropriate resolution version β€” a mobile with DPR=3 gets the 3x image; a desktop with DPR=1 gets the standard image. This saves bandwidth on low-density displays while providing sharpness on high-density ones.

SVG: The Density-Independent Alternative

The cleanest solution to the DPR problem for many graphic types is SVG (Scalable Vector Graphics). SVG is a vector format β€” it describes shapes mathematically rather than storing pixel values. A SVG image scales to any display density with perfect sharpness, because the rendering engine draws the shapes at the physical pixel level regardless of DPR.

For icons, logos, illustrations, and charts that can be represented as vector graphics, SVG eliminates the multi-resolution image problem entirely. An SVG icon at any DPR appears as sharp as the display can render. The growth of SVG usage in web design since 2012 is partly driven by the need to handle Retina and high-DPI displays without maintaining multiple image versions.

CSS and DPR: Media Queries

CSS media queries allow stylesheets to respond to DPR, enabling CSS-based solutions to the high-density display problem:

/* Standard resolution */
.logo {
  background-image: url('logo.png');
}

/* High-density displays (DPR >= 2) */
@media (min-resolution: 192dpi),
       (-webkit-min-device-pixel-ratio: 2) {
  .logo {
    background-image: url('[email protected]');
  }
}

The min-resolution: 192dpi query matches any display with at least 192 dpi, which corresponds to DPR=2 at the standard 96 dpi CSS reference density. Modern browsers also support the simpler (resolution: 2dppx) syntax (dppx = dots per CSS pixel).

DPR and rem Units

An important property of rem units: they are DPR-independent. A font-size: 1rem specifies a size in CSS pixels, which is then multiplied by DPR by the browser before rendering. The text appears at the correct visual size on both 1x and 3x displays β€” the browser handles the DPR scaling automatically.

This means the px-to-rem question is entirely about CSS pixels, not physical pixels. Whether you write 16px or 1rem, the browser scales both appropriately for the display's DPR. The choice between px and rem is about user scalability (whether the user's font-size preference affects the element) β€” not about display density compatibility.

Convert px to rem β†’

References

  1. Apple Inc. (2010). iPhone 4 Technical Specifications. apple.com.
  2. Apple Inc. (2012). Retina Display Marketing. apple.com.
  3. W3C. (2021). CSS Images Module Level 3: image-resolution. W3C.
  4. MDN Web Docs. (2023). Using media queries: resolution. developer.mozilla.org.
  5. Marcotte, E. (2011). Responsive Web Design. A Book Apart.