PX to REM Converter
This px to rem converter works both ways. Type a pixel size and the rem value appears, or type a rem value and the pixels appear. It opens at 16 px = 1 rem, the browser default, and the base font size is yours to change, so it also fits a site that uses the 62.5% trick. The sums run in your browser; nothing is uploaded.
How to convert px to rem
Type a number into Pixels and the REM field fills in as you type. There is no Calculate button. The page opens with 16 in Pixels and 1 in REM, and the value you type last is the one that drives the other. Decimals and negative numbers are fine, and the decimal mark follows the page language. Clear one field and the other clears with it. Text that is not a number shows "Enter a number."
How to convert rem to px
Go the other way by typing into REM: the Pixels field shows the result. At the default base, 1.5 in REM gives 24 in Pixels, and 0.875 gives 14. You never pick a direction; whichever field you edit is the input.
The px to rem formula
The conversion is one division or one multiplication, where the base is the pixel size that 1rem equals:
With the default base of 16, dividing by 16 turns pixels into rem and multiplying by 16 turns rem back into pixels. The tool applies the same formula to any base you set.
Common px to rem values at a 16px base
Sizes that come up most often in stylesheets, at the default base of 16. Change the base in Settings and the converter gives the matching values for your own root size.
| Pixels | REM |
|---|---|
| 10px | 0.625rem |
| 12px | 0.75rem |
| 14px | 0.875rem |
| 16px | 1rem |
| 18px | 1.125rem |
| 20px | 1.25rem |
| 24px | 1.5rem |
| 32px | 2rem |
| 48px | 3rem |
Change the base font size, including the 62.5% trick
Open Settings to reach Base font size. It is the pixel size that 1rem equals, and its note reads: "The pixel size that 1rem equals. Browsers default to 16; use 10 for the 62.5% trick." The base must be above 0; an empty or zero base shows "Enter a base size greater than 0." instead of a result.
If your CSS sets html { font-size: 62.5% }, the root becomes 10px in a default
browser, so enter 10. Then 16 in Pixels gives 1.6 in REM, 14 gives 1.4, and 1rem is 10px. Any
other root works the same way: with a base of 14, 10px is 0.714rem.
Decimal places and copying the CSS value
Max decimal places (0 to 6, default 3) sets how far results are rounded. Trailing zeros are never shown, so 1.500 appears as 1.5. At a 16px base, 13px is 0.813rem with 3 places, 0.81rem with 2 and 1rem with 0; raise it toward 6 when you want a long fraction kept.
The button under the fields is labelled with the value it copies, for example Copy 1.5rem or Copy 24px. Press it and the number with its unit goes to the clipboard as plain text, ready to paste into CSS, and a "Copied to clipboard" message confirms it.
What this converter does not do
It converts px and rem, one value at a time. There is no em conversion, no Tailwind output, no
batch or table mode and no pasting a list of values. The table in this article is only a
reference. For the rest of a responsive type setup, a
fluid type scale generator writes clamp() sizes in
rem, a color contrast checker tests that the text is
readable, a CSS grid generator lays out the page around it,
and a CSS minifier shrinks the finished stylesheet.
Frequently asked questions
How do I convert px to rem?
Divide the pixel value by the base font size. At the browser default of 16px, 24px is 24 / 16 = 1.5rem. In this converter you just type the pixels into Pixels and the rem value appears in REM as you type, with no Calculate button. If your project uses a different root size, change Base font size in Settings first.
What is 1rem in px?
1rem equals the base font size, which is 16px in a browser's default setup. So 1rem is 16px, 0.5rem is 8px and 2rem is 32px. If a stylesheet sets the root font size to 62.5%, 1rem is 10px instead; enter 10 as the Base font size to match.
What is the px to rem formula?
rem = px / base and px = rem x base, where base is the pixel size that 1rem equals (16 by default). For example 14px / 16 = 0.875rem, and 1.25rem x 16 = 20px. The converter applies exactly this and rounds the result to the number of decimal places you choose.
How do I convert rem to px?
Type the rem value into REM and the pixel value appears in Pixels. Multiply the rem by the base font size: 1.5rem x 16 = 24px. With a base of 10, 1.5rem is 15px. The two fields are linked both ways, so you can type in either one.
What is the 62.5% font size trick for rem?
Setting html { font-size: 62.5% } makes the root font size 10px in a default browser, so 1rem is 10px and the maths is easy to do by eye: 1.6rem is 16px and 2.4rem is 24px. To convert with it, open Settings and set Base font size to 10. The same field takes any other root size you use.
Is 1rem always 16px?
No. 1rem is the font size of the root html element. Browsers default to 16px, but a stylesheet can change it, and a visitor can change the default in their browser settings, which scales everything written in rem. That is why rem is used for accessible sizing. Set Base font size to the root size your site really uses.
Can I convert px to em with this converter?
No, it converts between px and rem only. An em is relative to the font size of the parent element, so there is no single fixed ratio to px that a converter could apply. Rem is always relative to the root, which makes it the unit that a base-size setting can describe.
Does it give Tailwind classes?
No. It gives a plain CSS value such as 1.5rem or 24px, copied with its unit. If you use Tailwind, you can paste the rem value into an arbitrary value, for example w-[1.5rem], or into your own theme config.
Is anything I enter sent to a server?
No. The conversion is plain arithmetic done by your browser on the page, and nothing is uploaded or stored. There is no account and no sign-up.
Recommended
-
Belkin 4-Port USB-C Hub (100W)Plug a second screen in so the Figma spec sits next to your CSS
-
ARZOPA 16" 144 Hz Portable MonitorKeep the design file on one screen and your stylesheet on the other
-
Logitech Lift Vertical Ergonomic MouseEasier on the wrist through long hours of tweaking spacing values
Helps keep the tools free. ✨
Images are for illustration only. As an Amazon Associate I earn from qualifying purchases.