CSS Unit Converter
Convert CSS units between px, rem, em, vw, vh and percentages with a configurable root font size and viewport.
Context
html font-size, used by rem
used by em
parent font size or container width
used by vw, vmin, vmax
used by vh, vmin, vmax
Absolute units follow the CSS reference: 1in = 96px = 2.54cm, 1pt = 1/72in, 1pc = 12pt. On screens these are not physical inches.
px → rem table (root 16px)
| px | rem | em | pt | Copy |
|---|---|---|---|---|
| 1px | 0.0625rem | 0.0625em | 0.75pt | |
| 2px | 0.125rem | 0.125em | 1.5pt | |
| 4px | 0.25rem | 0.25em | 3pt | |
| 6px | 0.375rem | 0.375em | 4.5pt | |
| 8px | 0.5rem | 0.5em | 6pt | |
| 10px | 0.625rem | 0.625em | 7.5pt | |
| 12px | 0.75rem | 0.75em | 9pt | |
| 13px | 0.8125rem | 0.8125em | 9.75pt | |
| 14px | 0.875rem | 0.875em | 10.5pt | |
| 15px | 0.9375rem | 0.9375em | 11.25pt | |
| 16px | 1rem | 1em | 12pt | |
| 18px | 1.125rem | 1.125em | 13.5pt | |
| 20px | 1.25rem | 1.25em | 15pt | |
| 22px | 1.375rem | 1.375em | 16.5pt | |
| 24px | 1.5rem | 1.5em | 18pt | |
| 28px | 1.75rem | 1.75em | 21pt | |
| 32px | 2rem | 2em | 24pt | |
| 36px | 2.25rem | 2.25em | 27pt | |
| 40px | 2.5rem | 2.5em | 30pt | |
| 48px | 3rem | 3em | 36pt | |
| 56px | 3.5rem | 3.5em | 42pt | |
| 64px | 4rem | 4em | 48pt | |
| 72px | 4.5rem | 4.5em | 54pt | |
| 80px | 5rem | 5em | 60pt | |
| 96px | 6rem | 6em | 72pt | |
| 128px | 8rem | 8em | 96pt |
What is the CSS Unit Converter?
The CSS Unit Converter turns any length into every CSS unit at once: px, rem, em, %, vw, vh, vmin, vmax, pt, pc, in, cm and mm. Relative units depend on context, so you can set the root font size (for rem), the parent font size (for em), what 100% refers to, and the viewport size (for vw/vh) — with phone, tablet and desktop presets or the size of your current window.
The Convert CSS mode rewrites a whole stylesheet from px to rem (or back) in one pass. It skips comments, strings, url() paths and class names, can keep 1px borders as pixels, and leaves media queries alone unless you ask otherwise. A px-to-rem reference table for the chosen root size is included for quick lookups. Everything is calculated locally in your browser.
Frequently asked questions
- How do I convert px to rem?
- Divide the pixel value by the root font size. With the browser default of 16px, 24px ÷ 16 = 1.5rem. If your CSS sets html { font-size: 62.5% } the root is 10px, so 24px = 2.4rem — change the root font size field to match.
- What is the difference between rem and em?
- rem is always relative to the root <html> font size, so it is predictable everywhere. em is relative to the font size of the element's parent (or the element itself for properties other than font-size), so nested em values compound.
- Why use rem instead of px?
- rem sizes scale with the user's browser font-size setting. Visitors who enlarge their default text size get a proportionally larger layout, which is an accessibility win — fixed px font sizes ignore that preference.
- What does % convert to?
- A percentage is relative to something different for each property: the parent font size for font-size, the containing block's width for width and padding. Set “100% equals” to that reference value in px to get the right result.
- Are cm, mm and in physical sizes?
- In CSS they are fixed ratios of the px unit (1in = 96px, 1cm ≈ 37.8px), not true physical lengths on screen. They do match physical size when printing.
- Should media queries use rem or px?
- rem and em in media queries are always based on the browser's default font size (usually 16px), not on your html font-size. That's why the CSS converter leaves media queries in px unless you enable converting them.
- Is my CSS uploaded anywhere?
- No. Conversion happens entirely in your browser and nothing you paste leaves your device.
Related tools
- Base64 EncoderEncode and decode Base64 for text and files, with URL-safe mode, data URIs, file type detection and image preview. Fast, private and offline.
- Timestamp ConverterConvert Unix epoch timestamps (seconds or milliseconds) to human-readable dates in any time zone, and dates back to timestamps.
- Number Base ConverterConvert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, including arbitrarily large integers.
- JSON ⇄ CSVConvert JSON arrays to CSV and CSV back to JSON with custom delimiters, header detection, nested-field flattening and file download.
- YAML ⇄ JSONConvert YAML to JSON and JSON to YAML instantly with validation and clear error messages. Ideal for Kubernetes, Docker Compose and CI configs.
- Word & Char CounterCount words, characters, sentences and paragraphs, estimate reading and speaking time, check platform limits and analyze keyword density — all in your browser.