Free tool PX to REM converter for single values and whole stylesheets
Set your root font size, type a value in any unit and read all the others. Then paste a block of CSS or SCSS and convert every px value in one go, leaving comments, selectors, URLs and hairline borders alone.
- px, rem, em, pt, vw, rpx
- Batch CSS conversion
- Your CSS stays local
Convert px and rem
Change the root size to match your project; every value and the table update.
Saved to My tools
Open the free tools page next time and it is right at the top under My tools (stored in this browser only).
You can also press Ctrl+D to bookmark this page in your browser.You can also press ⌘+D to bookmark this page in your browser.You can also tap your browser’s Share button (at the bottom in Safari) and choose Add Bookmark or Add to Home Screen.You can also open the ⋮ menu at the top right and tap ☆ to bookmark it, or choose Add to Home screen.You can also tap ··· at the top right and choose Favorite, or open it in your browser and bookmark it there.
View My toolsThe font size of the html element. Browsers default to 16 px.
Used for vw and rpx.
Trailing zeros are dropped.
24px1.5rem1.5em18pt150%6.4vw48rpxConvert a block of CSS
Paste CSS, SCSS or Less, or open a file. Write PX in capitals to keep a single value as it is.
Values this small stay in px, for example 1 for hairline borders. 0 converts everything.
.card {
padding: 1.5rem 2rem;
border: 1px solid #e5e7eb;
border-radius: 0.75rem;
font-size: 0.875rem;
line-height: 1.25rem;
}
@media (min-width: 768px) {
.card { padding: 2.5rem; }
}6 value(s) converted. 1 left as they were because of your settings.
PX to REM table
| Pixels | REM | Points | Percent |
|---|---|---|---|
| 1px | 0.0625rem | 0.75pt | 6.25% |
| 2px | 0.125rem | 1.5pt | 12.5% |
| 4px | 0.25rem | 3pt | 25% |
| 6px | 0.375rem | 4.5pt | 37.5% |
| 8px | 0.5rem | 6pt | 50% |
| 10px | 0.625rem | 7.5pt | 62.5% |
| 12px | 0.75rem | 9pt | 75% |
| 13px | 0.8125rem | 9.75pt | 81.25% |
| 14px | 0.875rem | 10.5pt | 87.5% |
| 15px | 0.9375rem | 11.25pt | 93.75% |
| 16px | 1rem | 12pt | 100% |
| 18px | 1.125rem | 13.5pt | 112.5% |
| 20px | 1.25rem | 15pt | 125% |
| 22px | 1.375rem | 16.5pt | 137.5% |
| 24px | 1.5rem | 18pt | 150% |
| 28px | 1.75rem | 21pt | 175% |
| 30px | 1.875rem | 22.5pt | 187.5% |
| 32px | 2rem | 24pt | 200% |
| 36px | 2.25rem | 27pt | 225% |
| 40px | 2.5rem | 30pt | 250% |
| 48px | 3rem | 36pt | 300% |
| 56px | 3.5rem | 42pt | 350% |
| 64px | 4rem | 48pt | 400% |
| 72px | 4.5rem | 54pt | 450% |
| 80px | 5rem | 60pt | 500% |
| 96px | 6rem | 72pt | 600% |
| 128px | 8rem | 96pt | 800% |
Root rule
Only needed if you set the root size yourself. A percentage keeps the visitor’s browser font setting working.
html {
font-size: 100%; /* 16px */
}Share these inputs: the values go after the # in the link, so they never reach a server.
https://tapcub.com/tools/px-to-rem-converter
Done here? Try these next
Use this tool often? Save it to My tools.Saved to My tools. Find it any time at the top of the free tools page. You can also press Ctrl+D to bookmark this page in your browser.You can also press ⌘+D to bookmark this page in your browser.You can also tap your browser’s Share button (at the bottom in Safari) and choose Add Bookmark or Add to Home Screen.You can also open the ⋮ menu at the top right and tap ☆ to bookmark it, or choose Add to Home screen.You can also tap ··· at the top right and choose Favorite, or open it in your browser and bookmark it there.
Problem or suggestion?Send feedbackChat with support
Version v1.0Updated Update history
What each unit is relative to
px is fixed within the page; the others scale with something.
- Two-way, any root font size
- Batch convert CSS and SCSS
- Reference table

