Skip to content
epitometool

CSS unit converter

CSS & UI generators

Convert between px, rem, em, pt, vw and vh with a configurable root font size and viewport — see every equivalent at once.

Updated

Value to convert

Context

Relative units need a reference. Defaults match a typical browser.

Equivalents

Quick start

How to use the CSS unit converter

Enter a value, set the context, copy the equivalent — all in your browser.

  1. Step 1
    Enter a value and unit

    Type the number and choose px, rem, em, pt, vw or vh.

  2. Step 2
    Set the context

    Adjust root font size and viewport size so relative units resolve correctly.

  3. Step 3
    Copy an equivalent

    Click any result card to copy that value with its unit suffix.

In-depth guide

Converting between CSS units: px, rem, em, pt, vw, vh

CSS length units fall into two camps: absolute (px, pt) and relative (rem, em, vw, vh). Converting between them requires context — a root font size for rem/em and a viewport size for vw/vh. This tool does the maths in your browser and shows the equivalent value in every unit at once, so you can swap a hard-coded pixel value for a responsive one with confidence.

What each unit means

  • px — a CSS pixel, the absolute reference for everything else.
  • rem — relative to the root (:root / html) font size; the go-to responsive unit.
  • em — relative to the current element's font size, which cascades from its parent.
  • pt — points, a print unit where 72pt = 1 inch = 96px.
  • vw / vh — 1% of the viewport width / height, for layout that scales with the screen.

When to convert and which unit to pick

Reach for this converter whenever you inherit a fixed pixel design and want responsive CSS:

  • Typography and spacing → rem, so it respects the user's font-size preference.
  • Full-bleed sections, hero heights → vw / vh.
  • Borders and hairlines → px, which should not scale.
  • Print stylesheets → pt, the native unit for paper output.

Step by step

  1. Type the value and pick its unit.
  2. Set the context — root font size (default 16px) and viewport size (default 1280×800) — to match your project.
  3. Read the equivalents; the card matching your input unit is highlighted.
  4. Click any card to copy that value with its unit suffix ready to paste into CSS.

Common pitfalls

  • em is contextual. This tool resolves em against the root for simplicity. In a real cascade, an em nested inside a larger parent font-size produces more pixels — always test in the actual element tree.
  • Root font size is not always 16px. If your CSS sets html { font-size: 62.5% } (a common 10px trick), update the root field or your rem values will be wrong.
  • vw includes the scrollbar in some browsers. A 100vw element can overflow slightly; account for it with max-width: 100%.

Privacy and how it runs

Every conversion is plain arithmetic executed in your browser. No values are sent anywhere, nothing is logged, and the page keeps working offline after the first load. There is no data to leak because the tool never talks to a server.

Frequently asked questions

How does the px to rem conversion work?

rem is relative to the root font size. With the default root of 16px, 16px = 1rem, 24px = 1.5rem, and so on. Change the root font-size field if your :root sets a different base, and every rem/em value updates to match.

Why do em and rem show the same number here?

em is relative to the font size of the current element, which cascades from its parent, while rem is always relative to the root. Because this tool has no element tree, it treats em against the same base as rem. In real CSS, an em inside a parent with a larger font-size will resolve to more pixels.

How are vw and vh calculated?

1vw is 1% of the viewport width and 1vh is 1% of the viewport height. The tool uses the viewport width and height you supply (default 1280×800), so 50vw at 1280px wide equals 640px. Adjust the viewport fields to match the device you are targeting.

What is the px to pt relationship?

CSS defines 1 inch as 96px and 72pt, so 1pt = 96/72 = 1.333…px, and 1px = 0.75pt. Points come from print typography; for screens you almost always want px or rem instead.

Should I use px or rem for font sizes?

rem is generally preferred for typography and spacing because it scales with the user's browser font-size preference, improving accessibility. px is fine for borders, hairlines, and anything that should stay fixed regardless of zoom or root size.

Does this tool send my values to a server?

No. All conversions are arithmetic performed in your browser. Nothing is uploaded or stored — the page works fully offline once loaded.

Keep exploring

More tools you'll like

Hand-picked utilities that pair well with the one you're on — all free, client-side, and zero-signup.