Skip to main content

px to rem Converter

Convert pixels to rem, em, dp and sp against any root size, with a full scale table.

Convert freeSign up to copy the scale tableNo usage limits
rem
1.5rem
em
1.5em
dp / sp (Android)
24
pt (iOS @1x)
24
pxrem
110.6875
120.75
130.8125
140.875
150.9375
161
181.125
201.25
241.5
281.75
322
402.5
483
563.5
644

Type a pixel value and get rem, em, and the Android dp and sp equivalents. Change the root size and everything recalculates.

The generated table gives you a whole spacing or type scale at once, rather than converting one value at a time.

What rem is relative to

One rem equals the root font size — the size set on the html element, which browsers default to 16px. So 24px is 1.5rem at the default. The distinction from em matters: em is relative to the current element's font size and therefore compounds through nesting, which is why rem is the safer default for a design system.

Why rem matters for accessibility

A user who raises their default text size expects your app to respond. Sizes set in px ignore that setting entirely; sizes in rem scale with it. On mobile, where a meaningful share of users run larger text, honouring that preference is the difference between a usable app and one they delete.

sp versus dp on Android

Android distinguishes the two deliberately: dp for layout dimensions, sp for text. sp additionally scales with the user's font-size preference, which is exactly why text must never be specified in dp. Using dp for a label is the Android equivalent of hard-coding px for type.

How to use the px to rem converter

  1. Enter the pixel value you are converting.
  2. Leave the root size at 16 unless you have deliberately overridden html { font-size }.
  3. Read the rem value for CSS, and the dp/sp equivalents if you are working on Android.
  4. Use sp for anything that renders text on Android, and dp for everything else.
  5. Copy the whole scale table to seed your spacing or type tokens in one paste.

Use it with

  • Type Scale Generator Build a modular type scale from a base size and ratio, sized for phone screens.
  • Device Size Reference Screen dimensions, logical points, pixel density and safe areas for current iPhones and Android handsets.
  • CSS Grid Generator Lay out rows, columns and gaps visually, place items on the grid, and copy the CSS.

Frequently asked questions

How many pixels is 1rem?
16px by default, because that is the browser's default root font size. If you change html { font-size }, 1rem changes with it — which is why this tool lets you set the root value.
Should I use rem or px for font sizes?
rem. Text sized in px ignores the user's font-size preference entirely, while rem scales with it. This matters more on mobile than desktop, because a significant share of phone users run larger system text.
What is the difference between dp and sp on Android?
Both are density-independent, but sp additionally scales with the user's font-size setting. Use sp for text and dp for everything else — using dp for a label is the Android equivalent of hard-coding px.

Related tools