PX to REM converter
Type a value in any unit and set the base font size (16 px in most browsers). The converter gives the same length in px, rem, em, pt and percent. Use it to turn a design in pixels into scalable CSS that follows the reader's font size setting.
Runs in your browser: nothing you enter is sent anywhere.
Frequently asked questions
How do I convert px to rem?
Divide the pixels by the base font size. With the usual 16 px base, 24 px is 24 ÷ 16 = 1.5 rem. To go back, multiply rem by the base, so 1.25 rem is 1.25 × 16 = 20 px.
What is the base font size?
It is the font size of the root element (html). Browsers default to 16 px, but if your CSS sets html { font-size: 62.5% } the base becomes 10 px, and 1.6 rem is then 16 px. Enter your own base here to match.
What is the difference between rem and em?
rem is always relative to the root font size. em is relative to the font size of the parent element, so nested em values multiply. This tool assumes the parent equals the base size, which is exact for a top-level element.
How many pixels is one pt?
In CSS, 1 inch is 96 px and also 72 pt, so 1 pt is 96 ÷ 72 = 1.3333 px. A 12 pt font is 16 px.
Why use rem instead of px for font sizes?
rem values scale when a reader changes the browser's default font size, while px values stay fixed. That is why rem is recommended for text, spacing and media queries that should follow user settings.