Skip to content
Omnikalc

PX to REM converter: pixels to rem, em and points for CSS

Enter a size in pixels and the root and parent font sizes to get the value in rem, em, points and millimeters, and convert a rem value back to pixels.

Updated on
Your inputs
px

Value out of range

px

Value out of range

px

Value out of range

rem

Value out of range

Results

Size in rem

1.5000 rem

Size in em
1.2000 em
Size in points
18.00 pt
Share of the root font size
150.0%
Size in millimeters on screen at 96 dpi
6.35 mm
The rem value in pixels
20.00 px

CSS lets you set sizes in pixels, rem, em and points, and designers hand over pixels while developers prefer rem. The px to rem converter takes a size in pixels, the root font size and the parent font size to give the value in rem, em, points, percent of the root size and millimeters, and it converts a rem value back to pixels.

How the calculation works

  • rem = pixels ÷ root font size. The rem unit is relative to the font size of the html element, which is 16 px in most browsers. A size of 24 px is 24 ÷ 16 = 1.5 rem.
  • em = pixels ÷ the font size of the parent element. Unlike rem, em compounds when elements are nested, since each level multiplies the size.
  • Points = pixels × 0.75, because CSS defines 1 inch as 96 pixels and 72 points, so 1 px = 0.75 pt. Millimeters = pixels × 25.4 ÷ 96.
  • Share of the root size = pixels ÷ root size × 100. The last output goes the other way: rem value × root size gives pixels.

Example

With the default root size of 16 px, a size of 24 px is 24 ÷ 16 = 1.5 rem, or 150% of the root size. If the parent text is 20 px, it is 24 ÷ 20 = 1.2 em. It is 18 pt and about 6.35 mm on a screen at 96 dpi. In the other direction, 1.25 rem is 1.25 × 16 = 20 px.

Why it matters

Relative units make a page more accessible, since text and layout follow the size the reader has chosen. A quick conversion avoids mental arithmetic when you move a design from pixels to a flexible CSS, and it shows how a change in the root size affects every value.

Good to know

Remember that rem does not follow the font size of the parent, and em does. If a site sets the root size to something other than 16 px, enter that value. Media queries in em or rem also follow the user’s font size, which many accessibility guides recommend. The millimeter value is for 96 dpi CSS pixels and not the real size on a phone or a high-density screen.

The aspect ratio calculator keeps the proportions of an image and the screen size calculator relates diagonal, width and height.

Frequently asked questions

Why use rem instead of px?

Rem values scale with the font size that the user chooses in the browser, which helps people who need larger text. Sizes in px stay fixed. Using rem for font sizes, spacing and breakpoints respects the user's settings, and it lets you resize a whole interface by changing the root size.

What is the difference between rem and em?

Rem is relative to the root element, so 1.5 rem is the same size everywhere on the page. Em is relative to the font size of the element itself or of its parent, so nested elements with 1.2 em multiply: 1.2 times 1.2 is 1.44. Em suits components that scale with their own text, such as button padding.

What is the default font size?

In almost all browsers the default root size is 16 px, so 1 rem is 16 px. Some sites set html to 62.5%, which makes 1 rem equal to 10 px and simplifies the sums, but it overrides the user's choice if you do not account for it. A better practice is to keep 100% and use calculations.

How many pixels is a point?

In CSS one point is 1/72 of an inch and one pixel is 1/96 of an inch, so 1 pt is 1.333 px and 1 px is 0.75 pt. A font size of 12 pt is 16 px. These are CSS units and not the physical size on your screen, which depends on its pixel density.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.