Standard Reference:
16px = 1.0rem (Default)
REM units are based on the root html font-size.
Calculation Result rem = px / base
Result in REM
2.000 rem
CSS Code
font-size: 2rem;
8px Equivalent
0.5 rem
16px Equivalent
1.0 rem
24px Equivalent
1.5 rem

*Recommended for modern, accessible web layouts.


You're styling a website. You set your font sizes in pixels, like `font-size: 16px;`. It looks perfect on your screen. Then you check it on a phone, or zoom in, and things look off. You want your site to be accessible and scale smoothly, but converting every pixel size to a relative unit like `rem` by hand is a pain. You're dividing by 16 (or whatever your base font size is) over and over.

That's why this PX to REM Calculator exists. It's a tiny, focused tool that does one simple job: you give it a pixel value, it gives you the `rem` equivalent. You can also do the reverse. It instantly shows you the math, so you can copy the clean `rem` value straight into your CSS. It's the quick brain extension you need when writing modern, responsive stylesheets.

I built it because I found myself constantly opening my phone's calculator app while coding. This is faster, more accurate, and always in my browser tab.

What's the big deal with PX vs. REM?

These are units for sizing things in CSS.

PX (Pixels): An absolute unit. `20px` is always 20 pixels on the screen, regardless of other settings. It's simple but inflexible. If a user changes their browser's default font size for accessibility, your pixel-sized text won't scale with their preference.

REM (Root EM): A relative unit. `1rem` is equal to the font-size set on the root `` element. By default in browsers, that's 16px. So, `1rem = 16px`, `2rem = 32px`, and `0.5rem = 8px`.

The magic is in the "Root." If a user has poor eyesight and sets their browser's default font size to `20px`, then `1rem` becomes `20px` across your entire site. Your entire layout scales up proportionally, maintaining accessibility. Using `rem` for font sizes, margins, and paddings is a cornerstone of responsive and accessible web design.

This tool is a CSS unit converter that handles the core calculation for you.

What about EM?

`em` is similar to `rem`, but it's relative to the font-size of its parent element, not the root. This can get confusing with nesting. `rem` (root em) is simpler and more predictable for most sizing, which is why this calculator focuses on it.

How to use the PX to REM converter

The interface is minimal. You'll typically see two linked input fields and a key setting.

  1. Set Your Base Font Size: This is the most important step. There's a field that says "Base Font Size (px)" and it's pre-filled with `16`. Why 16? Because 16px is the default root font-size in 99% of browsers. Unless you've explicitly changed it in your CSS (`html { font-size: ... }`), leave this at 16. If your project uses a different base (like 10px for easier math), change it here.
  2. Convert PX to REM:
    • In the "PX" input box, type the pixel value you want to convert. For example, type `24`.
    • The "REM" output box instantly updates to show the result: `1.5rem` (because 24 / 16 = 1.5).
  3. Convert REM to PX:
    • It works in reverse too. Type into the "REM" box. Type `1.25rem`.
    • The "PX" box instantly shows `20px` (because 1.25 * 16 = 20).
  4. Copy & Use: Click a "Copy" button next to the result you need, and the value (like `1.5rem`) is on your clipboard, ready to paste into your code editor.

The conversion happens in real-time, as you type. No button to click. It's a live front-end development tool.

The secret: It's just division (and multiplication)

The formula is simple: REM = PX / Base Font Size. And PX = REM * Base Font Size. This calculator just does that division instantly, showing the result often to 3 or 4 decimal places for precision (e.g., `14px` becomes `0.875rem`).

Why I use this for every project

Consistency: When I'm building from a design mockup given in pixels, I run every font size, margin, and padding through this calculator. It ensures my entire spacing system is based on `rem` and will scale together harmonically.

Accessibility Compliance: Using `rem` is a straightforward way to meet WCAG (Web Content Accessibility Guidelines) criteria for resizable text. This tool makes it effortless to implement.

Team Hand-offs: If I'm writing CSS for a team, using `rem` with a documented base size (like 16px) makes the code more maintainable. I can share this tool with junior developers to help them understand the conversions.

Troubleshooting: Sometimes a size looks wrong. I can quickly take the computed pixel value from browser Dev Tools, pop it into the PX side, and see what the `rem` equivalent should be to find discrepancies in my CSS.

It's a small piece of a professional, scalable workflow.

Beyond the basics: Using a custom base size

Some developers set `html { font-size: 62.5%; }`. Why? Because 62.5% of 16px is 10px. This makes the math trivial: `1.6rem` becomes `16px`, `2.4rem` becomes `24px`. The REM value is just the pixel value divided by 10.

If you use this technique, you simply change the "Base Font Size" in the calculator from `16` to `10`. Then, `24px` converts to `2.4rem`. The tool adapts to your system. This flexibility makes it a universal web development calculator.

What the tool doesn't do

It doesn't write your CSS for you. It doesn't create whole style systems. It just does the core unit conversion accurately and instantly.

It also assumes you understand that you should apply the `rem` units to the correct properties (`font-size`, `margin`, `padding`, `width`, `height`). It won't stop you from using `rem` for `border-width` (which you can, but it's less common).

It's a helper, not a framework.

From static mockup to fluid design

Design tools like Figma and Photoshop work in pixels. The web lives in a fluid, user-controlled environment. This calculator is the bridge between those two worlds. It translates the rigid, pixel-perfect intention of a design into the flexible, user-friendly language of the web.

It turns a potential annoyance (manual math) into a non-issue. You stop thinking about the calculation and start thinking about the design system and user experience. That's where your focus should be.

Frequently Asked Questions

What is the default base font size (in pixels) in browsers?

The standard default font size in virtually all modern browsers (Chrome, Firefox, Safari, Edge) is 16 pixels. This is set by the browser's user-agent stylesheet on the `` element. Unless you or the user override it, `1rem = 16px`.

Should I use REM for everything?

For typography, spacing (margin, padding), and dimensions that should scale with user text preferences, yes. For borders, shadows, or truly fixed-size elements (like a 1px divider line or an icon that must be exactly 24px), it's still fine to use `px`. Use `rem` for the scalable parts of your design system.

Why is my REM calculation not matching the browser?

Check your base! If you've set `html { font-size: 14px; }` or used a percentage like `62.5%`, your root font size is no longer 16px. Update the "Base Font Size" in the calculator to match your project's actual root `font-size` in pixels.

What's the advantage over just using a CSS preprocessor function?

Tools like Sass have `rem()` functions that do this math. This web tool is for those not using a preprocessor, for quick one-off calculations, or for when you're working outside your main build environment (like in browser Dev Tools or a simple code pen).

Can I convert multiple values at once?

This is a simple single-value converter. For batch conversion of many values, you'd use a spreadsheet, a Sass/Less function, or a more advanced build tool. This is for the quick, "What's 18px in rem?" question you have mid-coding.

Is there a standard for rounding REM values?

There's no strict rule. For font sizes, 2-3 decimal places (e.g., `0.875rem`, `1.125rem`) is common and provides enough precision. For larger spacing, one decimal place (e.g., `1.5rem`, `2.5rem`) is often sufficient. The tool usually provides 3-4 decimals; you can round to your preference when copying.