CSS unit converter. Convert between px, rem, em, vw, vh, %, pt, and more with base size and viewport control. Real-time results.
100% browser-based — your data never leaves your device
Convert between CSS units: px, rem, em, pt, %, vw, vh, and more.
Type a number in the value field. Conversion happens instantly as you type.
Choose the source and target units from the dropdown menus.
Click the swap button to quickly reverse the from/to units.
Click the copy button next to any result to copy the value with its unit.
| Unit | Value | |
|---|---|---|
| px | 16.0000 | |
| em | 1.0000 | |
| rem | 1.0000 | |
| % | 0.8333 | |
| vw | 0.8333 | |
| vh | 1.4815 | |
| vmin | 1.4815 | |
| vmax | 0.8333 | |
| cm | 0.4233 | |
| mm | 4.2334 | |
| in | 0.1667 | |
| pt | 12.0000 | |
| pc | 1.0000 | |
| ch | 2.0000 | |
| ex | 2.0000 |
Generate harmonious color palettes with monochromatic, analogous, complementary, triadic, and tetradic schemes.
Border Radius GeneratorGenerate CSS border-radius values with a visual preview. Create smooth corners and custom shapes for your elements.
Box Shadow GeneratorCreate custom CSS box-shadow effects with a visual editor.
CSS Gradient GeneratorCreate linear and radial CSS gradients with a visual editor.
CSS Unit ConverterConvert between CSS units: px, rem, em, pt, %, vw, vh, and more.
CSS Grid GeneratorCreate CSS grid layouts visually with customizable columns, rows, and gaps.
Flexbox GeneratorCreate flexbox layouts visually with alignment, direction, and wrapping controls.
Bezier GeneratorCreate and preview CSS cubic-bezier easing curves for animations and transitions.
CSS units look interchangeable until you realize that rem and em depend on context and vw depends on the viewport. This converter accounts for all of that context:
The gap between design mockups and production CSS is measured in units. Designers hand off sizes in pixels, but accessible, scalable production code increasingly uses rem for typography, em for text-relative sizing, and viewport units for responsive behavior. Developers translating mockup pixels into rem for accessible typography, calculating viewport-based sizes for responsive layouts, and moving pt and px values from design files into production CSS will use this tool constantly.
The coverage is broad: px, rem, em, pt, pc, in, cm, mm, q, vw, vh, vmin, vmax, percent, ch, and ex. What makes the results trustworthy is the context handling. The base-size control defaults to a 16px root font size but accepts your project's actual root setting, and the viewport context lets you match your design breakpoint for vw and vh calculations. Everything recalculates in real time as you type, so exploring several target units takes seconds rather than a sequence of searches.
The unit values in a design system are details, but they are details that reveal the structure of an unreleased product. Sending typography scales, spacing tokens, and breakpoint math to an online converter exposes the skeleton of your build before it ships.
This converter computes everything locally in your browser. Your values, root sizes, and viewport settings never leave your device, so proprietary design tokens and the calculations around them stay private.
Type the numeric value you want to convert in the input field.
Choose the unit you're converting from (e.g., px) and the unit you want to convert to (e.g., rem).
Set your project's root font-size for rem/em accuracy, or viewport dimensions for vw/vh conversions.
Practical examples to help you get the most out of CSS Unit Converter:
Input: 16px Base: 16px Output: 1rem 16px at default 16px base equals exactly 1rem.
Input: 100px Viewport: 1920px Output: 5.208vw 100px on a 1920px viewport equals ~5.21vw.
Users can change their browser's default font-size. Always set a root font-size (e.g., html { font-size: 16px }) for predictable rem values.
Pure vw font sizes don't zoom when users resize the browser. Use a clamp() function with min and max values for responsive yet accessible type.
rem is relative to the root element's font-size (usually 16px on browsers), while em is relative to the parent element's font-size. This makes rem more predictable for global spacing.
Enter your px value and select vw as the target unit. Set the viewport width to match your design breakpoint (default 1920px). The tool computes the equivalent vw value.
Convert between px, rem, em, pt, pc, in, cm, mm, q, vw, vh, vmin, vmax, %, ch, ex.
Set custom root font-size (default 16px) for accurate rem/em conversions.
Set viewport dimensions for accurate vw/vh/vmin/vmax conversions.
See all conversions update simultaneously as you type.
CSS Unit Converter is useful in a variety of scenarios across different workflows:
Converting pixel designs to rem units for accessible, scalable typography
Calculating viewport-based sizes for responsive layouts
Translating design mockup units (px, pt) to production CSS units
Accurate rem/em conversions depend on your base font size. The default is 16px, but adjust it to match your project's CSS root font-size setting.
rem units are relative to the root element and consistent everywhere — ideal for margins and padding. em units are relative to the parent and best for text-relative sizing.
Explore more tools in the Design workspace:
Color Palette Generator
Generate harmonious color palettes with monochromatic, analogous, complementary, triadic, and tetradic schemes.
Border Radius Generator
Generate CSS border-radius values with a visual preview. Create smooth corners and custom shapes for your elements.
Box Shadow Generator
Create custom CSS box-shadow effects with a visual editor.
CSS Gradient Generator
Create linear and radial CSS gradients with a visual editor.
CSS Grid Generator
Create CSS grid layouts visually with customizable columns, rows, and gaps.
Flexbox Generator
Create flexbox layouts visually with alignment, direction, and wrapping controls.