PX to REM

Convert pixels to rem units.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter a pixel value and read it as rem. The calculation is pixels divided by the root font size, which defaults to 16px. Using rem makes sizes scale with the user's font settings.

How to use

1
Step 1
Enter the pixel value.
2
Step 2
Change the root font size if it is not 16px.
3
Step 3
Press Run to get the rem value.

How it works

The pixel value is divided by the root font size. At 16px, 16px = 1rem, 24px = 1.5rem and 12px = 0.75rem. The result is not rounded, so values like 13px give 0.8125.

rem = px ÷ root font size

Worked example

24px to rem

Input
24 px, root 16px
Output
1.5
Walkthrough
24 ÷ 16 = 1.5. At a 10px root the same 24px would be 2.4rem.

Limitations

  • The result is a plain number without the rem unit and without rounding.
  • Uses the root font size you enter, not your site's actual stylesheet.

Questions

How do I convert px to rem?
Divide the pixel value by the root font size, usually 16.
What is 16px in rem?
1rem, at the default root size.
What is 14px in rem?
0.875rem at a 16px root.
Why use rem instead of px?
rem scales with the user's browser font-size setting, which helps accessibility.

Features

  • Custom root size
  • Unrounded result
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • What Is A RESTful API?

    Traversy Media

    API context for JWT, JSON, and encoding utilities.

    Watch on YouTube
  • Learn Regular Expressions - Crash Course

    freeCodeCamp.org

    Regex primer for tester and explainer pages.

    Watch on YouTube