CSS Unit Converter
A CSS unit converter lets you translate values between the many length units used in web styling. Whether you need to know how many pixels equal 2 rem, or how a percentage relates to a parent element's width, this tool does the math for you.
The conversion is based on the current document settings: the root font size for rem, the element's font size for em, and the standard 96 px = 1 in for absolute units. It’s useful for designers who need precise measurements across browsers.
Calculators Wiki provides this simple, no‑frills converter to keep your stylesheet calculations accurate.
How it's calculated
Basic relationships
- Absolute units: 1 in = 96 px, 1 cm = 37.7952755906 px, 1 pt = 1.3333333333 px.
- Relative units:
- - rem = root font size (default 16 px unless overridden).
- - em = current element's font size.
- - % = percentage of the reference length (e.g., width of the parent).
Conversion steps
- Convert the source value to pixels using the appropriate factor.
- Convert the pixel value to the target unit using the inverse factor.
Worked example
Convert 2 rem to px assuming the root font size is the default 16 px. 1. Pixels = 2 rem × 16 px/rem = 32 px. 2. If you wanted the result in centimeters: cm = 32 px ÷ 37.7952755906 px/cm ≈ 0.846 cm.
For more relative‑unit calculations see the rem calculator. Detailed unit definitions are available on the MDN Web Docs site: developer.mozilla.org