PX to REM Converter
Type a pixel size or a rem value to get the matching CSS units. Change the base font size if your root is not 16 px.
- Enter pixels or rem
- Set the base font size
- Read the converted values
Your files never leave your device
Converting pixels and rem
The rem unit in CSS is based on the font size of the root element, so it scales when a visitor changes the default text size in their browser. Type a value in pixels or in rem and the tool shows the other unit, plus em, points and a percentage. Change the base font size if your root is not 16 px.
- rem is relative to the root font size, so layouts scale with user settings.
- Browsers default to 16 px, so 1 rem equals 16 px unless you change it.
- Use rem for font sizes and spacing, and px for thin borders.
A worked example
With the default base of 16 px, a size of 24 px is 24 divided by 16, which is 1.5 rem, and it is 150% of the base. In points it is 18 pt, because 1 px equals 0.75 pt.
Some projects set the root to 10 px so that the sums are easy. With a base of 10, a size of 14 px is 1.4 rem and 12 px is 1.2 rem. Change the base field and every result and every row of the table of common sizes updates.
Practical advice
Using rem for text lets people who need larger type get it without breaking your layout. Using px for hairline borders keeps them sharp on every screen. Avoid setting the root font size in px on the html element, because it overrides the visitor's own preference; a percentage is safer.
Remember that em depends on the current element, so nested elements can multiply. The note on the page says that em equals rem when the parent uses the base size.
Frequently asked questions
What is rem?
A CSS unit equal to the root element font size. With the default 16 px, 1.5 rem is 24 px.
What is the difference between rem and em?
rem follows the root font size; em follows the font size of the current element, so it can compound when nested.
How is px converted to pt?
In CSS, 1 px equals 0.75 pt, so 16 px equals 12 pt.
Can I change the base size?
Yes. Enter any base font size greater than zero, for example 10 or 14, and every result updates.
Is the percent value useful?
It shows the size as a percentage of the base, handy for font-size in percent.
Is anything uploaded?
No. The conversion runs on your device.