PX to Inch Converter

CSS pixels to inches at the anchored 96 to the inch, with the 72-point publishing inch alongside it and what a real display does to both.

Enable JavaScript to customise; default output below.

Only affects the physical reality section. 96 is the CSS reference, 163 a 27-inch 4K, 227 a 13-inch MacBook Pro, 460 a current phone.

Live preview length.txt
1,920.0000px = 20.0000in

1,920.0000px in every absolute unit
  px                                        1,920.0000  ← in
  in                                        20.0000  ← out
  cm                                        50.8000
  mm                                        508.0000
  pt                                        1,440.0000
  pc                                        120.0000

The definitions these come from
  1 inch                                    96px, 2.54cm, 25.4mm, 72pt, 6pc
  1mm                                       3.779528px
  1cm                                       37.795276px
  1pt                                       1.333333px, which is why 12pt is 16px

Those 1,920.00 CSS pixels on a real screen
  at 96 ppi                                 20.0000in, 50.8000cm
  the CSS answer assumes                    96 ppi
  so the real length is                     100.0% of the CSS one
  on a 1080p 24-inch monitor                530.09mm
  on the CSS reference pixel                508.00mm
  on a 27-inch 4K monitor                   299.19mm
  on a 13-inch MacBook Pro                  214.84mm
  on an iPhone 15                           106.02mm

The absolute units in CSS are defined against each other, not measured:
one inch is exactly 96 pixels, 2.54 centimetres, 25.4 millimetres, 72
points and 6 picas. So 1,920.0000px is 20.0000in exactly, and no screen
is involved in that conversion.

A CSS pixel is not a device pixel and not a physical length. It is about
1/96 inch on a 96 ppi monitor and about a quarter of that on a phone,
where the browser draws one CSS pixel with several device pixels. That
is the whole reason `1cm` in a stylesheet does not measure a centimetre
on screen.

Physical units belong in a print stylesheet, where the browser knows the
paper size and the conversion means something. In a screen stylesheet
they are a slower way of writing pixels, and they break when a reader
zooms.

The inch has been exactly 2.54 centimetres since the international
agreement of 1959. Rounding it to 2.5 is an error of 1.6 percent, which
is four millimetres across a sheet of A4 and enough to lose a bleed.

12pt is 16px, and that is where the browser default font size comes
from. A point is 1/72 inch in publishing and CSS keeps that definition,
which is why type specified in points from a design tool converts to
pixels cleanly.

`rem` and `em` are the units to reach for in a stylesheet. They scale
with the reader's font size, which is a preference that people set
deliberately and that fixed physical units ignore.

For anything that will be printed, work in millimetres and set the
resolution separately. The pixel dimensions needed follow from the print
size and the resolution, and a file specified in pixels alone has no
physical size at all.

Output is valid and updates as you type.

96 pixels is one inch, by definition, in CSS. 72 points is one inch, by definition, in publishing. Both are true and they are the source of most of the confusion about type sizes.

It is why 12pt comes out as 16px, which is the default font size in every browser. It is also why a number taken from a print design converts cleanly into CSS: the two systems share the inch, so a point is exactly 1.3333 pixels.

What neither of them shares is any relationship with a real screen. 1,920 CSS pixels is 20 inches according to CSS, about 8.5 inches on a MacBook Pro, and about 4 on a phone.

How to use

  1. Put in the pixel value.
  2. Read the inch figure and the point figure, which is the one type specs use.
  3. Set your screen’s density to see the physical length.

Example

A 1,920-pixel design width:

1,920.0000px = 20.0000in

1,920.0000px in every absolute unit
  px                                        1,920.0000  ← in
  in                                        20.0000  ← out
  cm                                        50.8000
  mm                                        508.0000
  pt                                        1,440.0000
  pc                                        120.0000

The definitions these come from
  1 inch                                    96px, 2.54cm, 25.4mm, 72pt, 6pc
  1pt                                       1.333333px, which is why 12pt is 16px

Those 1,920.00 CSS pixels on a real screen
  at 96 ppi                                 20.0000in, 50.8000cm
  on a 27-inch 4K monitor                   299.19mm
  on a 13-inch MacBook Pro                  214.84mm
  on an iPhone 15                           106.02mm

Twenty inches wide in CSS. Eight and a half on the laptop most designers are looking at it on.

Pitfalls

96 for pixels, 72 for points. Confusing the two is a 33 percent error, and it is the most common mistake when moving type sizes between a print tool and a stylesheet. 12pt is 16px, 9pt is 12px, 18pt is 24px.

The inch in CSS is not an inch on screen. It is 96 CSS pixels, which is roughly an inch only on a 96 ppi display. Every current laptop and phone is denser, so the physical length is smaller.

A “72 dpi” image is not low quality. It is the same pixels as a “300 dpi” one; only a metadata field differs. The number in an image header does not change the image, and browsers ignore it entirely.

Do not use in in a screen stylesheet. It is a fixed multiple of pixels with a misleading name. If you want a fixed size, write pixels; if you want it to respect the reader, write rem.

Inches are correct in print CSS. @page { size: 8.5in 11in } is exactly how to specify US Letter, and within @media print all the physical units behave properly.

Points in CSS are not points in a PDF viewer’s ruler. They agree at 72 to the inch, but a PDF’s user space and CSS’s px grid can be scaled differently by the software in between, so verify a critical measurement on the output rather than in the stylesheet.

Compatibility

Arithmetic in the browser: nothing is uploaded and nothing is stored.

The relationships used are the exact CSS ones: 1in = 96px = 2.54cm = 25.4mm = 72pt = 6pc. Browsers implement them identically because the units are anchored to each other rather than to hardware, and every pair is round-tripped in the test suite.

The 12pt-to-16px identity is checked explicitly, because it is the one conversion people rely on and the one that reveals a 72-versus-96 mistake immediately.

Screen densities in the output are real hardware figures, included so that the difference between the CSS inch and a physical one is visible.

Frequently asked questions

How many pixels in an inch?
96 CSS pixels, by definition. In device pixels it is the display’s actual density, which is between about 90 and 500 on current hardware and is not reported to a web page.
Why is 12pt 16px?
Because a point is 1/72 inch and a CSS pixel is 1/96 inch, so a point is 96/72 = 1.3333 pixels, and 12 × 1.3333 = 16. The browser default font size is 16px for exactly this reason.
Should I specify font sizes in points?
Not for screen. Use rem, so type scales with the reader’s chosen size. Points are the right unit in a print stylesheet and in print design tools.
Is 300 dpi the same as 300 ppi?
They get used interchangeably, and strictly no: DPI is dots of ink and PPI is pixels. For artwork requirements the asker almost always means PPI, and the DPI to PPI converter on this site explains where the difference bites.
How do I convert a Photoshop measurement?
Check the document resolution first. A 72 ppi document’s pixel dimensions map one-to-one to CSS pixels; a 300 ppi document’s do not, and the physical size in inches is the number to carry across.
Weekly drops

New tools, when there are new tools

One email when something worth using ships. No schedule to fill, so no filler.

Your address goes nowhere else, and one click unsubscribes.