CSS Units Calculator

Convert between CSS length units - px, rem, em, pt, vw, and vh - for any root font size, making responsive design and accessibility-compliant spacing easy.

Frequently Asked Questions

How do px, rem, and em relate?

rem is relative to the root font size and em to the element's own font size. At a 16 px root, 1 rem = 16 px, so 24 px = 24 ÷ 16 = 1.5 rem.

How do I convert px to rem?

Divide pixels by the root font size: rem = px ÷ root-px. With a 16 px root, 10 px = 0.625 rem and 32 px = 2 rem.

How does pt relate to px on the web?

CSS defines 1 pt = 1/72 inch and 1 px = 1/96 inch, so 1 pt = 96 ÷ 72 = 1.333… px. Thus 12 pt ≈ 16 px, which is why 12 pt and a 16 px root often coincide.

When should I use rem vs em?

Use rem for consistent, predictable sizing tied to the root (good for type scales and spacing), and em when you want a value to scale with its local context, such as padding that grows with a button's font size.

Important Disclaimer: Estimates for informational purposes only.

This calculator provides estimates for informational purposes only. Results are based on assumptions and may not reflect actual outcomes. Consult qualified professionals in relevant fields before making important decisions based on these results.