Skip to content
ToolsOnDuty - free online tools

Search tools

Loading tool search...

CSS & Design

PX to REM Converter

Convert px to rem and em based on the root font size.

Free browser toolRuns in your browserNo sign-up
px
24px
rem
1.5rem
em (at this base)
1.5em

rem is relative to the root font size (default 16px). em is relative to the parent; here it matches rem at the chosen base.

About the PX to REM Converter

rem and em units keep CSS scalable and accessible, but you often start from a pixel value in a design.

This converter turns px into rem and em for your chosen root font size, and works both ways, so you can move between units without doing the maths.

It runs in your browser.

Key features

  • px to rem and em
  • Adjustable root font size
  • Two-way conversion
  • Copy any value

How to use

  1. 1Enter a pixel value.
  2. 2Set the root font size if it is not 16px.
  3. 3Copy the rem or em value.
  4. 4Use a positive, nonzero root size matching your project's computed root font size; this tool does not inspect your site's CSS. Zero is not guarded against and does not give a meaningful conversion.
  5. 5You can also edit rem to calculate pixels. Changing the root size preserves the current pixel value and recalculates rem; results are rounded to four decimal places.

Examples

24px to rem
Input: 24px at 16px root
Output: 1.5rem

Dividing the pixel value by the root font size gives the rem value.

Frequently asked questions

What is the default root font size?
The tool starts at 16px, a common browser default. Browser preferences and your root CSS can change the actual value, so enter the base your project uses.
What is the difference between rem and em?
rem uses the root element's font size. For most other properties, em uses the element's computed font size; in font-size itself, em is relative to the inherited font size. The em card here simply reuses the chosen base, so it only matches your CSS when that context uses the same size.
Why use rem instead of px?
rem makes sizes follow the root font size and can help layouts respond to user font preferences. That benefit depends on how the root is defined; the conversion alone does not make a design accessible.

Open a related tool to prepare your files or refine the finished result.