CSS Pixel Converter Calculator

rem and em are both relative units used for font sizes, but there is an important difference. rem (root em) is based on the font-size of the HTML root element, so it is not affected by inheritance. em is based on the parent element's font-size, so it changes with the parent and is affected by inheritance.

Therefore, rem is always based on the root element's font-size and is not affected by inheritance, while em is based on the parent element's font-size and is affected by inheritance. As a trend, rem is now the more commonly used unit.

CSS Pixel Converter

Difference between points and pixels

In CSS, points (pt) and pixels (px) are both units of length, but they differ greatly in purpose when producing designs.

  • Point (pt): the point is a length unit mainly used in print. One point is about 1/72 inch (0.0139 inch). It is mainly used in print design and documents such as PDFs.
  • Pixel (px): the pixel is the smallest unit used on a screen. Its physical size can vary with screen resolution, but generally 1px represents one pixel on the screen. It is mainly used in web design to size screen elements on monitors and mobile devices.

As a result, points are mainly used for print specifications, while pixels are mainly used for screens such as websites.

Differences between px, rem, and em in CSS and how to use them

A pixel is a unit representing a physical dot on the screen.

Pixels (px)

  • Pixel (px): the pixel is the smallest unit used on a screen. Its physical size can vary with screen resolution, but generally 1px represents one pixel on the screen. It is mainly used in web design to size screen elements on monitors and mobile devices.
  • It represents a fixed size. In the browser, a pixel value does not change when the user zooms in or out.
  • Mainly used for setting the size of a specific layout or adjusting detailed, fixed design elements.
  • Example: width: 200px;, font-size: 14px;

rem(root em)

  • rem is short for "root em" and is based on the font-size of the html root element. It represents a size relative to the root font-size setting, so it scales when the user zooms in or out.
  • Mainly used for setting overall layout or font size.
  • Example: font-size: 1.2rem;, margin: 0 1rem;

em(Emphasized)

  • em is basically the same as rem in nature. The difference is that it is calculated relative to the size of the configured parent element, not the HTML root.
  • Example: width: 200px;, font-size: 14px;

Recently, with responsive design in mind, rem is mainly used because relative sizing is often needed, while pixels (px) are used when a specific element's size must be exact. For overall page styling or responsive design, it is good practice to use rem or em.

If not set, it automatically becomes 16px.

Result

Pxcel (px) : 0
Root em (rem) : 0
Emphasized (em) : 0

About This Calculator

CSS relative units (rem and em) scale with font size, while pixels are fixed. Converting between them is essential for responsive layouts and for meeting accessibility guidelines, since users who enlarge text change the root font size.

Enter a pixel value and a base font size to convert px into rem or em, and back again.

CSS pixels are a logical unit rather than a physical one: the browser assumes 96 CSS pixels per inch, and on a 2× display each CSS pixel is painted with four physical pixels. The root font size defaults to 16px, so 1.5rem is 24px, and setting the html element to 62.5 % makes 1rem equal 10px. Sizes expressed in rem respect the reader who enlarges the browser font.

Key Formula:rem = px / root font size (usually 16 px)

Frequently Asked Questions

What is the difference between rem and em?

rem is relative to the root element's font size, so it stays consistent everywhere. em is relative to the parent element's font size, so it compounds in nested elements and can produce surprising sizes.

Should I use px or rem in CSS?

rem is generally preferred for font sizes and spacing because it respects the user's browser font-size setting, which improves accessibility. px is still fine for borders, shadows and other hairline details.

When should I use rem instead of px?

Use rem for type and spacing so the layout follows the user font-size setting, and px for hairline borders and fixed breakpoints. Mixing both without a rule is what produces inconsistent spacing across components.

How do I convert points from a print design to CSS pixels?

Divide by 0.75. A 12 pt design font is 16 CSS pixels and 24 pt is 32 pixels, because points are 1/72 inch while CSS pixels are 1/96 inch.

Related Calculators

Sources & last update

2026-10-19