Px To Rem Converter
Any Size In Em, Pt And Viewport Units
This px to rem converter converts pixels to rem and vice versa, as well as em, point, percentage and viewport. You can either set the base size of your project or paste in CSS to convert all of the pixel values.
- FreePrice
- 13Units
- NoneSign-up
- NoneUploads
Px To Rem Converter
Convert px, rem, em, pt, percent and viewport units
—
| Unit | Symbol | Value |
|---|
| Pixels | Rem | Em | Points | Percent |
|---|
Ready. Type a number to convert it.
Guides for this tool
Articles with worked examples, tables and a short video that help you get more from this tool.
Rem or Px in CSS: What to UseRem vs px in CSS: the real difference, accessibility, when to use each, and a conversion table.
9 minutes of reading · video guide inside
What A Px To Rem Converter Does For You
It is simple to imagine what pixels look like. But rem units are much more suitable for use on the Web. Since rem units follow the visitor’s choice of text size, a webpage can be read by all. Unfortunately, the math required will slow you down.
A px to rem converter does that maths in a blink. First, type a value in pixels. Then pick rem as the target unit. The result appears while you type, and you copy it with one click.
In addition, the tool supports em, points, picas, inches, centimeters, millimeters, percentage, and four types of viewport units, as well as pixels and rem. So, the same tool can answer the most your CSS length-related questions.
All of the data is processed by your computer, within your web browser. This means that any dimensions that you input will remain on your machine. This is mostly important if you upload a stylesheet that was created for a customer’s website.
How A Pixel Value Becomes A Rem Value
This is the formula. You take the pixels that you entered into the field above and divide those pixels by the root font size that you entered. For example, 24px/16 gives 1.5rem.
Converting back follows the same idea. Take the rem value and multiply it by whatever root font size you entered above. So 1.5rem times 16 gives 24px. The tool handles both directions at once. It also shows the rule for one unit, so you can learn it.
For more detail, see: MDN guide to CSS lengths.
What Is A Rem
The name "rem" is an abbreviation for "root em." 1rem is the same as the current font-size of the html element. By default (and if you don’t change it), most browsers will set this value to 16px. So, 1rem equals 16px unless you alter it.
Also, rem follows the visitor. If a person raises the default text size in the browser, every rem length grows with it. So a layout in rem scales with their choice, and a layout in px does not.
Rem Versus Em
One em equals the font size of the element it sits inside. For the font-size property itself, it equals the size of the parent. So em values compound. A 1.2em inside a 1.2em grows to 1.44 times the base. Rem has no such effect, because it always looks at the root.

The parent font size box can be used to work out the value of one em. All units of measurement that correspond to this value are then displayed in a table so that they may be compared with each other.
Match The Root Font Size To Your Own Site
Many websites adjust their HTML font size to 62.5% to create an equivalent measurement of 1rem for every 10 pixels. This makes the math simple, but it will reduce the size of any text without a specific font size. So, you should also establish a body font size.
Type 10 into the root box and see how the numbers adjust. You will then be able to quickly test your own site’s base value.
Points, Picas And Print Units
A point is 1/72nd of an inch. CSS defines one inch as being 96 pixels (px). So, 12 points are equal to 16 pixels. A pica is composed of 12 points and thus also represents 16 pixels. These units work very nicely in print style sheets.
The centimeter and millimeter also have the same conversion factors (2.54 centimeters per inch). So, 1 cm is about 37.8 pixels.
Percent And Viewport Units
A percentage is worked out from the font-size of the element’s parent. For example, 150% of 16px equals 24px. The viewport units are based upon the size of the browser window. A single vw represents 1% of the window width while a single vh represents 1% of the window height.
Then vmin and vmax will choose either the smaller or larger of the two. You can set up your own window size in the settings and the table will display how many pixels each viewport unit has.
Convert A Whole Stylesheet
Paste the CSS into the lower box. This tool will locate each length in pixel form, then convert it to rem. Then you may paste the converted value into your stylesheet. In addition, you may convert from rem to pixel, and/or use em.

