Unit Converter

What Is a Unit Converter?

This unit converter handles six CSS units: px, rem, em, pt, vw and vh. Understanding the relationships between these units is essential for responsive design, accessible typography, and consistent spacing systems.

CSS Unit Guide

px — fixed, absolute pixels. rem — relative to root font size (default 16px). em — relative to parent's font size (compounds in nested elements). vw/vh — percentage of viewport width/height. % — percentage of parent element. pt — points (1pt = 1/72 inch), used in print. Use our PX to REM converter for bulk CSS conversions.

How to Use This Unit Converter

  1. Enter a value — Type the number you want to convert in the input field.
  2. Select the source unit — Choose the unit you're converting from: px, rem, em, pt, vw or vh.
  3. Select the target unit — The value is shown in all six units at once, ready to copy.
  4. Set the base font size — For rem and em conversions, specify the root font size (typically 16px) to ensure accurate results.

Worked example: four sizes at the default settings

The converter turns the value into px, then into each of six units: px, rem, em, pt, vw and vh. Its defaults are a 16 px base font, a 1440 × 900 viewport, and 1 pt = 96/72 px, the CSS definition. The last column uses a 375 px phone width instead.

Inputrem / emptvw (1440)vh (900)vw (375 phone)
12 px0.7590.83331.33333.2
16 px1121.11111.77784.2667
24 px1.5181.66672.66676.4
48 px3363.33335.333312.8

Frequently Asked Questions

What units does this support?
Six CSS units: px, rem, em, pt, vw and vh. Rem and em use the base font size you set, vw and vh use the viewport width and height you enter (1440 × 900 by default), and pt uses the CSS definition 1pt = 96/72 px. Percentages, mm, cm and in are not converted.
em vs rem?
Both are relative, but em is relative to the parent's font size (compounds in nesting), while rem is relative to the root font size (predictable, doesn't compound).
px vs rem?
Use rem for font sizes, spacing, and layout (scales with accessibility settings). Use px for borders, shadows, and exact-pixel needs. Use em for component-level scaling.
What is the difference between px, em, and rem?+
Pixels (px) are absolute units — 1px is always 1px regardless of context. Em is relative to the parent element's font size, so it compounds when nested. Rem is relative to the root (html) element's font size, making it consistent throughout the page. For most use cases, rem is the best choice.
How do I convert px to rem?+
Divide the pixel value by the root font size (usually 16px). For example: 24px ÷ 16 = 1.5rem. Our converter handles this math automatically for any base font size.
When should I use viewport units (vw, vh)?+
Viewport units are ideal for full-screen sections (height: 100vh), responsive spacing that scales with screen size, and fluid typography (combined with clamp). Avoid using vw/vh alone for font sizes, as they can become too small on mobile or too large on desktop.
What units does this converter support?+
Six CSS units: px, rem, em, pt, vw and vh. Rem and em use the base font size you set, vw and vh use the viewport width and height you enter (1440 × 900 by default), and pt uses the CSS definition 1pt = 96/72 px. Percentages, mm, cm and in are not converted.
What is the difference between em and rem?+
Both are relative units, but em is relative to the parent element's font size, while rem is relative to the root (html) font size. Rem is more predictable because it doesn't compound — nested elements with em sizing can produce unexpected results.
When should I use px vs rem?+
Use rem for font sizes, spacing, and layout dimensions — they scale with user accessibility settings. Use px for borders, shadows, and cases where you need exact pixel values. Use em for component-level scaling where children should inherit parent sizing.

📖 Learn More

Related Article The Complete Guide to CSS Units → Related Article How to Convert CSS Units →

Built by Derek Giordano · Part of Ultimate Design Tools

Privacy Policy · Terms of Service