rem
Relative to the font size of the root element. If the root is 16 px, 1.5rem is 24 px. When a visitor raises the browser’s default font size, rem sizes grow with it.
em
Relative to the font size of the element itself (for font-size, of its parent). It compounds when nested, which rem does not.
pt
A print unit. In CSS 1pt is 1/72 inch and 1px is 1/96 inch, so 12pt equals 16px.
vw and rpx
1vw is 1% of the viewport width. rpx is used in WeChat mini programs, where the screen is always 750rpx wide.
In media queries, rem refers to the browser’s default font size, not to a size you set on html. That is one reason to leave breakpoints in px unless you want them to follow user settings.
Convert a design into rem
Three steps for a single value or a whole file.
-
1
Set the root size
Use 16 unless your stylesheet changes the html font size. With the 62.5% trick the root is 10 px.
-
2
Check single values
Type the pixel value from the design file and copy the rem value.
-
3
Convert the stylesheet
Paste the CSS, choose what to keep in px, then copy or download the result and review it in your project.
PX to REM formula
rem = px ÷ root font size. The reverse is px = rem × root font size.
- At a 16 px root: 16px = 1rem, 24px = 1.5rem, 14px = 0.875rem
- pt = px × 72 ÷ 96
- vw = px ÷ viewport width × 100
- rpx = px × 750 ÷ screen width
- Zero is written without a unit; comments, strings, selectors and url() are never changed
px → rem
rem = px ÷ root
24 ÷ 16 = 1.5rem
rem → px
px = rem × root
2.25 × 16 = 36px
px → vw
vw = px ÷ viewport × 100
30 ÷ 375 × 100 = 8vw
Converting a card component
The default sample, with a 16 px root and 1 px values left alone.
| Declaration | Before | After | Why |
|---|---|---|---|
| padding | 24px 32px | 1.5rem 2rem | 24 ÷ 16 and 32 ÷ 16 |
| border | 1px solid | 1px solid | At or below the 1 px limit |
| border-radius | 12px | 0.75rem | 12 ÷ 16 |
| font-size | 14px | 0.875rem | 14 ÷ 16 |
| line-height | 20px | 1.25rem | 20 ÷ 16 |
| @media (min-width: 768px) | 768px | 768px | Media queries are off by default |
| padding inside the query | 40px | 2.5rem | 40 ÷ 16 |
Six values are converted and one is left in px. Turn on “Also convert media queries” and the breakpoint becomes 48rem.
Pitfalls when moving to rem
rem is useful because it follows user settings; these habits defeat that.
Setting html to a fixed pixel size
html { font-size: 16px } overrides the visitor’s browser setting. Leave it alone or use a percentage.
Forgetting a changed root
If one stylesheet sets the root to 62.5%, converting with base 16 makes everything 62.5% of the intended size.
Converting hairlines
A 1 px border turned into 0.0625rem can round to nothing or look uneven. Keep very small values in px.
Using em where you mean rem
Nested em font sizes multiply: three levels of 1.2em give 1.728 times the base.
Check how the page performs for real visitors
Layout changes are easiest to judge with real data. TapCub collects page speed and screen sizes from the same snippet that counts visits.
Core Web Vitals by page
LCP, INP and CLS at the 75th percentile for each page, with the slowest pages first.
Learn moreScreens on the audience page
Visitors are grouped into CSS width ranges, and a click filters other reports by that range.
Learn moreOne deferred snippet
The analytics script loads with defer and does not block rendering.
PX and REM questions
Still have a question?
Chat with the team behind TapCub — we usually reply within a few hours on business days.
How many rem is 16px?
1rem, as long as the root font size is the browser default of 16 px. With a 10 px root it would be 1.6rem.
Should I use px or rem?
rem for font sizes and usually for spacing, so layouts respect the reader’s font setting. px is reasonable for borders, shadows and other details that should not grow.
How do I convert a 375 or 750 px mobile design?
If the root size is set to one tenth of the design width, use 37.5 for a 375 design or 75 for a 750 design. If you prefer viewport units, enter the design width as the viewport and copy the vw value: 30 px on a 375 design is 8vw.
What is the 62.5% trick?
Setting html { font-size: 62.5% } makes 1rem equal 10 px at default settings, so 24 px is 2.4rem. Remember to set a readable size on body afterwards, and check third-party components that assume 16 px.
Can I convert a whole CSS file?
Yes. Open a file or paste it into the batch box. The converter changes values in declarations, and leaves comments, strings, selectors, url() and anything written as PX or Px untouched.
How does it compare with postcss-pxtorem?
The idea is the same: divide by a root value and keep small or capitalised values. A build plugin is the better choice for an ongoing project; this page is for one-off conversions and checking numbers.
Is my CSS uploaded?
No. It is converted in your browser. The CSS is not stored, put in the share link or included in analytics.
Is this tool working for you?
Rate it, or tell us what went wrong and what you’d like improved. A person reads every message, and frequent requests go into the next update.
Need help right now?
Chat with our support team, best for urgent problems; you can leave a message when we are offline.
Chat with supportUpdate history
New features, fixes and data refreshes for this tool, newest first.
-
· v1.0
LaunchedFirst release.
Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates
Recommend this tool in an article or on your site
This tool is free to cite and share. Copy the URL or link below into your article, tutorial or resource page; to write a review, embed a tool or partner with us, get in touch.
https://tapcub.com/tools/px-to-rem-converter<a href="https://tapcub.com/tools/px-to-rem-converter">PX to REM converter - TapCub</a>More CSS and layout tools
Once the units are right, tidy and shrink the stylesheet.