← Digital, Network & Web

Unit Converter

PX to REM Converter

Convert a CSS pixel length to rem for typography, spacing and layouts using an explicit root font size.

Convert pixels to root-relative lengths

Length in rem1.5rem
Original CSS pixel length
24 px
Root font size
16 px

The initial 16 px root is an example. Enter your page’s computed html font size. Signed lengths are supported; individual CSS properties may disallow negative values.

Your calculation stays in your browser.

PX to REM Converter examples

InputExpected result
24 px, 16 px root1.5 rem
12 px, 16 px root0.75 rem
24 px, 20 px root1.2 rem
−8 px, 16 px root−0.5 rem

Supported units & limits

Accepts signed decimal CSS lengths, zero and scientific notation, plus a strictly positive root font size. Enter numbers without px or rem suffixes. The 16 px starting value is an example, not a detected setting or a fixed browser rule. The tool calculates lengths for the root size supplied; it does not inspect your page, resolve calc() expressions or convert device pixels. Values outside floating-point range are rejected.

Common mistakes

Use the root element’s computed font size, not a nested parent’s font size. rem and em can differ. A CSS pixel is not necessarily one screen pixel, so device pixel ratio does not belong in this formula. A negative result can be used only where the target CSS property accepts negative lengths.

Privacy

Conversions run in your browser. This site does not upload or store the values you enter. We use Google Analytics (through Google Tag Manager) to count page visits, and Microsoft Clarity to see how pages are used, such as clicks and scrolling; both may set cookies, and Clarity is set to mask text on the page. The hosting server may keep standard access logs when you load a page.

Conversion guide

Move pixel spacing into a rem scale

Read the computed html font size on the page you are editing, enter it here, then convert a spacing or type size. With a 16 px root, an 8 px spacing step becomes 0.5 rem and a 24 px gap becomes 1.5 rem. After updating the stylesheet, check the layout with user font preferences and at your breakpoints.

PX to REM Converter FAQ

Is 1 rem always 16 px?

No. One rem follows the root element’s computed font size. It is 20 px when that font size is 20 px. Enter the value used by your page.

How do I find my page’s root font size?

Inspect the html element in browser developer tools and read its computed font-size in pixels. Check again at relevant breakpoints if your stylesheet changes it.

Will converting to rem make a design responsive?

It makes the length depend on the root font size. Responsive layout also depends on the CSS properties, breakpoints and other sizing rules you use.

Can I set the root font-size itself using this conversion?

When rem is used on the root element’s own font-size, CSS resolves it against the initial font size to avoid a circular reference. This calculator is intended for lengths that refer to an already computed root size.