REM to PX Converter
Convert relative REM units to absolute pixel values for precise measurements
REM to PX Calculator
REM units are relative to the root font size of the HTML document. To convert REM to pixels, multiply the REM value by the root font size (usually 16px by default in most browsers).
Conversion Result
Font Size Preview
See how this REM value looks as font size:
The quick brown fox jumps over the lazy dog.
Batch Converter
Convert multiple REM values at once. Enter values separated by spaces, commas, or new lines.
Batch Results
REM | Pixels | CSS Code |
---|
Common REM to PX Conversions
Based on the standard 16px browser root font size, here are common conversions:
REM | Pixels | Common Use Case |
---|---|---|
0.25rem | 4px | Small borders, minor spacing |
0.5rem | 8px | Standard spacing, small margins/padding |
0.75rem | 12px | Small text, labels, captions |
1rem | 16px | Base font size, standard spacing |
1.25rem | 20px | Large text, subheadings |
1.5rem | 24px | H3 headings, medium spacing |
2rem | 32px | H2 headings, large spacing |
2.5rem | 40px | Large headings, section spacing |
3rem | 48px | H1 headings, major spacing |
4rem | 64px | Display titles, hero headlines |
Frequently Asked Questions
Converting REM to pixels can be useful in several scenarios:
- Design Implementation - When working from design mockups that specify pixel values, you might need to know what the equivalent pixel size is for your REM-based styling.
- Debugging - When inspecting elements in browser dev tools, pixel values are often displayed, so knowing the pixel equivalent helps understand what's rendered.
- Legacy Compatibility - When integrating with older systems or code that use pixel values, you may need to convert REM values to pixels.
- Precise Adjustments - Sometimes you need to know exact pixel measurements for fine-tuning layouts.
- Cross-System Communication - When discussing designs with team members who work in pixels (e.g., graphic designers using design tools like Photoshop).
While modern CSS best practices favor using relative units like REM, understanding the pixel equivalent helps bridge the gap between design and development workflows.
Browsers determine the root font size through a hierarchy of settings:
- CSS Declaration - If you explicitly set the font size on the
html
or:root
element in your CSS, that value becomes the root font size.html { font-size: 18px; } /* Sets root to 18px */
- User Browser Settings - If users have changed their default font size in browser settings, this will affect the root font size.
- Browser Default - If neither of the above applies, browsers use their default root font size, which is almost universally 16px.
It's common practice to use percentages to set the root font size, which maintains the proportional relationship with user browser settings:
/* 62.5% of the user's browser font size */
/* This makes 1rem = 10px if browser default is 16px */
html {
font-size: 62.5%;
}
Setting the root font size with a percentage or relative unit respects user accessibility preferences, which is a key benefit of using REM units.
To calculate pixel values from REM units manually, use this simple formula:
For example, if your root font size is the browser default of 16px:
- 1rem = 1 x 16px = 16px
- 1.5rem = 1.5 x 16px = 24px
- 2rem = 2 x 16px = 32px
- 0.75rem = 0.75 x 16px = 12px
- 0.5rem = 0.5 x 16px = 8px
If you've set a different root font size in your CSS, use that value instead. For example, with a root font size of 10px:
- 1rem = 1 x 10px = 10px
- 1.5rem = 1.5 x 10px = 15px
- 2rem = 2 x 10px = 20px
Many developers set the root font size to 62.5% (10px assuming browser default of 16px) to make REM-to-pixel calculations more intuitive (1rem = 10px).
Media queries can affect REM-to-pixel conversion if you change the root font size at different breakpoints:
/* Base size */
html {
font-size: 16px;
}
/* Tablet size */
@media (max-width: 768px) {
html {
font-size: 14px;
}
}
/* Mobile size */
@media (max-width: 576px) {
html {
font-size: 12px;
}
}
With this setup, 1rem would equal:
- 16px on desktop screens
- 14px on tablet screens
- 12px on mobile screens
This is actually one of the major benefits of using REM units - by changing just the root font size, you can scale all REM-based measurements proportionally across the entire layout.
When using this approach, media query breakpoints themselves should still be defined in pixels to ensure consistent breakpoints regardless of font size settings.
About REM Units
REM (Root EM) units are relative to the font size of the root element (html). This makes them ideal for creating scalable and accessible designs, as all measurements reference a single base value.
Key Points About REM
-
Root-Relative: Always refers to the root element font size
-
Accessibility: Respects user's browser font size settings
-
Consistency: Maintains proportions across the entire layout
-
Scalability: Entire design scales by changing just the root font size
While developing with REM is the modern approach, converting to pixels can be useful when working with design tools or legacy systems.
CSS Usage Examples
Common ways REM units are used in CSS:
/* Setting custom root font size */
html {
font-size: 16px; /* Browser default */
}
/* Common approach for easier math */
html {
font-size: 62.5%; /* Makes 1rem = 10px */
}
/* Typography */
body {
font-size: 1.6rem; /* 16px with 62.5% root */
line-height: 1.5;
}
h1 {
font-size: 3.2rem; /* 32px with 62.5% root */
margin-bottom: 2.4rem; /* 24px with 62.5% root */
}
/* Layout and spacing */
.container {
padding: 2rem;
margin-bottom: 3rem;
border-radius: 0.5rem;
}
/* Media query scaling */
@media (max-width: 768px) {
html {
font-size: 50%; /* Scales everything smaller */
}
}
While REM units are widely used for responsive design, they're especially valuable for text sizes, spacing, and maintaining proportional design systems.