Skip to content

CSS Units Converter — px, rem, em, vw, vh, pt

Convert between CSS units: px, rem, em, vw, vh, %, and pt. Bidirectional with configurable base font size and viewport dimensions.

CSS Units Converter — px, rem, em, vw, vh, pt

Configuration

Converted: 16 px, 1 rem

pxsource
16 px

Pixels

rem
1 rem

Root EM

em
1 em

Parent EM

vw
1.111111 vw

Viewport Width %

vh
1.777778 vh

Viewport Height %

%
100 %

Percentage

pt
12 pt

Points (print)

Quick reference: common px values

pxrememvwvh%pt
40.250.250.2777780.444444253
80.50.50.5555560.888889506
120.750.750.8333331.333333759
140.8750.8750.9722221.55555687.510.5
16111.1111111.77777810012
181.1251.1251.252112.513.5
201.251.251.3888892.22222212515
241.51.51.6666672.66666715018
32222.2222223.55555620024
402.52.52.7777784.44444425030
48333.3333335.33333330036
64444.4444447.11111140048
80555.5555568.88888950060
96666.66666710.666760072
128888.88888914.222280096

Updated . Provided as is. Check the output before you rely on it in production.

How to use CSS Units Converter — px, rem, em, vw, vh, pt

  1. 1

    Enter a value and select your source unit

    Type any number into the Value field and choose your starting unit (px, rem, em, vw, vh, %, or pt). All other units update instantly as you type.

  2. 2

    Configure root and parent font-size

    Set the root font-size (default 16px) to get accurate rem conversions. Set the parent font-size for em and % calculations — useful when you know the inherited font-size in your component tree.

  3. 3

    Set viewport dimensions for vw/vh

    Enter the target viewport width and height for accurate vw and vh conversions. Default is 1440×900 (typical desktop). Change to 375×812 for iPhone layout work.

  4. 4

    Copy any converted value

    Use the Copy control on any unit card to copy the numeric value to your clipboard — ready to paste directly into your CSS.

  5. 5

    Use the quick reference table

    Scroll down to see a reference table of common px values (4px–128px) converted to all units. Helpful for building consistent spacing scales.

Questions and answers

What is CSS Units Converter?
CSS mixes absolute units (px, pt) with relative ones (rem, em, %, vw, vh) whose size depends on font size or viewport. This converter shows one value in all seven units at once, using the root and parent font-size and viewport width and height you set, plus a table of common px values.
How do I convert px to rem?
Enter your pixel value, select px as the source unit, and configure the root font-size (default 16px). The rem value updates instantly. For example, 32px with a 16px root font-size equals 2rem.
Does CSS Units Converter store or send my data?
No. All calculations happen entirely in your browser. Your data never leaves your device — nothing is sent to any server.
What is the difference between rem and em?
rem (root em) is relative to the document root font-size (typically 16px). em is relative to the current element's parent font-size, which can cascade and change contextually. rem is generally more predictable for layouts.

Use it as an API

CSS Units Converter — px, rem, em, vw, vh, pt is also callable as a free HTTP JSON API at https://aidevhub.io/api/css-units-converter/ — GET with query parameters or POST with a JSON body, no authentication, CORS enabled, fair use (abusive traffic is throttled at the edge; there is no per-request quota header). Responses return { ok, tool, result, meta }.

curl -s "https://aidevhub.io/api/css-units-converter/?value=24&unit=px"

Machine-readable contract: /api/tool/css-units-converter.json All API endpoints: /agents/ LLM site index: /llms.txt

For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Dedicated API endpoint

Deterministic outputs, machine-safe contracts, and production-ready examples.

Dedicated API

https://aidevhub.io/api/css-units-converter/

OpenAPI: https://aidevhub.io/api/openapi.yaml

GET /api/css-units-converter/ GET css-units-converter
POST /api/css-units-converter/ POST css-units-converter