PX to REM Converter
Turn pixels into rem, rem into pixels, or pixels into em, at whatever root font size your site uses. Type in any box and the others follow. Below the converter: a table for your base size, and a bulk converter that rewrites every px in a block of CSS.
- 1Set the base size
- 2Type a value
- 3Copy
1Set the base font size
PX to REM table at 16px
| Pixels | rem |
|---|
3Convert a whole block of CSS
Comments, quoted strings and url() are never changed. em values are left alone because they depend on each element's own font size.
How to convert px to rem
Divide the pixels by the root font size: rem = px ÷ root font size. With the usual 16 px root, 24 px ÷ 16 = 1.5rem. To go back, multiply: px = rem × root font size, so 1.5rem × 16 = 24 px. For em, divide by the font size of the parent element instead of the root.
- Set the base. Leave 16 px unless your CSS sets a different
font-sizeonhtml(for example62.5%, which is 10 px when the browser default is 16 px). - Type a value. Type pixels, rem or em; the other two update as you type.
- Copy it. Each Copy button copies the value with its unit, ready to paste into CSS.
What rem and em mean
The W3C's CSS Values and Units spec defines rem as "equal to the computed value of the em unit on the root element", and em as equal to the computed font size "of the element on which it is used". So rem always follows the font size of html, while em changes from element to element. A px is an absolute unit: the same spec sets 1px to 1/96th of an inch.
Because rem follows the root font size, a page sized in rem grows when a reader turns up the default font size in their browser settings, while one sized in px does not.
Is 1rem always 16px?
No. 1rem equals the root font size. With browser settings left alone, Chromium, Firefox and WebKit (the engine behind Safari) each reported a root font size of 16 px in our test on 27 October 2026, so 1rem = 16 px and 1px = 0.0625rem. If a reader changes their default font size, or your CSS sets html { font-size: … }, 1rem changes with it.
Why the bulk converter skips media queries
Media Queries Level 4 says "relative length units in media queries are based on the initial value", so a rem inside @media ignores any font-size you set on html. If your root font size is not 16 px, converting breakpoints with it would move them. Tick "Also convert inside @media" only if your base is the browser default.
Sources, read 27 October 2026: W3C, CSS Values and Units Module Level 4 (Working Draft, 12 March 2024), sections 6.1.1 and 6.2; W3C, Media Queries Level 4 (Candidate Recommendation Draft, 19 February 2026), section 1.3. The 16 px default was measured by us in three browser engines, not taken from a spec.
Report a problem or suggest a feature
More free tools
- Pixels to InchesPixels, inches, cm and mm at any DPI
- Aspect Ratio FinderFind and scale any aspect ratio
- Placeholder Image GeneratorAny size, colour and text
- Icon ConverterPNG or JPG to a multi-size .ico
- Round Corners on ImageRounded corners, transparent PNG
- Discord Timestamp GeneratorAll 9 styles, with a live preview