Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

PX to REM Converter

To convert px to rem, divide the pixel value by the root font size (16px by default): rem = px / base font size. So 16px = 1rem, 20px = 1.25rem, and 24px = 1.5rem. This free converter does it instantly for responsive, accessible CSS, works in both directions, and also converts EM, Point and Percent. It is brought to you by TestMu AI (formerly LambdaTest), the team behind a unified software testing platform.

Categories

...

Verify Before You Deploy

Terminal-native web and mobile automation.

Try Kane CLI
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free

Base size in px. Default

EM

Pixel

REM

Percent

Point

ConvertConvert

Reset Reset

CSS Style Properties

EM

h1 {

font-size: 1em;

}

Pixel

h1 {

font-size: 16px;

}

REM

h1 {

font-size: 1rem;

}

Percent

h1 {

font-size: 100%;

}

Point

h1 {

font-size: 12pt;

}

Unit Conversion Table (Base 16)

EMPixelREMPercentPoint
0.0625em1px0.0625rem6.25%0.75pt
0.125em2px0.125rem12.5%1.5pt
0.1875em3px0.1875rem18.75%2.25pt
0.25em4px0.25rem25%3pt
0.3125em5px0.3125rem31.25%3.75pt
0.375em6px0.375rem37.5%4.5pt
0.4375em7px0.4375rem43.75%5.25pt
0.5em8px0.5rem50%6pt
0.5625em9px0.5625rem56.25%6.75pt
0.625em10px0.625rem62.5%7.5pt
0.6875em11px0.6875rem68.75%8.25pt
0.75em12px0.75rem75%9pt
0.8125em13px0.8125rem81.25%9.75pt
0.875em14px0.875rem87.5%10.50pt
0.9375em15px0.9375rem93.75%11.25pt
1em16px1rem100%12pt
1.0625em17px1.0625rem106.25%12.75pt
1.125em18px1.125rem112.5%13.5pt
1.1875em19px1.1875rem118.75%14.25pt
1.25em20px1.25rem125%15pt
1.3125em21px1.3125rem131.25%15.75pt
1.375em22px1.375rem137.5%16.50pt
1.4375em23px1.4375rem143.75%17.25pt
1.5em24px1.5rem150%18pt
1.5625em25px1.5625rem156.25%18.75pt
1.625em26px1.625rem162.5%19.5pt
1.6875em27px1.6875rem168.75%20.25pt
1.75em28px1.75rem175%21pt
1.8125em29px1.8125rem181.25%21.75pt
1.875em30px1.875rem187.5%22.5pt
1.9375em31px1.9375rem193.75%23.25pt
2em32px2rem200%24pt
2.0625em33px2.0625rem206.25%24.75pt
2.125em34px2.125rem212.5%25.5pt
2.1875em35px2.1875rem218.75%26.25pt
2.25em36px2.25rem225%27pt
2.3125em37px2.3125rem231.25%27.75pt
2.375em38px2.375rem237.5%28.5pt
2.4375em39px2.4375rem243.75%29.25pt
2.5em40px2.5rem250%30pt
2.5625em41px2.5625rem256.25%30.75pt
2.625em42px2.625rem262.5%31.5pt
2.6875em43px2.6875rem268.75%32.25pt
2.75em44px2.75rem275%33pt
2.8125em45px2.8125rem281.25%33.75pt
2.875em46px2.875rem287.5%34.5pt
2.9375em47px2.9375rem293.75%35.25pt
3em48px3rem300%36pt
3.0625em49px3.0625rem306.25%36.75pt
3.125em50px3.125rem312.5%37.5pt
Kane CLI - Testing Agent in Your Terminal

What is a PX to REM converter?

A PX to REM converter is a tool that transforms pixel (px) measurements into root em (rem) units using the formula rem = px divided by the root font size. With the default 16px root, 16px equals 1rem. Developers use it in CSS to build responsive designs that adapt to diverse screen dimensions and resolutions.

Its primary function is establishing the rem value derived from the pixel value, which streamlines the design of adaptable and visually consistent web interfaces across devices and display settings. This converter from TestMu AI also returns the matching EM, Point, and Percent values, so a single input covers every unit your stylesheet needs.

How to use the PX to REM converter?

Using a PX to REM converter is a fundamental step in achieving a responsive and accessible web design. To employ this tool effectively, follow these steps:

By inputting a specific pixel width dimension, users can readily obtain the equivalent value expressed in REM and EM units, facilitating the creation of adaptive and fluid designs within a web environment. This conversion capability is particularly pertinent in the context of web development, where REM units are used to ensure consistent and accessible typography and spacing, catering to a diverse range of display sizes and resolutions. The PX to REM converter simplifies this process and empowers designers and developers to maintain design consistency and accessibility across various viewing contexts.