Also, it keeps 1px borders by default, because a hairline should stay one pixel wide. And it skips media queries, because browsers read those against the default size, not the root size.
When To Keep Pixels
Leave the thin lines, borders, and shadows in pixels, since they will look better. Don’t base media queries on the size of the root element (i.e. do not use rem for media queries). So, either use pixels for the media query or use em within the media query.
In short, use rem for text and spacing. Then use px for hairlines.
Line Height And Spacing
Give line-height no unit, like 1.5. Then it scales with the font by itself. For spacing, rem keeps gaps in step with the text, so padding grows when the text grows.
Fluid Type With Clamp
You can mix units. For example, clamp(1rem, 2vw + 0.5rem, 2rem) grows with the window and stays between two limits. So use the tool to find the rem limits. Then write the middle value in vw.
Why Rem Helps Accessibility
Rem length depends on the font size chosen by a visitor in his/her web browser. So, people who have poor eyesight can have larger text displayed to them with no extra effort required of you. In addition, the Web Guidelines need that text be able to increase up to 200% without loss of quality. It is simple to achieve this with a rem based layout.
Read The Chart
The chart lists common sizes from 8px to 96px. So you can read a value without typing. It follows your root size, so it changes when you edit the box.
Safe By Design
First, the whole tool runs inside your own browser. Nothing you type leaves this page, and nothing stays once you close it. That means your CSS stays private.
On this page
- The tool
- What A Px To Rem Converter Does For You
- Converting Px To Rem, One Step At A Time
- What This Px To Rem Converter Does Differently
- Habits For Using Rem Units Well
- Common Px To Rem Mistakes This Tool Helps You Avoid
- Px To Rem Questions We Hear Most Often
- Handy Companions For CSS Work
Keep going
A Quick Walkthrough of the Px to Rem Converter
This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.
Converting Px To Rem, One Step At A Time
Four steps take you from pixels to rem.
Type a value
Enter a number, such as 24, and pick the unit it is in.
Pick the target
Choose rem, em, points or any other unit.
Set your base
If your site’s root size is not 16px, change it here.
Copy the result
Copy one value, or paste CSS and convert it all.
What This Px To Rem Converter Does Differently
It goes beyond one number, and it keeps your CSS private.
Thirteen units
Px, rem, em, pt, pc, in, cm, mm, percent and four viewport units.
Your own base
Set the root size, parent size and window size.
Whole stylesheets
Paste CSS and convert every length at once.
Common sizes chart
Read popular sizes from 8px to 96px with no typing.
Both directions
Go from px to rem and from rem to px with one swap.
Nothing leaves your tab
Your own browser works out every sum. We never see your CSS.
Habits For Using Rem Units Well
A few habits keep your layout flexible.
- Keep the root at 100, right here%. Respect the size a visitor picked, and do not set the html size in pixels.
- Use rem for text. Font sizes in rem follow the browser setting.
- Use rem for spacing. Padding and margins then grow with the text.
- Keep hairlines in pixels. A one-pixel border ought to stay exactly one pixel wide.
- Write your media queries in em units. Em in a query follows the browser size, not your root.
- Avoid nested em. Em values compound inside each other and surprise you.
- Use unitless line height. A value such as 1.5 scales with every font size.
- Round with care. Four decimals are plenty. More digits add noise.
- Try it with a bigger font setting. Raise the browser text size and check your layout.
- Check the parent size. Em and percent depend on it, so set it in the tool.
- Keep a copy. Save your original CSS before you convert a long file.
Common Px To Rem Mistakes This Tool Helps You Avoid
Each of these quietly breaks a layout.
A pixel root size
Setting html to 16px ignores the visitor text setting.
Guessing the base
A site with a 62.5% root needs different numbers.
Compounding em
Nested em values grow faster than you expect.
Rem in media queries
Queries read the browser default, not your root size.
Fat borders
A 1px border in rem can blur or vanish.
Too many digits
A value like 1.428571rem is noise. Round it.
Px To Rem Questions We Hear Most Often
Does this px to rem converter cost anything?
Indeed, this service does not cost anything, need you to create an account, nor impose any restrictions. Because your computer handles most of the processing, we will not need to charge you for the cost of running our servers.
Does my CSS stay on my device?
No, your own computer will calculate all sums. We get no info from you, nor do we store any.
With a 16px root, how do I turn px into rem?
Take the number of pixels and divide them by the base font size. In most cases, this will be 16px. So, if you have 24px and divide it by 16, then your result is 1.5rem. The utility calculates this automatically as you type.
Going the other way, how do I turn rem into px?
Take the rem value and multiply it by whatever root font size you entered above. With a 16px base, 1.5rem times 16 gives 24px. Click the swap button to turn px to rem into rem to px.
What root font size is used by default?
Unless a user or page changes it, browsers use 16px. As long as this is the case, 1rem will be equal to 16px.
How much is 16px in rem?
With a 16px root, 16px equals 1rem.
What’s 14px in rem?
With a 16px root, 14px equals 0.875rem.
How much is 24px in rem?
At a 16px root, 24px is 1.5rem.
What is 10px in rem?
With a 16px root, 10px equals 0.625rem. With a 62.5% root, which is 10px, it equals 1rem.
And how would I turn px into em instead?
Take your pixel value and divide it by the parent element’s font size. Enter the parent’s font size into the settings box. Choose "em" as the output unit.
How do rem and em units behave differently?
The rem value refers to the root font size, while the em value refers to either the font size of the parent element or the element itself. So, rem values cannot be compounded, whereas em values may be.
Is px or rem the better choice?
Use rem for your text and spacing so that both can adjust based on a user’s settings. You should also use px for your thin borders and shadows.
How can I change the root font size?
Enter a different value into the "root font size" input field. When you do so, every component of the application will right away update.
What does a 62.5% root size mean?
It sets the html size to 10px, since 62.5% of 16px is 10px. Then 1rem is 10px, which makes the arithmetic simple.
How can I convert pt to px?
Multiply the points by 96, then divide the result by 72. This means that 12pt is equivalent to 16px. Choose pt as your source unit, and px as your target unit.
How many pixels fit in a centimeter?
CSS sets one inch to 96px, and one inch holds 2.54 centimeters. So 1cm comes to about 37.8px.
What do the vw and vh units stand for?
One vw equals 1% of the window width. One vh equals 1% of the window height. Type your window size in the settings to see the pixels.
What does the percent row show?
The percentage of the original font size as determined by the use of percent values for the font-size property.
How do I convert a whole stylesheet?
Your CSS can be pasted into the lower box, and you will need to choose a direction. The tool will then change each length and indicate how many changes were made.
Why does it keep 1px borders?
A hairline should stay one pixel wide, and a rem value can blur it. Untick Keep 1px borders if you want them converted too.
Why does it skip media queries?
Browsers read media query lengths against the default size, not your root size. Untick Skip media queries to convert them anyway.
How many decimal places should I hold on to?
Four decimals are plenty for CSS. Pick fewer for tidy code, or more when you need an exact match.
Can I click a row in the table?
Yes. Click a row to make that unit the target, and the result card updates.
Does it run on phones too, or only on desktops?
Yes, as the panels accumulate and the tables move horizontally across your screen, this enables conversion of units regardless of where you are located.
Handy Companions For CSS Work
Units are one step. These three tools help with the rest.
- Unit Converter
Convert length, weight, temperature and plenty of other units.
- CSS Minifier
Shrink a stylesheet and cut its load time.
- Colour Code Picker
Switch colour codes between HEX, RGB and HSL.
Ready To Convert Some Pixels?
Simply enter the amount, select your preferred unit of measure, then copy the converted amount. It’s a free conversion tool that needs no account to use, and all numbers entered are stored locally on your device.