Skip to main content

InstrumentsCSS Unit Converter

CSS Unit Converter

Convert a CSS length between px, rem, em, vw, vh, percent and pt, with the context sizes that each unit needs.

All tools

CSS Unit Converter

Any number. Negative values are kept.

Context sizes

Sets rem. Browsers start at 16px unless a site sets another size.

Sets em and %, which both follow font-size here.

Sets vw.

Sets vh.

Converted value
1rem
Your value in every CSS unit
UnitValue
px16
rem1
em1
vw1.25
vh2
%100
pt12

% and em follow font-size in this converter. Both are measured against the parent element's font size, the same base font-size uses. Other properties resolve percentages differently: a width or margin percentage is measured against the containing block, so the % value here does not apply to them. rem uses the root font size, and vw and vh use the viewport size you enter.

FAQ

Why does % use the font size here?

In this converter, % is a share of the parent font size, the same base that font-size uses for percentages. A percentage in a width, margin or padding is a share of the containing block instead, so a value converted here does not carry over to those properties.

Which viewport size should I enter?

Enter the width and height you design for. vw and vh are fixed shares of the viewport, and the size a browser reports can differ from your design size, for example because of a scrollbar.

How are pt and px related?

In CSS, one point is 4/3 of a pixel, so 12pt equals 16px. The converter uses that CSS value. Printed sizes can differ from screen sizes, so check a print stylesheet on paper or in print preview.

  1. 01CSS Variables Architecture: Theming & Token SystemsTutorial
  2. 02CSS Container Queries: Component-Driven ArchitectureTutorial

Personalize your path

Choose your experience level once.

Next Step

Build fundamentals after each tool run so you can apply concepts with confidence.

Get new tool alerts

Receive updates when new tools are published.

RSS feed