PX to REM Converter (and REM to PX)
Developer ToolsConvert pixels to rem and rem to pixels for your root font size, one value at a time or a whole CSS block at once.
Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy
About
What the PX to REM does
The PX to REM Converter turns pixel values into rem units and rem back into pixels, using the root font size you set (16 px is the browser default). Paste one number, a list, or a block of CSS and every px value in it is converted in place, while 1px borders, file names and comments are left alone. A table of common sizes answers the usual questions at a glance. It is for front-end developers and designers moving a layout to scalable units.
Steps
How to use it
- 1Check the root font size; 16 px is the browser default and what most sites use.
- 2Choose PX → REM or REM → PX.
- 3Paste a value, a list of values or a block of CSS, and press Convert (or Cmd/Ctrl+Enter).
- 4Copy the converted values or CSS. The table of common sizes updates with the root size.
Example
A real run
Input
.card {
padding: 24px 32px;
font-size: 14px;
border: 1px solid #e5e7eb;
}Output
.card {
padding: 1.5rem 2rem;
font-size: 0.875rem;
border: 1px solid #e5e7eb;
}At a 16 px root, 24px becomes 1.5rem, 32px becomes 2rem and 14px becomes 0.875rem. The 1px border stays in pixels because Leave 1px borders as px is on by default.
Options
Every setting, and when to use it
- Root font size
- The pixel size of 1rem, set on the html element. Browsers default to 16 px; some projects set 10 px (html { font-size: 62.5% }) so that 1.6rem means 16 px. Use the value your stylesheet uses.
- PX → REM or REM → PX
- PX → REM divides by the root size (24 px is 1.5rem at 16). REM → PX multiplies (1.5rem is 24 px). Switching direction converts the current input again.
- Decimals
- Rounds results to 2, 3 or 4 decimal places. Four keeps values such as 0.0625rem (1 px) exact; two gives tidier numbers when tiny rounding differences do not matter.
- Leave 1px borders as px
- On by default. Hairline borders and outlines are usually meant to stay one device pixel thick, so 1px values are not converted. Turn it off to convert them too.
- Single value, list or CSS block
- Plain numbers (one per line, or several on a line) are treated as values in the source unit. Text containing px or rem units is treated as CSS: each value is replaced in place and everything else, including url() file names and comments, is left untouched.
Good to know
Common problems and limits
rem is relative to the root element's font size, em to the font size of the element itself or its parent. Converting px to em needs the parent's size, so this tool converts to rem only.
The real pixel size of 1rem depends on the visitor: browser zoom scales everything, and a user who sets a larger default font in the browser makes every rem value larger. That is the main reason to use rem for type: it respects their setting.
The converter does arithmetic on the numbers you give it; it does not read your stylesheet's actual root size or apply media queries. If your site changes the root size per breakpoint, convert with the size for that breakpoint.
Audience
Who uses it
- Front-end developersMove a component's spacing and type from px to rem in one paste, keeping hairline borders as px.
- Designers handing off to developersTranslate pixel values from a Figma file into rem for the design tokens, then turn the colors into CSS with the Color Converter.
- Accessibility reviewersCheck which pixel sizes a rem-based scale actually produces at the default 16 px and at a larger user setting.
- Email and CMS editorsGo the other way, rem to px, for systems that only accept pixel values, and tidy the markup with the HTML Formatter.
FAQ
Frequently asked
How much rem is 16px?
At the browser default root font size of 16 px, 16px is exactly 1rem. The general formula is rem = px ÷ root size, so 16 ÷ 16 = 1. If your site sets the root to 10 px, 16px is 1.6rem instead.
Is 1 rem always 16px?
No. 1rem equals the font size of the html element. Browsers default it to 16 px, but a stylesheet can change it, and users can raise their browser's default font size, which makes 1rem larger for them. That flexibility is why rem is recommended for text.
What are 12px, 24px, 36px and 50px in rem?
At a 16 px root: 12px is 0.75rem, 24px is 1.5rem, 36px is 2.25rem and 50px is 3.125rem. Divide the pixel value by 16 to get any other size, or read it from the table under the tool.
How do I convert rem to px?
Multiply the rem value by the root font size: 1.5rem × 16 = 24px and 0.875rem × 16 = 14px. Choose REM → PX above to convert a list or a block of CSS at once.
What is the difference between rem, em and px?
px is a fixed CSS pixel. rem is relative to the root html font size, so it scales consistently across the page. em is relative to the current element's font size, so it compounds when elements are nested. Most teams use rem for type and spacing and px for borders.
Should I use rem or px for font sizes?
rem is the usual recommendation, because text sized in rem grows when a user raises the default font size in their browser, while px text does not. Pixel sizes still make sense for things that should not scale, such as 1px borders.
Automation: an MCP tool px_to_rem(values, base) → values and an n8n node are planned for this tool.