PX to REM Converter

PX to REM Conversion Tables

Pixels (PX) to REM

PixelsREM
1px0.0625rem
2px0.125rem
3px0.1875rem
4px0.25rem
5px0.3125rem
6px0.375rem
8px0.5rem
10px0.625rem
12px0.75rem
14px0.875rem
15px0.9375rem
16px1rem
18px1.125rem
20px1.25rem
24px1.5rem
25px1.5625rem
28px1.75rem
32px2rem
36px2.25rem
40px2.5rem
44px2.75rem
48px3rem
50px3.125rem
56px3.5rem
64px4rem
72px4.5rem
75px4.6875rem
80px5rem
90px5.625rem
100px6.25rem

REM to Pixels (PX)

Assumes standard default browser font-size of 16px

REMPixels
0.01rem0.16px
0.03rem0.48px
0.05rem0.8px
0.08rem1.28px
0.1rem1.6px
0.15rem2.4px
0.2rem3.2px
0.5rem8px
1rem16px
2rem32px
3rem48px
4rem64px
5rem80px
6rem96px
8rem128px
10rem160px
15rem240px
20rem320px
30rem480px
40rem640px
50rem800px
60rem960px
80rem1280px
100rem1600px

PX to REM Conversion in CSS

PX (pixels) and REM (root em) are two units used to define element sizes in Cascading Style Sheets (CSS). Understanding how to convert between them is crucial for creating responsive and adaptable web pages.

Here’s a breakdown of PX to REM conversion:

1. Units:

  • PX (Pixels) is an absolute unit representing a fixed number of pixels on the screen. It is independent of the user’s font size settings.
  • REM (Root Em): A relative unit based on the font size of the root HTML element. By default, the root font size is 16px in most browsers. So, 1rem is equivalent to 16px.

2. Why Use REM?

  • Responsiveness: REM allows elements to scale proportionally with the user’s font size preference. This is essential for responsive web design, ensuring your website adapts to different screen sizes and user preferences.
  • Maintainability: Using REM in your stylesheets makes it easier to maintain consistent font sizes across your website. Changing the root font size automatically adjusts all REM-based elements.

3. Conversion Formula:

To convert PX to REM, divide the pixel value by the root font size (usually 16px):

rem_value = px_value / root_font_size

For example, to convert 24px to rem assuming a 16px root font size:

rem_value = 24px / 16px = 1.5rem

4. Important Points:

  • The conversion is dependent on the root font size. If you change the root font size in your CSS, the REM values will have a different effect.
  • Browsers typically use a default root font size of 16px. However, it’s good practice to explicitly define the root font size in your CSS for better control.
  • While REM offers advantages for responsiveness, there can be situations where PX might be preferred, such as for fixed-size elements like icons or borders.

5. Additional Considerations:

  • Browser Compatibility: While REM is widely supported, it’s always a good idea to check compatibility for older browsers.
  • Nested Elements: When using REM within nested elements, the font size inheritance applies. The REM value is relative to the closest parent element’s font size, not the root font size.