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.
CSS Unit Converter
Any number. Negative values are kept.
1rem
| Unit | Value |
|---|---|
| px | 16 |
| rem | 1 |
| em | 1 |
| vw | 1.25 |
| vh | 2 |
| % | 100 |
| pt | 12 |
% 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.
Related tutorials
§04Toolbox
Related tools
Personalize your path
Choose your experience level once.
Next Step
Build fundamentals after each tool run so you can apply concepts with confidence.