PX to REM Converter
Convert CSS pixels to rem and em based on a root font size.
Result
Result (rem)
1.5000
Result (em)
1.5000
How it works
In CSS, a rem is a multiple of the root font size. With the browser default of 16 px, 24 px equals 1.5 rem and 16 px equals exactly 1 rem. This converter divides your pixel value by the base you set. The reason to prefer rem is accessibility. A user who raises their browser's default font size expects the whole interface to scale with it — that happens automatically with rem, while a layout hard-coded in pixels stays stubbornly small and can become unusable. The difference with em is the reference point: em is relative to the *parent* element's font size, so nested elements compound (an em inside an em inside an em shrinks unpredictably), while rem always refers to the root and stays predictable. Common practice: rem for spacing and typography, em for properties that should follow their own element's size, like padding on a button.
Advertisement
Frequently asked questions
Why use rem instead of px?
rem respects the user’s font-size setting, so text and spacing scale for accessibility.
What is the default base?
Browsers default to 16 px for the root font size unless you change it.
What is the difference between rem and em?
rem is relative to the root font size and stays constant everywhere; em is relative to the parent element, so nested values multiply together and can drift unpredictably.
Advertisement