CSS Unit Converter - px, rem, vw Conversion

Convert between px, rem, em, percent, vw, vh and pt with configurable root font size and viewport, plus a Tailwind class to CSS value reference.

Unit Converter

px
16
rem
1
em
1
%
100
vw
1.1111
vh
1.7778
pt
12

Tailwind Reference

Spacing & Sizing

p-0
0px
p-0.5
2px
p-1
4px
p-1.5
6px
p-2
8px
p-2.5
10px
p-3
12px
p-3.5
14px
p-4
16px
p-5
20px
p-6
24px
p-7
28px
p-8
32px
p-9
36px
p-10
40px
p-11
44px
p-12
48px
p-14
56px
p-16
64px
p-20
80px
p-24
96px

Font Size

text-xs
0.75rem / 12px
text-sm
0.875rem / 14px
text-base
1rem / 16px
text-lg
1.125rem / 18px
text-xl
1.25rem / 20px
text-2xl
1.5rem / 24px
text-3xl
1.875rem / 30px
text-4xl
2.25rem / 36px

Border Radius

rounded-sm
2px
rounded
4px
rounded-md
6px
rounded-lg
8px
rounded-xl
12px
rounded-2xl
16px
rounded-3xl
24px
rounded-full
9999px

Conversion runs locally in your browser. The Tailwind reference uses the default configuration.

About This Tool

The CSS Unit Converter solves a common source of mistakes: designs arrive in px, projects use rem, and responsive layouts need vw. Enter one value and every other unit is calculated at once.

It also includes a Tailwind reference for spacing, font size and radius, making it easy to switch between utility classes and plain CSS. All conversion happens locally.

Key Features

Seven units at once

Convert px, rem, em, percent, vw, vh and pt with results updating live.

Configurable baselines

Set the root font size, parent font size and viewport dimensions for your project.

Tailwind reference

Common spacing, font-size and radius classes with search by class or value.

One-click copy

Copy any converted value or reference row to avoid manual typing errors.

Local computation

No requests and no uploads of design or project data.

When to Use It

Design to rem

Convert design px values into rem to build a consistent responsive type and spacing scale.

Responsive sizing

Check the vw value of a width for a given viewport to prevent layout jumps across screens.

Tailwind audits

Find the actual pixel value behind classes like p-4 or text-sm when debugging overrides.

How to Use It

  1. 1Enter a value and choose its unit.
  2. 2Set the root font size, parent font size and viewport as needed.
  3. 3Review the converted values and copy the one you need.
  4. 4Search the Tailwind reference for the matching class.

Frequently Asked Questions

What is the difference between rem and em?

rem is always relative to the root font size, while em is relative to the parent element's font size and compounds when nested.

What is the percent based on?

This tool uses the parent font size, which suits typography. Width percentages need the parent container width instead.

Which Tailwind version does the reference use?

Common default values. If your project customized the theme, trust your own configuration.

Is my data uploaded?

No, conversion runs locally in your browser.

Other Tools

CodeSwordsman

100+ technical tools with browser-local processing — your data never leaves your device. Official Microsoft Store desktop apps: free, ad-free, offline.

Completely Free

© 2026 CodeSwordsman All Rights Reserved

Service Terms | Privacy Policy | Help | Version Updates | About Us

This website uses cookies to ensure you get the best experience on our website. Privacy Policy.