Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsPX to REM Converter

PX to REM Converter

dev

Convert px to rem or em and back, or turn every px in a stylesheet into rem

Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 22 Oct 2026.

Divide the pixel value by the root font size: with the browser default of 16px, 24px is 24 / 16 = 1.5rem and 14px is 0.875rem. To go back, multiply: 1.5rem × 16 = 24px. Paste a stylesheet to convert every px in it, keeping selectors, urls and 1px borders as they are.

Next:
  • CSS Specificity Calculator See the (A, B, C) specificity of any selector, part by part, and which rule wins
  • CSS Beautifier & Minifier Tidy a stylesheet or minify it, with the size saved shown

How to convert px to rem

1

Set the root font size; 16px is the browser default, 10px if your site uses the 62.5% trick.

2

Type a value such as 24px to get 1.5rem, or 1.5rem to get 24px, or read the table of common sizes.

3

To convert a whole stylesheet, paste it into the CSS box; selectors, urls and comments stay as they are.

4

Choose whether to keep 1px borders and media queries in px, then click Copy.

About PX to REM Converter

Sizes in rem follow the reader's own font-size setting, so text and spacing grow together for anyone who has set a larger default. Designs are still handed over in pixels, and this converter does the arithmetic both ways.

One value. Type 24px and read 1.5rem; type 1.5rem and read 24px. A bare number counts as px. Change the root font size if your site sets one: many sites set html to 62.5%, which makes 1rem equal 10px. The table lists the common sizes for the root size you choose, in rem or in em.

A whole stylesheet. Paste CSS and every px length in a declaration is converted as you type. What stays as it is:

Left alone Why
Selectors such as .mt-16px changing a class name would break the HTML
Property names such as --gap-12px only values are lengths
Strings, comments and url(...) file names and text are not lengths
1px and below, by default hairline borders should stay one device pixel; set the limit to 0 to convert them
Uppercase PX the usual way to mark a value that must stay in pixels

Media queries are different. In a media query, rem and em do not use the font size your page sets: Media Queries Level 4 says relative units there are based on the initial font size, which is the browser default of 16px. A breakpoint of 768px is therefore 48em even on a 62.5% site, where 76.8rem would be wrong. Media queries are left in px by default, or converted with 16 if you choose.

em works the same way as rem but relative to the parent element's font size, so set the size to the parent's when you pick em. Values are rounded to the decimals you choose, four by default, and 0px becomes 0. Nothing you paste leaves your browser. Related tools: CSS Clamp Generator, CSS Formatter, Box Shadow Generator.

Frequently asked questions

How do I convert px to rem?

Divide the pixel value by the root font size. Browsers default to 16px, so 24px is 1.5rem, 14px is 0.875rem and 32px is 2rem. Type the value above, or paste a whole stylesheet to convert every px in it at once with the same root size.

How many pixels is 1rem?

One rem equals the font size of the html element. When the page does not set one, that is the browser default of 16px, unless the reader has changed it in their settings. A site that sets html to 62.5% makes 1rem equal 10px for readers with the default.

What is the difference between rem and em?

A rem is relative to the root html font size, so it means the same everywhere on the page. An em is relative to the font size of the element itself, or its parent for the font-size property, so nested ems multiply. Use rem for predictable spacing.

Should media queries use px, rem or em?

In a media query, rem and em always refer to the browser's initial font size, usually 16px, not to the size your page sets on html. So 768px becomes 48em even on a 62.5% site. Em breakpoints follow the reader's zoom and default size, which px breakpoints do not.

Why are 1px borders not converted?

A border of 0.0625rem can round to zero or blur on some screens, while 1px is always drawn as one device pixel or more. Values of 1px and below stay in px by default; set the limit to 0 if you want every value converted.

Is my CSS uploaded when I convert it?

No. The conversion runs in your browser as you type, and nothing you paste is sent or stored. Selectors, property names, strings, comments and url() values are copied exactly, so only lengths change and the rest of the file stays byte for byte the same.

Sources

  • W3C CSS Values and Units Module Level 4, 6.1.1 Font-relative lengthsrem is the font-size of the root element, em the font-size of the element
  • W3C Media Queries Level 4, 1.3 Units (Editor's Draft)Relative length units in media queries are based on the initial value of font-size, not on any styling on the page

Last verified 22 October 2026.

Rates and rules change; check the source before you rely on a figure.

Still stuck? Ask about PX to REM Converter and anybody who knows can answer. No account needed.

Common uses

  • REM to PX ConverterTurn rem or em values back into pixels for any root font size

On the related tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · Query String Parser – Split a URL query string into a table of decoded parameters.

Related tools

All developer tools
Base64 Encode & DecodeText and files to Base64 and back, with URL-safe mode and image previewUnix Timestamp ConverterUnix timestamps to dates and dates to timestamps, in any time zoneJSON to TypeScriptGenerate TypeScript interfaces or types from a JSON sampleCSV to JSONConvert CSV to JSON and JSON to CSV, with a table previewYAML to JSONConvert YAML to JSON and JSON to YAML, with anchors resolvedURL Encoder / DecoderPercent-encode or decode text and URLs, and see every part of a linkColor ConverterHEX, RGB, HSL, HWB, OKLCH and CMYK in both directions, with a contrast checkNumber Base ConverterBinary, octal, decimal, hex and any base to 36, exact at any size, with two's complement
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)