Skip to content
WEB DEVELOPMENT TOOLS

CSS Unit Converter – px, rem & em

Convert px, rem and em using a chosen base size.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

CSS Unit Converter

About CSS Unit Converter

CSS has absolute units such as px and relative units such as rem and em. A rem is relative to the root font size of the page, which is 16px by default in most browsers, and an em is relative to the font size of the element or its parent.

Enter a number and set the base font size in the options. The tool shows what that number is as px converted to rem and as rem converted to px in a single result. Change the base size if your project sets html { font-size: 62.5% } or another value.

How to use CSS Unit Converter

  1. Enter a number in the input box.
  2. Set the base font size in pixels if your project does not use 16.
  3. Click Run Tool and read the px and rem results.

Example

Input

24

Output

24px = 1.5rem
24rem = 384px

Common uses

  • Turning pixel values from a design file into rem for a scalable layout.
  • Checking what a rem value from a stylesheet means in pixels.
  • Working out values when the root font size is 10px or another custom size.

Privacy and safety

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Frequently asked questions

When should I use rem instead of px?

Use rem for font sizes, spacing and breakpoints so the layout scales when users change their browser font size, which is important for accessibility.

How is em different from rem?

An em depends on the parent element, so nested em values multiply. A rem always depends on the root, which makes it easier to predict.

What base size should I use?

Browsers default to 16px. Use that unless your CSS sets a different root font size.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.