FormatNest
Runs in your browser — nothing uploaded | No account needed | 100% free
★★★★★4.8(1,000+ users)

Developer tools

px to rem Converter

Convert between px and rem for CSS with any base font size.

px to rem Converter

Download

Ready. Enter values to begin.

Complete guide

How to use px to rem Converter

Enter a pixel or rem value and the base font size (default 16px). The converter shows the equivalent in the other unit and the CSS declaration you can paste into your stylesheet.

Rem units are relative to the root element font size. Using rem instead of px makes layouts scale correctly when users change browser font size — important for accessibility.

Why use rem?

Rem units respect the user's browser font-size preference. Px units do not. Using rem improves accessibility for users with visual impairments.

Default base size

Browsers default to 16px root font size. 1rem = 16px at default settings. Change the base if your CSS sets a different root font size.

rem vs em

Rem is relative to the root element. Em is relative to the parent element. Rem is more predictable for layout; em is useful for component-scoped scaling.

Answers

px to rem Converter FAQs

How do I convert px to rem?

Divide the pixel value by the base font size. At 16px base: 24px / 16 = 1.5rem.

How do I convert rem to px?

Multiply rem by the base font size. 1.5rem x 16px = 24px.

What is the default base font size?

16px in most browsers, unless the site overrides it with a root font-size CSS rule.

Why should I use rem instead of px?

Rem scales with the user's browser font size preference, making your layout more accessible.

What is 1rem in pixels?

At the default 16px base, 1rem = 16px.

Related tools

More tools