CSS Unit Converter
Convert between CSS units: px, rem, em, pt, vw, vh, cm, mm, and inches.
How to Use
Enter value and source unit
Input the numeric value and select the CSS unit you are converting from.
Configure base font size and viewport
Set the base font size (for rem/em) and viewport dimensions (for vw/vh) to match your design context.
View all equivalent values
See conversions to all other units simultaneously for easy comparison.
Copy the needed unit
Copy the CSS value in the target unit and paste directly into your stylesheet.
Why CSS Unit Conversion Matters
Modern responsive web design uses a mix of absolute (px, pt, cm) and relative (rem, em, vw, vh) units. Accurate conversion between them especially relative units like rem and vw which depend on base font size and viewport is critical for responsive layouts.
Real-World Examples & Use Cases
Responsive Typography with rem Units
Web designers implementing accessible typography need to use rem units (relative to the root font size) rather than px so text scales when users change their browser's default font size in accessibility settings. Converting a designer's pixel spec (e.g., 18px heading) to rem requires dividing by the root font size: 18 ÷ 16 = 1.125rem. A CSS unit converter automates this calculation for every text size in a design system, ensuring each element is correctly specified in rem.
Migrating Legacy CSS to Modern Units
Front-end developers updating legacy codebases built with pixel-based layouts need to convert px values to rem, em, or viewport units for responsive design. A CSS unit converter helps batch-convert values: checking that px values in an old design file correspond correctly to rem values in a modern design system, or converting pt values (common in print stylesheets) to px for digital use. This is essential when revamping a site for mobile responsiveness.
Print Stylesheet Development
Developers building print.css stylesheets for documents, invoices, and reports need to work in physical units: mm, cm, pt, and inches. A standard web designer thinks in px, but print requires knowing that A4 paper is 210mm × 297mm, that 1 inch = 72pt = 96px at 96dpi, and that 1cm = 37.8px. A CSS unit converter bridges the gap between screen-based development thinking and the physical measurements that print stylesheets require.
Design Token Calculation for Design Systems
Teams managing design tokens (standardized spacing, typography, and sizing values shared between design tools and code) frequently need to convert between units that Figma uses (px) and units that CSS best practices recommend (rem for text, em for component-relative sizing). A converter automates the space-4 = 16px = 1rem, space-6 = 24px = 1.5rem calculations needed to populate a design token library consistently.
How It Works
CSS Unit Conversion Formulas: Absolute units (fixed physical/screen sizes): 1in = 96px = 72pt = 2.54cm = 25.4mm 1cm = 10mm = 37.795px 1mm = 3.7795px 1pt = 1.333px = 1/72 inch Relative units (depend on context): 1rem = rootFontSize px (default: 16px) px to rem: rem = px ÷ rootFontSize rem to px: px = rem × rootFontSize 1em = parentFontSize px (varies by element) px to em: em = px ÷ parentFontSize 1vw = viewportWidth ÷ 100 px to vw: vw = (px ÷ viewportWidth) × 100 Example: 192px on 1920px viewport = 10vw 1vh = viewportHeight ÷ 100 px to vh: vh = (px ÷ viewportHeight) × 100 Important context dependencies: - rem conversions change if <html> font-size is set (e.g. 62.5% trick: rootFontSize=10px, 1rem=10px) - em conversions change per component (nested em elements compound: 1.2em × 1.2em = 1.44 effective em) - vw/vh values differ by viewport — always specify target viewport dimensions
Frequently Asked Questions
Should I use px or rem for font sizes?▼
What is the 62.5% root font size trick?▼
When should I use vw vs rem vs px for spacing?▼
How do I convert px to rem programmatically in CSS?▼
What is the difference between em and rem?▼
Related Tools
Explore other tools in this category.
JSON Formatter
Format, validate, prettify, and minify your JSON data quickly.
Password Strength Checker
Analyze how secure your password is and generate a strong one instantly.
Binary ? Text Converter
Convert plain text to binary code and decode binary back to readable text.
Text to Binary Converter
Convert letters and strings into computer binary format.
QR Code Generator
Create and download customized QR codes for URLs, text, and contacts.
Hex ? ASCII Converter
Convert text to hexadecimal and decode hex strings back to readable ASCII text.