px to rem converter
Convert between px, rem, em, pt, vw and percentages with a configurable root font size (16px by default), batch input, custom precision and clear invalid-value hints.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Settings
Single value
Formula: 1 rem = 16 px
241.51.5181.875150Batch conversion
| # | Input | Unit | px | rem | em | pt | vw | % |
|---|---|---|---|---|---|---|---|---|
| 1 | 16px | px | 16 | 1 | 1 | 12 | 1.25 | 100 |
| 2 | 1.5rem | rem | 24 | 1.5 | 1.5 | 18 | 1.875 | 150 |
| 3 | 24 | px | 24 | 1.5 | 1.5 | 18 | 1.875 | 150 |
| 4 | 2em | em | 32 | 2 | 2 | 24 | 2.5 | 200 |
| 5 | 12pt | pt | 16 | 1 | 1 | 12 | 1.25 | 100 |
| 6 | 5vw | vw | 64 | 4 | 4 | 48 | 5 | 400 |
| 7 | 50% | % | 8 | 0.5 | 0.5 | 6 | 0.625 | 50 |
Blank lines and lines starting with # are skipped
What this tool does
- Turn design-spec pixels into rem: with a 16px root font size, 24px becomes 1.5rem instantly instead of punching a calculator for every responsive rule.
- Reverse-engineer someone else's stylesheet: see 1.5rem and want to know the pixels? One conversion shows px, em, pt, vw and percent together.
- Build print stylesheets by converting between pt and px, using the fixed 1pt = 4/3 px ratio without memorizing the formula.
- Clean up a list of spacing or font-size values: one per line with or without a unit, and unparsable lines are reported with their line number and reason.
Example
Input
24px
Output
24 px · 1.5 rem · 1.5 em · 18 pt · 1.875 vw · 150 %
With the default 16px root font size, em base equal to the root and a 1280px viewport, 24px = 24/16 rem = 1.5rem and vw is 24/1280×100 = 1.875.
Frequently asked questions
What is the difference between rem and em?
rem is always relative to the html root font size and never changes when nested; em is relative to the current element font size and compounds with each parent. That is why em has its own base setting here, defaulting to the root size so you can point it at the real context.
A percentage of what, exactly?
Of the root font size — it is rem multiplied by 100. That makes it useful for line-height and font-size values that scale with text, but it is not a percentage of the container width.
Why does vw conversion need a viewport width?
Because 1vw is one percent of the viewport width, so without a width there is no pixel value to compute. The default assumes 1280px; set it to your actual design width for accurate numbers.
Which lines are skipped in batch mode?
Blank lines and lines starting with # are ignored. A line with a unit suffix (px/rem/em/pt/vw/%) is converted from that unit, and a unit-less line uses the input-unit setting, which defaults to px.
What happens when a line cannot be parsed?
The whole batch keeps going. An invalid number is reported as "cannot parse this value" and an unrecognized suffix as "unsupported unit", both with the original line number and text so you can fix and re-paste.
Keywords:px rempx 转 remrem 换算root font sizeemvwptrem to px响应式单位