Quick

CSS Unit Converter

Convert between px, rem, em, percentage, pt, vw and vh, based on your font and viewport sizes.

Advertisement

About this tool

rem is always relative to the root (html) font size, which is 16px unless the user or your CSS changes it. em and percentage font sizes are relative to the parent element’s font size, so the same 1.5em can mean different sizes in different parts of a page; set the parent size to match where the value will be used.

vw and vh are percentages of the viewport (1vw is 1% of its width), prefilled with this browser window’s size; change them to check a phone (say 390 × 844) or a large monitor. pt is the print unit: in CSS, 1pt is exactly 4/3px, so 12pt equals 16px.

Using rem for font sizes, rather than px, means text scales when someone increases their browser’s default font size, which helps people with low vision and is part of meeting WCAG’s resize-text guidance.