DEV Community

Dev Nestio
Dev Nestio

Posted on

CSS Unit Converter — px, em, rem, vw, vh, %, pt, cm, mm, in all in one tool

What I built

Added a CSS Unit Converter to devnestio.

👉 https://css-unit-converter-edi.pages.dev

Enter a value, pick a unit, and instantly see conversions to all 10 CSS units. Configurable base font size, viewport, and parent size.


Supported Units

  • px Pixels (absolute)
  • em Relative to parent font size
  • rem Relative to root font size
  • vw Percent of viewport width
  • vh Percent of viewport height
  • % Percent of parent element
  • pt Points (1pt = 1/72 in)
  • cm Centimeters
  • mm Millimeters
  • in Inches

Features

  • Live conversion — all 10 units update as you type
  • Configurable base font size, viewport width/height, parent element size
  • Copy any value as a CSS-ready string (e.g. 1rem, 14.4vw)
  • Formula panel showing the math for each conversion
  • Source unit highlighted

Tech

  • Pure Vanilla JS, zero dependencies
  • 87 Node.js assert tests covering all conversion formulas and round-trips
  • Single HTML file, hosted on Cloudflare Pages

Try it

👉 CSS Unit Converter

All tools: https://devnestio.pages.dev

Top comments (0)