Why your on-screen ruler is probably the wrong size
15th Oct 2026 · 4 min read
When I started building the ruler for this site, the first thing I found out might sound odd: a web page has no idea how big your screen is. It knows how many pixels it has to work with, but not how many of them fit in an inch. That one gap is why many online rulers show the wrong size.
Where “96 pixels per inch” comes from
CSS, the language that styles web pages, defines one inch as 96 CSS pixels, and one centimeter as 96 ÷ 2.54 of them. That is a convention, not a measurement. It exists so layouts come out consistently across devices, and the documentation on MDN is upfront that a CSS inch may not match a real one on screen.
So a ruler that simply asks the browser for “1 inch” gets 96 CSS pixels, and has no way to know what that measures in your hand.
Real screens disagree
How many pixels fit in an inch depends on the panel. Pixel density (PPI) is the screen’s diagonal in pixels divided by its diagonal in inches. A few examples:
- A 24-inch 1080p monitor: about 92 PPI
- A 13.3-inch laptop at 2560 × 1600: about 227 PPI
- A typical flagship phone: roughly 460 PPI
Modern screens also draw one CSS pixel using several device pixels, a ratio the browser calls the device pixel ratio. It keeps text sharp, but it doesn’t reveal the screen’s size either. It says how many device pixels make a CSS pixel, not how big the screen is.
The result is that the same 96 CSS pixels come out as different real-world lengths:
What a ruler has to do instead
To draw a true inch, a ruler needs one real-world fact about your screen. There are three common ways to get it:
- Your device model. Look up its screen size and resolution.
- Your screen’s diagonal. You type it in, and the ruler works out the pixel density with the formula above.
- A known object. Hold a bank card against the screen and match it to an outline.
The third is usually the most reliable. Standard bank cards follow the ISO/IEC 7810 ID-1 size, 85.60 × 53.98 mm (3.370 × 2.125 in), and you’re checking against your actual screen instead of trusting a spec sheet or a guess.
A ruler can also guess from your resolution and pixel ratio. That’s a fair starting point, but it’s still an estimate.
Things that still throw it off
- Browser zoom. Zooming changes how big a CSS pixel is. Keep zoom at 100%, and recalibrate if you change it.
- A different screen. Calibration belongs to one display, so an external monitor needs its own.
- Reading at an angle. The glass and display layers sit slightly apart, so look straight at the screen.
- Phone edges. Rounded corners and screen protectors can shift where zero lands, so measure along a flat stretch of the edge.
How accurate is accurate?
Once calibrated, an on-screen ruler is good for everyday measuring: a coin, a screw, a printed photo. It isn’t a substitute for a physical measuring tool when tolerances matter, and I’d rather say that than promise precision a screen can’t give.
If you try the bank-card check and the numbers look off on your device, I’d like to hear about it via the contact page.