Typography setup rarely ends at sizing: once the scale is settled, the webfont generator turns uploaded WOFF, WOFF2, TTF or OTF files into the @font-face CSS that loads the typeface itself, along with a preview and a downloadable kit.

How to Use PX to REM Converter

Using a PX to REM converter is a fundamental step in achieving a responsive and accessible web design. To employ this tool effectively, follow these meticulous steps:

  • Determine Root Font Size:
  • Check the root font size specified in your CSS. If it's not explicitly defined, the default browser font size is typically 16px. This root size is essential as REM values are relative to it.

  • Identify PX Values:
  • Identify the font sizes you wish to convert from PX to REM in your CSS stylesheet.

  • Use a Converter Tool:
  • There are various online tools or converters available that help in converting PX to REM values. These tools usually require you to input the pixel value and the root font size. They will then generate the corresponding REM value.

  • Replace PX Values in CSS:
  • Once you have the converted REM values, replace the original PX values in your CSS with the new REM values. For instance, if you had a font size set to font-size: 16px; and the equivalent REM value is 1rem, replace it with font-size: 1rem;.

  • Ensure Compatibility:
  • Test the updated REM values across different browsers and devices to ensure they display consistently and adapt properly to varying user settings.

Benefits of Using PX to REM Converter

Using a PX to REM converter offers several benefits, especially in web development and design practices:

  • Ease of Conversion: Conversion tools simplify the process of converting PX (pixel) values to REM (root em) units. They provide a straightforward way to convert existing pixel-based measurements to a more flexible and scalable REM unit system.
  • Scalability and Responsiveness: REM units are relative to the root font size, making them highly scalable. Using a converter allows designers and developers to swiftly adapt existing pixel-based font sizes to REM, ensuring responsiveness across various devices and screen sizes.
  • Consistency in Design: By converting pixel-based font sizes to REM, consistency in design is maintained. REM units allow for better control over typography, ensuring that font sizes are proportionally adjusted based on the root font size, creating a harmonious and consistent visual hierarchy.
  • Accessibility and User Experience: REM units enhance accessibility by allowing font sizes to adapt to user preferences. Users can adjust browser settings for font size or utilize assistive technologies, and the converted REM units ensure that the content remains readable and accessible.
  • Maintenance and Future Updates: Utilizing a PX to REM converter streamlines maintenance and updates across a website. When the root font size is adjusted, all REM-based font sizes update proportionally, reducing the effort needed to maintain consistent typography throughout the site.
  • Responsive Typography: Responsive web design heavily benefits from using REM units. The converter facilitates the transition from fixed pixel sizes to responsive REM sizes, ensuring that typography adapts seamlessly to different viewport sizes without compromising readability or design integrity.
  • Cross-Browser Compatibility: REM units have good support across modern browsers. By using a converter, developers ensure that the REM-based font sizes are applied consistently across different browsers, providing a uniform user experience.
  • Flexibility in Designing: PX to REM conversion offers flexibility in designing layouts and typography. It allows for greater control over font sizes while enabling a design that adapts fluidly to user preferences and different devices.

Frequently Asked Questions

  • Determine the root font size: Check the root font size specified in your CSS. If it is not explicitly defined, the browser default is 16px, and rem values are relative to it.
  • Identify the px values: Find the pixel-based font sizes and lengths in your stylesheet that you want to convert from px to rem.
  • Convert the pixel value: Enter the pixel value in the converter above, adjust the base size if your root differs from 16px, and read the rem value instantly.
  • Replace px values in CSS: Swap the original px values in your stylesheet for the converted rem values, for example font-size: 16px becomes font-size: 1rem.
  • Ensure compatibility: Test the updated rem values across different browsers and devices to confirm they display consistently and adapt to user settings.

What can you do with the PX to REM converter?

The PX to REM converter serves as a versatile instrument for several critical tasks in day-to-day CSS work:

  • Convert pixel values to rem units: Translate pixel measurements into relative units that drop straight into your CSS, enabling layouts that adapt to diverse screen dimensions. For the reverse direction, the REM to PX converter turns rem values back into pixels.
  • Scale proportionally from the root font size: Rem values scale elements in step with the root element font size, so font sizes and layout proportions follow user preferences. When an element should scale with its parent instead, use the PX to EM converter.
  • Improve accessibility across user environments: Rem-based sizing keeps sites readable for people using different screen sizes, resolutions, and font-size preferences, aligning with web accessibility best practices.
  • Maintain consistency in larger projects: Rem values preserve element proportions across an entire project, so updating font sizes propagates uniformly instead of requiring per-element edits.
  • Work on any platform: The free online converter runs in the browser on Windows, Mac, and Linux, and in Chrome, Firefox, Edge, and Safari, with no installation required.

