Frontend Tools
PX to REM Converter (and REM to PX)
Convert px to rem and back using any root font size, plus em, % and pt. 24px is 1.5rem at the default 16px root, and a px to rem chart is included.
How to use PX to REM Converter (and REM to PX)
Enter a value, choose the units to convert from and to, and set the root font size, 16px by default. For em and %, add the parent font size if it differs from the root. The swap button reverses the direction.
- Enter the value and unitsType the number and choose From and To among px, rem, em, % and pt; use swap to reverse them.
- Set the font sizesRoot font size is the base for rem; Parent font size is the base for em and % and defaults to the root.
- Read the result and chartSee the converted value, the same size in every unit, and a px to rem chart of common sizes.
The px to rem formula, with examples
rem is relative to the font size of the root html element, so rem = px ÷ root size and px = rem × root size. With the browser default of 16px, 12px is 0.75rem, 14px is 0.875rem, 18px is 1.125rem and 24px is 1.5rem. If the root font size is set to 10px, 1.5rem becomes 15px. pt is a print unit where 1pt equals 4/3 px, so 18pt equals 24px. The results table shows the same size in px, rem, em, % and pt, and the chart lists 14 common px sizes in rem for the root size you entered.
rem vs em vs %
A rem means the same everywhere on the page because it always refers to the root size. em and % refer to the parent element's font size, so they compound when nested: 1.5em inside a 20px parent is 30px, and another 1.5em inside that would be 45px. That's why there's a separate parent size field, which falls back to the root size when left blank. Sizing text and spacing in rem means everything scales together when someone raises their browser's default font size, which helps accessibility.
Accuracy and data handling
After adding generated code to a project, test it in the target browsers and responsive sizes. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How many px is 1rem?
It depends on the root font size. Browsers default to 16px, so 1rem is 16px unless the html element's font-size is changed; with a 10px root, 1rem is 10px.
How do I convert px to rem?
Divide the px value by the root font size. At 16px, 18px ÷ 16 = 1.125rem. Here, choose px to rem and enter 18.
Why do em and rem give the same result?
When the parent font size is left blank, it's assumed to equal the root size, so 1em equals 1rem. Enter the real parent size to see the em and % values change.
More Frontend Tools
Related toolsBuild fluid clamp() font sizes and spacing that scale between two viewport widths.
Score CSS selectors as (A, B, C) and rank them by specificity.
Generate CSS transition code with easing presets, a curve preview and reduced-motion CSS.
Build responsive CSS grid columns with auto-fit, auto-fill or a fixed count, previewed live.
Shrink HTML by removing comments and spare whitespace, with the byte saving shown.
Strip comments and whitespace from JavaScript safely, with the size saving shown.