TXT · Text & Data tools

CSS Unit Converter

From
To
Auto-detect Input
Pixels (px) Output
Auto-detectInputPixels (px)Output11Items

Unit conversions

Convert CSS length values between px, rem, em, vw, vh, vmin, vmax, pt, and %. You can convert single values line by line or paste full CSS declarations. The tool automatically replaces matching values in the chosen source unit while preserving the rest of your formatting.

Base typography context

Relative units like rem, em, and % require a reference size. The Base Font setting determines this baseline (typically 16px). Adjust it to match your project’s root typography when converting to or from these units.

Viewport context

Viewport units depend on the browser window size. Configure the Viewport Width and Viewport Height to simulate a specific screen size. This ensures accurate pixel translations when converting responsive vw and vh values.

Frequently Asked Questions

This tool converts CSS length values between px, rem, em, vw, vh, vmin, vmax, pt, and %. You can convert plain numbers line by line or paste full CSS snippets and replace matching units automatically.

Yes. You can paste CSS declarations like margin, padding, font-size, width, height, or min-height, and the tool will find values in the selected source unit and convert them to the target unit.

These units depend on a reference size. In this tool, rem, em, and % conversions use the Base Font setting as the conversion context, so results match the assumptions you choose.

Viewport-relative units are based on the browser window size. The tool uses the Viewport Width and Viewport Height settings to calculate those conversions accurately for the screen size you want to simulate.

Yes. Use the swap button to instantly reverse the selected units, such as px to rem or rem to px, without re-entering your content.

It keeps each line and replaces matching values in the selected source unit. Plain numeric lines are treated as values in the source unit, while CSS lines are converted inline so you can copy the updated output directly.

Looking for a faster, single-purpose workflow?

Focused CSS unit converters

Explore Our Tools

Browse all tools