What is the difference between px and rem?

Px are absolute units that remain constant in size, the smallest addressable element in a raster image. Rem, on the other hand, is widely used in CSS development. The rem unit lets you define a size relative to the HTML root element's font-size.

The distinction is that px is a fixed-size unit. If you say this font is 16px, it is exactly 16px no matter where you put it, although different devices may render it differently. A 16px font displayed on your computer monitor may appear differently on your mobile phone.

Root em (rem) units, in contrast, are a type of relative measurement determined by the font size of the webpage's root element, typically the HTML tag. With a root font size of 16px, 1rem equals 16px and a 2rem element becomes 32px. Change the root to 20px, and 1rem equals 20px while 2rem equates to 40px.

Using rem units creates a uniform layout that adapts to users' font size preferences, enhancing accessibility. Px units come in handy when precision is required for specific element sizes, such as buttons and icons. Rem units are commonly employed in typography, allowing font size to accommodate user font choices.

Benefits of using the PX to REM converter

Using a PX to REM converter offers several benefits, especially in web development and design practices:

  • Ease of conversion: The tool provides a straightforward way to convert existing pixel-based measurements to a more flexible and scalable rem unit system.
  • Scalability and responsiveness: Rem units are relative to the root font size, so converted values stay responsive across various devices and screen sizes.
  • Consistency in design: Rem units keep font sizes proportionally adjusted to the root font size, creating a harmonious and consistent visual hierarchy.
  • Accessibility and user experience: Users can adjust browser font settings or use assistive technologies, and rem-based sizes keep the content readable and accessible.
  • Maintenance and future updates: When the root font size changes, all rem-based sizes update proportionally. Once the stylesheet is refactored, run it through the CSS minifier before shipping.
  • Responsive typography: Fixed pixel sizes become fluid rem sizes that adapt to viewport changes. Pair the converter with the CSS clamp calculator to build fully fluid type scales.
  • Cross-browser compatibility: Rem units have good support across modern browsers, so converted font sizes render consistently for a uniform user experience.
  • Flexibility in designing: Rem-based sizing gives greater control over typography and layout, and the aspect ratio calculator helps size the media boxes those layouts contain.

Frequently Asked Questions (FAQs)

How do you use this PX to REM converter?

Type a pixel value into the PX field and the REM field updates instantly, along with the EM, Point and Percent fields. It works in both directions, so entering a rem value fills in the pixels instead. If your project uses a root font size other than 16px, change the “Base size in px” field first and every conversion follows it.

Is the PX to REM converter free?

Yes. The converter is completely free with no signup or subscription, there is no limit on how many values you can convert, and every calculation runs in your own browser.

Which is better px or REM?

Both px and rem have their merits. px provides a fixed value, while rem is relative to the root element's font size. rem is preferred for accessibility and scalability, as it adjusts based on user preferences. Ultimately, the choice depends on the specific project requirements and design considerations.

How big is 1 rem in px?

1 rem equals the font size of the root element, which is the html element. Browsers set that to 16px unless a stylesheet overrides it, so 1rem is 16px on a default page. Change the root font size to 20px and 1rem becomes 20px, which is what makes rem scale with a reader's own font-size preference.

What is 20px in rem?

20px in rem units depends on the root font size. If the root font size is the browser default of 16px, 20px is 1.25rem (20 ÷ 16 = 1.25). This ensures scalability based on user preferences and accessibility. Always consider using relative units like rem for better responsiveness in web design.

Is 16px equal to 1rem?

By default, yes. Browsers use a root font size of 16px unless a stylesheet changes it, so 16px equals 1rem out of the box. If the root font size is set to something else, say 20px, then 1rem becomes 20px and the equivalence no longer holds, which is why this converter lets you set the base size yourself.

What is the difference between px and rem?

px is a fixed unit: 16px is always 16px wherever you put it. rem is relative to the root element's font size, so if the root is 16px then 1rem is 16px and 2rem is 32px, and raising the root to 20px makes 1rem 20px. px is useful when an element must be an exact size, such as a button or icon, while rem is preferred for typography because it adapts to the reader's font-size preference.

KaneAI - GenAI-Native Testing Agent

Did you find this page helpful?

More Tools

Related Tools
AI Agent Tools
Code Formatters & Minifiers

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests