PX to REM Converter
Convert px to rem and rem to px online with any root font size, see a table of common sizes, and convert every px value in a CSS snippet at once.
Something not working, or missing a feature? Send feedback
About the PX to REM Converter
The PX to REM converter changes pixel values to rem units and back, using the root font size of your site. It also converts a whole CSS snippet at once and shows a table of common sizes, which makes moving a design from fixed pixels to scalable rem units quick and consistent.
Conversion happens in your browser, so your files and records stay private.
How to use the PX to REM Converter
- Set the root font size (16px is the browser default; change it if your CSS sets html { font-size }).
- Type a value in px or rem to see the other unit instantly.
- To convert a stylesheet, paste CSS into the batch box and copy the rem version.
Common mistakes
- Using the wrong root size. If your CSS sets html { font-size: 62.5% }, the root is 10px, not 16px. Set the root size to match, or every converted value will be off.
- Converting borders and shadows blindly. Hairline 1px borders usually look best as 1px. Keep the "Keep 1px values" option on when converting a stylesheet.
Works well with the PX to REM Converter
- CSS Formatter: tidy the converted CSS.
- CSS Gradient Generator: design gradients for the same components.
- Color Converter: convert the colours in the same stylesheet.
Frequently asked questions
How do I convert px to rem?
Divide the pixel value by the root font size: with the default 16px, 24px ÷ 16 = 1.5rem and 14px ÷ 16 = 0.875rem. To go back, multiply: 2rem × 16 = 32px.
Why use rem instead of px?
rem units scale with the user's browser font-size setting, so text and spacing grow together for people who need larger text. Pixel sizes stay fixed and can make a page harder to read.
What is the difference between rem and em?
rem is relative to the root (html) font size, the same everywhere on the page. em is relative to the font size of the current element, so it compounds when elements are nested.
Related tools
JSON to CSV
Convert JSON arrays to CSV online with automatic column detection, nested object flattening and custom delimiters. Open the result in Excel or Sheets.
CSV to JSON
Convert CSV to a JSON array online with header detection, type inference and delimiter auto-detection. Turn spreadsheet exports into data for APIs and code.
JSON to XML
Convert JSON to well-formed XML online with a configurable root element and attribute support. Validate the input and download the XML file.
XML to JSON
Convert XML to JSON online, keeping attributes and turning repeated elements into arrays. Malformed XML is reported with its location.
JSON to YAML
Convert JSON to clean, human-readable YAML online. Turn API responses and package files into config for Kubernetes, Docker Compose or CI pipelines.
YAML to JSON
Convert YAML documents to formatted JSON online with syntax validation. Errors are reported by line, so broken indentation is quick to find and fix.