Pixel Ruler Online
A pixel ruler measures distances on your screen in pixels (px). Drag the red lines A and B to the two edges of a button, image or gap. You get CSS pixels, real device pixels and an estimate in millimeters.
Tip: arrow keys move the selected line by 1 px, Shift + arrow by 10 px.
CSS pixels vs device pixels
Browsers measure in CSS pixels. On high-density screens one CSS pixel is drawn with several physical pixels: a phone with a device pixel ratio of 3 uses 3 × 3 = 9 physical pixels for each CSS pixel. That is why a 390 px wide iPhone layout is really 1170 pixels wide. The ruler shows both numbers.
What designers use it for
- Checking spacing and alignment of elements on a live page.
- Comparing a build with a design spec (for example “16 px padding”).
- Measuring image sizes before you crop or export.
- Estimating physical size: after you calibrate the mm ruler, the pixel ruler also shows millimeters.
Frequently asked questions
How many pixels are in an inch?
CSS defines 96 px per inch, but the physical size depends on your screen. Use the PPI calculator to find your screen’s real density.
Can I measure something outside the browser?
Not directly. Take a screenshot, open it in measure from a photo, and measure in pixels there.
Why does the pixel count change when I zoom?
Browser zoom changes how many CSS pixels fit on the screen. Measure at 100% zoom for design work.
