Pixel Ruler

Drag to measure any region in pixels. Width, height and diagonal in CSS pixels, plus device pixels and viewport percentages. No calibration needed.

Pixel measuring surface

Width

Height

Diagonal

Device pixels · share of viewport

Drag anywhere on the surface to measure a region. With it focused, the arrow keys resize the selection by 1 px, or 10 px with Shift held. Rulers along the top and left edge are marked in CSS pixels. Double-click to drop a guide line for checking alignment.

 

Advertisement
Ad slot (enable after AdSense approval)

Measuring in pixels, exactly

This is the one tool on the site that needs no calibration, and the reason is worth understanding. Every other tile converts pixels into physical units, and that conversion depends on knowing your display's real pixel density. A pixel ruler skips the conversion altogether. It measures pixels in pixels, so the answer is exact on any screen, at any density, with nothing to set up first.

Drag anywhere on the surface to draw a region and the readouts follow. The rulers along the top and left edges are graduated every 10 px with labels every 100, and the selection extends guide lines into both gutters so you can read a span directly off the scale. Prefer the keyboard? Focus the surface and use the arrow keys, one pixel per press or ten with Shift. Turn on the crosshair for live coordinates, and double-click to drop a guide line wherever you want to check alignment.

CSS pixels, device pixels, and why both matter

A CSS pixel is a layout unit, not a physical dot. On a standard display the two coincide. On any high-density screen a single CSS pixel gets painted using several device pixels, four at 2× and nine at 3×. The device pixel ratio is the number connecting them, and it appears beneath the surface for whatever display you are reading this on.

For front-end work the consequence is simple enough: you lay out in CSS pixels and export raster assets at the device-pixel size. An icon occupying 24 CSS pixels needs 48 px of real image data to look sharp on a 2× display, which is the whole reason srcset and @2x assets exist. Both figures sit side by side here so you are not doing that multiplication in your head.

The viewport percentages serve a related purpose. When you are converting a fixed-width mockup into responsive CSS, knowing an element is 20% of the viewport width is more directly useful than knowing it is 240 px, because it translates straight into vw and vh.

Advertisement
Ad slot (enable after AdSense approval)

What a browser-based pixel ruler cannot do

It can only measure inside its own page. A web page cannot see other windows, other tabs or your desktop. That isolation is a deliberate and important security boundary rather than a limitation to route around. Measuring a native application's interface, or anything else outside the browser, calls for a desktop screen-ruler app with the right system permissions.

Within those bounds this is exact. For physical units instead of pixels, the online ruler converts using your screen calibration, and the screen size checker reports resolution, pixel ratio and density together in one place.

Frequently Asked Questions

How do I measure pixels on screen?
Drag across the surface above to draw a region. Width, height and diagonal are reported in CSS pixels as you go. The rulers along the top and left edges are marked every 10 px with labels every 100, so you can also read a span straight off them.
What is the difference between CSS pixels and device pixels?
A CSS pixel is the unit your stylesheet works in. A device pixel is a physical dot on the panel. The device pixel ratio bridges the two: at 2×, one CSS pixel is drawn using four device pixels. You design in CSS pixels and export assets at the device-pixel size, which is why this tool reports both.
Does this tool need calibration?
No, and that is deliberate. Calibration exists to convert pixels into physical units such as millimetres. This tile measures pixels as pixels, so it is exact whatever your display. If you want centimetres or inches instead, use the online ruler.
Can I measure something outside the browser?
Not from a web page. A browser cannot see other windows or your desktop, and that isolation is a security boundary rather than an oversight. Measuring a native application needs a desktop screen-ruler app. Inside a page, this tool is accurate.
Why does the measurement change when I zoom?
Zooming rescales CSS pixels against device pixels, so the device-pixel figure and the ratio both change while the CSS-pixel measurement of the same on-screen distance stays put. Reset zoom with Ctrl+0 or Cmd+0 if the numbers surprise you.
What is the percentage of viewport for?
It converts your measurement into vw and vh units, which helps when you are turning a fixed-size design into responsive CSS. A 240 px element on a 1200 px viewport is 20 vw.
What are the crosshair and guides for?
The crosshair follows your pointer with live coordinates, which is handy for reading an exact position rather than a span. Double-click anywhere to drop a dashed guide line, then use it to check that several things line up. Clear them all with one button.
Can I use the keyboard?
Yes. Focus the surface and the arrow keys resize the selection by one pixel, or ten with Shift held. Home restores the default region. Dimensions are announced to screen readers as they change.