Developer tool / 18

CSS Unit Converter (px / rem / em / vh / vw)

Convert pixel sizes to rem, em, vw, and vh relative to a root base size (default 16px).

CSS Unit Converter (px / rem / em / vh / vw): TOEA computes relative CSS font and layout units and generates reference scale tables. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Pixels
24px
REM
1.5rem
EM
1.5em
VW (1440px)
1.6667vw
font-size: 1.5rem; /* 24px */

Pixel to REM Conversion Scale Table (16px Base)

1px0.0625rem0.0625em
2px0.125rem0.125em
4px0.25rem0.25em
8px0.5rem0.5em
10px0.625rem0.625em
12px0.75rem0.75em
14px0.875rem0.875em
16px1rem1em
18px1.125rem1.125em
20px1.25rem1.25em
24px1.5rem1.5em
28px1.75rem1.75em
32px2rem2em
36px2.25rem2.25em
40px2.5rem2.5em
48px3rem3em
56px3.5rem3.5em
64px4rem4em
72px4.5rem4.5em
80px5rem5em
96px6rem6em
128px8rem8em

Why rem instead of px

Browsers start at 16px, but people with low vision often raise the default font size in their browser settings. Text sized in rem grows with that setting; text sized in px does not. Page zoom enlarges both, but the font-size setting is what many readers rely on, and WCAG's resize-text criterion expects text to scale to 200% without loss. Size type, and the spacing around it, in rem, and keep px for hairlines and borders.

The em column and nesting

An em is relative to the element's own font size, which for font-size itself means the parent's. The em values here assume the parent is at the root size, which holds only at the top level. Inside a 0.875em element, 0.875em again gives 12.25px rather than 14px, and the shrinking compounds. That is why rem is the safer default and em suits spacing that should scale with its component's text.

The 62.5% base and viewport units

Setting html { font-size: 62.5% } makes 1rem equal 10px, which is easier arithmetic; enter 10 as the base size to match. It shrinks everything else sized in rem, including third-party components, so set a readable size on body again.

The vw and vh figures assume a 1440 × 900 viewport. On phones, 100vh can be taller than the visible area while the browser toolbar shows; 100svh and 100dvh are the units that account for it.

How to use it

  1. Enter a pixel value (px) and root base size (default 16px).
  2. Inspect calculated rem, em, vw, and vh values.
  3. Copy ready-to-use CSS snippets or consult the scale table.

Privacy & limitations

Runs instantly in client-side JavaScript.

Related tools

Frequently asked questions

What is the standard root font base size?

Most modern web browsers default to 16px.

Free tool · runs in your browser · no account required