Command Palette

Search for a command to run...

CS

CSS Unit Converter

Convert between CSS units - px, rem, em, pt and % - with a configurable root font size, instant all-units output, and a px-to-rem reference table for responsive typography.

What is a CSS Unit Converter?

A CSS Unit Converter translates a length between the units CSS uses for sizing type and layout: px, rem, em, pt, and %. It exists because modern responsive design leans on relative units - rem and em scale with the user’s font-size settings and zoom - while design mockups and older stylesheets are usually expressed in fixed pixels. This tool takes a value like 24px and shows it as 1.5rem, 1.5em, 18pt, and 150% at once, and works in every direction from a single field.

The conversions all hinge on one number: the root (base) font size, which defaults to 16px because that is the browser default for the html element. One rem always equals that base font size, so at 16px the value 16px is 1rem, 24px is 1.5rem, and 8px is 0.5rem. Points are tied to the CSS reference pixel - 1 inch is 96px and 72pt - so 1pt equals 96/72, about 1.333px. Percent is treated as a share of the base font size, so 100% equals the base and 50% equals half of it.

Every conversion takes two steps. The tool first turns your input into pixels by multiplying it by the number of pixels in one input unit, then divides that pixel value by the number of pixels in one target unit. At an 18px base, 27px becomes 27 ÷ 18 = 1.5rem, and at any base 12pt becomes 12 × 96 ÷ 72 = 16px. Results are rounded to at most four decimal places, so 15px at a 16px base reads 0.9375rem. Viewport units such as vw and vh are not part of the converter, because they depend on the window size rather than a font size. A base font size of zero or less falls back to 16px.

Everything runs in your browser as you type, so there is no upload and no waiting on a server. Change the base font size to model a component that sets its own font-size, read the results in every unit, and copy the one you need. The built-in px-to-rem table gives you a ready reference for the sizes that come up most in a type scale.

How to use the CSS Unit Converter?

  1. Enter a value and pick its unit

    Type the number you want to convert and choose the unit it is currently in - px, rem, em, pt, or %. You can also paste a value with its unit, like 24px, and the tool will read the unit for you.

  2. Set the base font size

    Adjust the root font size if your project uses something other than the 16px browser default. This controls how rem, em, and % relate to pixels.

  3. Read every unit at once

    The converter shows the equivalent value in all supported units instantly, each with its unit suffix so you can drop it straight into CSS.

  4. Copy or use the reference table

    Copy any result with one click, or scan the px-to-rem reference table for the common sizes in a typographic scale.

Key Features

  • Every unit at once

    Enter one value and instantly see px, rem, em, pt, and % side by side, each formatted with its unit so you can paste it directly into a stylesheet.

  • Configurable base font size

    The root font size is adjustable, so rem, em, and % conversions match your project - whether you use the 16px default, a 10px "62.5%" trick, or a component-level font-size.

  • Two-way, any direction

    There is no fixed "from" and "to". Convert px to rem, rem to px, px to em, or pt to px - any unit to any unit - from a single input.

  • Px-to-rem reference table

    A built-in table lists the rem, em, pt, and % equivalents for the pixel sizes that appear most in type scales, so you can eyeball a whole scale at your chosen base.

Frequently Asked Questions

Divide the pixel value by the root font size. At the browser default of 16px, rem = px ÷ 16, so 16px is 1rem, 24px is 1.5rem, and 8px is 0.5rem. Enter the pixel value in the converter and the rem equivalent appears instantly at whatever base font size you set.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

px to rem converterrem to px converterpx to em convertercss unit converterpx to pt converterrem calculatorem to pxcss font size converterpixel to remresponsive font size converter