DevFlips PX to REM Converter - Free Online Tool
An easy to use px to rem converter tool for web designers
Pixel
REM
Calculation based on a root font-size of pixel.
How to Use PX to REM Calculator
Step 1: Select your base font.
Step 2: Input the pixels (px) value on the 16 field that you want to convert to rem.
Step 3: The result will be displayed on 1.14 field.
PX to REM Conversion Table
These are the mostly used px to rem sizes. This is considering that your base font (font-size) is 16px. You can also use the converter above.
Pixels
REM
How to Convert PX to REM
The key to converting a px value to rem is the font-size you declare on <html> element.
html{font-size: 16px}
Then, you can use the formula and manually compute its rem equivalent.
PX to REM Formula:
rem = px * base font
Difference Between PX and REM
To know the difference between px and rem, you need first to understand what they are what how they behave.
First off, they are measurements used on screen media or screens on various devices. They are units commonly used to measure lengths in CSS (Cascading Style Sheets).
The difference between them is that px is a fix-size unit. If you say that this font is 16px, it is absolutely 16px wherever you put it. It's just that other devices may display it differently. A 16px font on your computer monitor might be displayed differently on a 16px font on your mobile phone. You get the idea
However, rem unit is a scalable one. It adopts or shall we say, it is always be relative to the base font. So what is a base font now? It is the font size you declare on <html> tag.
html{
font-size: 16px;
}
</style>
So given you assinged a base font, when you set sizes on your<main>,<header>,<footer>,<article>,<div>,<nav>, Remember that rem is relative to your base font assigned to HTML element. So if you say your base font-size is 16px, that means that when you want an <aside> element to have 64px width, you can assign 3rem. So you can say:
aside{
width: 3rem;
}
</style>
In addition, if you can notice, when you don't declare base font-size on your <html> element, fonts just becomes bold or bigger than the normal. When you declare this style on <html> element, the normal size will be respected by the browser.