Skip to content
UniKit

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

4

Single value

Formula: 1 rem = 16 px

Pixels (px)24
rem1.5
em1.5
Points (pt)18
Viewport width (vw)1.875
Percentage (%)150

Batch conversion

One value per line
#InputUnitpxrememptvw%
116pxpx1611121.25100
21.5remrem241.51.5181.875150
324px241.51.5181.875150
42emem3222242.5200
512ptpt1611121.25100
65vwvw6444485400
750%%80.50.560.62550

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响应式单位

Related tools