Image pixels vs CSS pixels: size a sharp web image deliberately
Understand source dimensions, displayed CSS size and density targets without confusing high-density web delivery with print PPI.
Read articleWeb design tools
Convert px, rem, em, pt, vw and vh with your own font sizes and viewport dimensions. See every equivalent and share the assumptions.
24 px · 24 CSS px
| Equivalent (px) | 24 |
|---|---|
| Equivalent (rem) | 1.5 |
| Equivalent (em) | 1.5 |
| Equivalent (pt) | 18 |
| Equivalent (vw) | 1.666667 |
| Equivalent (vh) | 2.666667 |
These equivalents use your entered font and viewport sizes. They change when those references change.
For font-size in em, use the parent’s font size; for padding, use the element’s computed font size. rem uses the root font size, except on the root’s own font-size, where the initial font size is the reference.
CSS units do not measure image print PPI or the physical size of your screen. vw and vh use the large viewport; mobile browser controls can cover part of it.
| CSS value | 24 |
|---|---|
| Convert from | px — CSS pixels |
| Convert to | rem — root font |
| Root font size | 16 CSS px |
| Em reference font size | 16 CSS px |
| Viewport width for vw | 1440 CSS px |
| Viewport height for vh | 900 CSS px |
| Equivalent (px) | 24 |
|---|---|
| Equivalent (rem) | 1.5 |
| Equivalent (em) | 1.5 |
| Equivalent (pt) | 18 |
| Equivalent (vw) | 1.666667 |
| Equivalent (vh) | 2.666667 |
Behind the numbers
Convert to CSS px using the source unit’s reference, then divide by the target unit’s reference. 1pt = 96/72 CSS px; 1vw = viewport width/100.
These equivalents apply only to the font and viewport sizes entered. They are not an accessibility audit, a font-height measurement or a physical screen ruler.
Results use the numbers you enter. See the methodology for precision, accepted ranges and sharing behavior.
References checked September 28, 2026. Calculations and worked examples are our own.
Useful answers
Divide CSS pixels by the root font size in CSS pixels. With an 18 px root, 27 px equals 1.5 rem. If that root changes to 20 px, 1.5 rem corresponds to 30 px. Enter the actual root reference instead of assuming 16. When setting the root element’s own font-size in rem, the reference is its initial font size.
rem refers to the root font size. em depends on the element and property: an em value for font-size uses the parent’s font size, while em padding uses the element’s own computed font size. Enter the relevant reference explicitly.
Within CSS, 96 px equals 72 pt, so multiply px by 0.75 to obtain pt. For example, 20 CSS px equals 15 pt. This does not involve the image PPI used for a photo print.
A vw unit is one percent of the relevant viewport width. At a 1200 CSS px viewport, 10 vw is 120 px. At 390 px it is 39 px. The share link includes the viewport used in the calculation.
vh uses the large viewport. Mobile browser controls can cover part of that area. Consider the appropriate small or dynamic viewport units in your design and test in the target browser. This calculator computes the vw/vh references you enter; it does not simulate browser chrome.
A practical next read
Understand source dimensions, displayed CSS size and density targets without confusing high-density web delivery with print PPI.
Read articleWork from your original pixels to a realistic print size, then account for cropping, viewing distance and the file you actually send.
Read articleCompare three familiar print shapes using one 3000 × 2000 photo, with crop dimensions, retained area and orientation explained.
Read articleConvert pixels to inches, cm or mm at any PPI. Convert one measurement instantly, compare a PPI table, or calculate the width and height of an image.
Open toolStart with a physical size and a target PPI. Calculate a whole-pixel canvas with an explicit rounding choice.
Open toolCalculate the DPI (PPI) of an image at your print size: DPI = pixels ÷ inches. Choose a local image or enter its pixels, then compare fit versus crop.
Open tool