How screen units relate
CSS defines fixed ratios between its units: 1 inch = 96 CSS pixels and 1 cm = 96 ÷ 2.54 ≈ 37.80 CSS pixels. A browser draws a CSS inch as 96 × device pixel ratio physical pixels.
That is only a real inch if the device's scaling happens to match its true pixel density, which is rare. Phones, laptops and external monitors all differ, and browser zoom changes the result, so an uncalibrated ruler in cm or inches is an approximation.
Calibrating for real-world size
Bank-card method: a standard payment or ID card (ISO/IEC 7810 ID-1) is 85.60 mm wide. Adjust the outline until it matches a real card held against the screen. If the match is 320 CSS pixels, then 1 inch = 320 ÷ 85.6 × 25.4 ≈ 94.95 CSS pixels.
PPI method: if you know your screen's physical pixels per inch (from its specification or the PPI calculator), CSS pixels per inch = PPI ÷ device pixel ratio. A 326 PPI phone at DPR 2 draws an inch as 163 CSS pixels.
| Unit | CSS pixels |
|---|---|
| 1 inch | 96 |
| 1 cm | 37.795 |
| 1 mm | 3.780 |
| 1/16 inch | 6 |
Using the ruler
Move the pointer over the ruler to read the position. Pixel mode marks every 10 px with labels every 100 px; centimeter mode marks millimeters; inch mode marks sixteenths.
Calibration is not saved and applies only while the page is open. Recalibrate after zooming or moving to another screen.