Skip to content
gohacks.dev
Web

PX to REM Converter

Convert between px, rem, em, pt, vw, vh, percent, cm and inches with your own root font size, parent font size and viewport dimensions.

Free · No sign-up · Your inputs stay in your browser

Input

Convert px, rem, em, pt and viewport units

Output

24px

px

24px

rem

1.5rem

em

1.5em

pt

18pt

vw

1.6667vw

vh

2.6667vh

% of parent font

150%

cm

0.635cm

in

0.25in

CSS fixes 1in = 96px = 72pt, so pt and cm are exact here; on screen they are not physical lengths. Prefer rem for type and spacing: it scales with the reader's browser font size setting, which px ignores. em compounds through nesting, which is why rem replaced it for most uses.

Runs in this browser. Nothing you paste is sent to a server.

Why rem for type and spacing

Readers who raise their browser's default font size, often for accessibility, get larger text only where sizes are in rem or em; px ignores the setting. rem is relative to the root element only, so it does not compound through nesting the way em does. The units are defined in CSS Values and Units Level 4.

Physical units are not physical

CSS anchors 1in to 96 pixels, so cm and pt are exact relative to px but do not measure anything on a screen. They are useful for print stylesheets and nothing else.

Share

Frequently asked questions

How many pixels is 1rem?
The root element's font size, which is 16px in every browser unless the page or the user changes it.
Should media queries use em or px?
em in media queries is relative to the browser's default size, so breakpoints move with the user's font setting. Many design systems use px for predictability; both work.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools