💻 Web Dev Tools

CSS Units Converter

Convert between px, rem, em, vw, vh, vmin, vmax, pt, pc, cm, mm and in instantly. Set your custom base font size and viewport dimensions. See all unit conversions at once from a single input — with the rem vs em distinction explained.

12 CSS units at once rem vs em distinction modelled Custom base font + viewport Conversion history
AdSense — 728×90 Leaderboard

CSS Units Converter Tool

px (default 16px for rem)
px (for em)
px
px
Select source unit
ℹ️ rem vs em: rem (root em) is always relative to the root font size above — it never compounds. em is relative to the parent element's font size, which can compound in nested elements. Use the Parent font size field to model em accurately for your context.
Relative units
Viewport units
Absolute units
AdSense — 728×90 Leaderboard
💥
Building box shadows for your CSS layout?
The free CSS Box Shadow Generator builds multi-layer shadows visually with sliders, Material Design and Tailwind presets, inset shadow support and copy-as-CSS-variable — a natural companion to your CSS unit work.
💥 CSS Box Shadow →
⭐ User Ratings

Rate this tool

4.9
Based on 11,284 ratings
5
10,268
4
677
3
226
2
57
1
56
Was this CSS unit converter helpful?
Thank you for your rating!
Features

rem vs em distinction, viewport reference input, all units at once — features most CSS unit converters miss

Most CSS unit converters convert from one unit to one other unit. This tool shows all 12 unit conversions simultaneously from a single input, correctly models the rem vs em distinction, accepts a custom parent font size for accurate em calculations, and lets you set the exact viewport dimensions for vw/vh accuracy.

📊
All 12 units simultaneously
Enter one value in any unit and see the equivalent in all 12 CSS units at once: px, rem, em, vw, vh, vmin, vmax, %, pt, pc, cm, mm, in. No source-to-target switching needed. Click any result card to copy its CSS value.
📐
rem vs em distinction modelled
rem is always relative to the root font size. em is relative to the parent element font size — which compounds in nested elements. Set separate Root font size (for rem) and Parent font size (for em) to model both correctly. The distinction is explained inline. No other free tool models this.
🖥️
Viewport reference input
Set exact viewport width and height dimensions for accurate vw, vh, vmin and vmax conversions. Default is 1440×900 but you can enter your specific breakpoint (e.g. 375×812 for mobile) to get conversions that match the actual rendered values on that screen size.
📌
Physical units included
Includes pt (points), pc (picas), cm, mm and in alongside the standard web units. Useful for print stylesheets, email HTML, and converting design specifications from print tools like InDesign or Figma that export in point or millimetre measurements.
Conversion history
Your recent conversions are saved and shown as quick-recall chips below the results. Click any history chip to instantly restore that value and unit. Saves retyping when working through a set of design tokens. History clears with one click.
💡
When-to-use guidance
Each unit card shows a brief hint about when that unit is most appropriate: px for borders, rem for font sizes, em for component-scoped spacing, vw/vh for viewport layouts. Guidance is contextual — helps you pick the right unit, not just get the right number.
How to use

How to convert CSS units

1
Set your context values
In the context bar, set the Root font size (usually 16px, or whatever your :root font-size is in CSS). If working with em units, also set the Parent font size to the computed font size of the element's parent. Set Viewport width and height to match the screen size you're designing for.
2
Enter your value and select the source unit
Type the value you want to convert in the large input field. Select the source unit from the dropdown on the right. All 12 conversion results update instantly as you type. The source unit card is highlighted in indigo to show which unit you're converting from.
3
Read the results in all three groups
Results are shown in three groups: Relative units (px, rem, em, %), Viewport units (vw, vh, vmin, vmax), and Absolute/print units (pt, pc, cm, mm, in). Each card shows the equivalent value and a brief hint about when to use that unit.
4
Copy any result
Hover over any result card to reveal the Copy button. Click it to copy the formatted CSS value (e.g. 1.5rem or 24px) to your clipboard. The value is copied in the format you'd paste directly into a CSS property — number plus unit, ready to use.
5
Use history for quick recall
Each conversion you run is saved to the history row at the bottom. Click any history chip to instantly restore that value and unit. This is particularly useful when working through a design token list — convert a set of values one by one and quickly switch between them.
Why LazyTools

How this compares to other CSS unit converters

FeatureLazyToolsnekocalc.comunitconverters.netBigDevSoon
All units simultaneouslyYes — 12 unitsOne at a timeOne at a timeYes
rem vs em distinctionYes — separate fieldsNoNoNo
Custom viewport dimensionsYes — W and HNoNoYes
Physical units (pt, cm, mm, in)YesYesYesNo
vmin / vmaxYesNoNoNo
Conversion historyYesNoNoNo
When-to-use guidanceYes — per cardNoNoPartial
Quick reference

CSS unit conversion formulas

UnitEquals (default 16px base)Relative toBest used for
1rem16pxRoot font size (:root / html)Font sizes, spacing — respects user browser preference
1em16px*Parent element font sizeComponent-scoped sizing; compounds in nested elements
1vw14.4px (1440px vp)Viewport widthFluid typography, hero widths, responsive spacing
1vh9px (900px vp)Viewport heightFull-screen sections, sticky headers, hero heights
1vminmin(vw,vh)Smaller of vw/vhResponsive elements that fit any orientation
1vmaxmax(vw,vh)Larger of vw/vhOverlay, full coverage regardless of orientation
1pt1.333px1/72 inch (fixed)Print stylesheets, email HTML
1pc16px12 points (fixed)Print typesetting; rarely used on screen
1cm37.795pxPhysical centimetrePrint layouts; fixed on screen
1mm3.78pxPhysical millimetreFine print detail, technical drawings
1in96pxPhysical inch (CSS def.)Print; note: may not equal physical inch on screen

*em with the same parent font size as root. When nested, em compounds: 1.2em inside a 1.2em element = 1.44x root size.

Complete guide

CSS Units — A Complete Guide to px, rem, em, vw and More

CSS offers two fundamental categories of length units: absolute and relative. Absolute units like px, pt, cm and in have fixed physical meaning. Relative units like rem, em, vw, vh and % derive their value from context — from the root font size, the parent element, the viewport dimensions, or the containing block. Choosing the right unit is one of the most impactful decisions in responsive CSS architecture, affecting accessibility, maintainability and how your design adapts across screen sizes and user preferences.

px to rem converter with custom base font size

The px-to-rem conversion is the most common CSS unit calculation in modern web development. The formula is simple: rem = px ÷ root font size. With the default browser root font size of 16px, 24px becomes 1.5rem. The reason to use rem instead of px for font sizes is accessibility: when a user changes their browser's default font size preference, rem units scale accordingly. px values do not. A design token system built in rem automatically respects user preferences site-wide.

CSS unit converter px rem em vw free

The em unit is fundamentally different from rem: it is relative to the current element's font size, which in practice usually means the parent element's font size. em = px ÷ parent font size. Where em becomes tricky is nesting: if you set a parent to 1.2em and a child also to 1.2em, the child's computed size is 1.44 times the root — because 1.2em × 1.2em = 1.44. This compounding is why rem is generally preferred for font sizes (predictable) while em is useful for component-scoped spacing where children should scale relative to their own component's font size.

How to convert px to rem in CSS

To convert px to rem manually: divide the px value by the root font size. 32px ÷ 16px = 2rem. To convert rem to px: multiply the rem value by the root font size. 2rem × 16px = 32px. If your project uses a different root font size (for example, some projects set html { font-size: 62.5% } to make 1rem = 10px for easier mental arithmetic), enter that base in the Root font size field above and all conversions recalculate automatically.

CSS viewport unit calculator

Viewport units are relative to the browser window dimensions. 1vw = 1% of the viewport width. 1vh = 1% of the viewport height. On a 1440px-wide screen, 1vw = 14.4px. On a 375px mobile screen, 1vw = 3.75px. This is what makes viewport units powerful for fluid typography — text sized in vw scales continuously with the window width. vmin is the smaller of vw and vh, vmax is the larger — useful for sizing elements that should adapt to both portrait and landscape orientations.

em vs rem difference calculator

The clearest way to understand the rem vs em difference is through a concrete example. Suppose your root font size is 16px, and you have a card component with font-size: 1.2em (= 19.2px with a 16px parent). If you add a caption inside the card with font-size: 0.8em, that caption is 0.8 × 19.2px = 15.36px — not 0.8 × 16px. If you had used rem instead, 0.8rem would always be 12.8px regardless of the card's font size. This is why em is appropriate for buttons (padding in em scales with the button's own font size) but rem is more predictable for a site-wide type scale.

Responsive CSS unit converter

Building a responsive type scale often requires converting a set of design token values from px to rem. For a type scale with steps at 12, 14, 16, 18, 20, 24, 30, 36, 48px, the rem equivalents at 16px base are 0.75, 0.875, 1, 1.125, 1.25, 1.5, 1.875, 2.25, 3rem. Rather than calculating each manually, paste each value in turn and click the rem card. The history row saves previous conversions so you can quickly reference the full scale as you work.

Frequently asked questions

Divide the pixel value by the root font size. With the default 16px root font size: 24px ÷ 16 = 1.5rem. Enter the px value above, select px as the source unit, and read the rem result. Set a custom root font size in the context bar if your project uses a different base.
rem is relative to the root font size (set on the html element) and never changes based on nesting. em is relative to the parent element's font size and can compound in nested elements. If a parent has 1.2em and a child has 1.2em, the child's computed size is 1.44× the root — the multiplication compounds. Use rem for predictable font sizes; use em for component-scoped spacing.
1rem equals the root font size in pixels. The browser default is 16px, so 1rem = 16px by default. If your CSS sets html { font-size: 18px }, then 1rem = 18px. If it sets html { font-size: 62.5% }, then 1rem = 10px (62.5% of the browser's 16px default).
vw is 1% of the viewport width and vh is 1% of the viewport height. On a 1440px wide screen, 1vw = 14.4px. On a 375px mobile screen, 1vw = 3.75px. Enter your viewport dimensions in the context bar to get accurate conversions. vmin is the smaller of vw and vh; vmax is the larger.
Use rem for font sizes. When a user changes their browser default font size (an accessibility preference), rem-based fonts scale accordingly while px-based fonts stay fixed. This is a critical accessibility consideration. px is appropriate for borders, shadows, and decorative details that should remain pixel-precise regardless of font size settings.
16px = 1rem with the default 16px root font size. 16 ÷ 16 = 1. Other common conversions: 12px = 0.75rem, 14px = 0.875rem, 18px = 1.125rem, 20px = 1.25rem, 24px = 1.5rem, 32px = 2rem, 48px = 3rem.
1pt (point) = 1.333px in CSS. This is because CSS defines 1 inch = 96px and 1 inch = 72 points, so 1pt = 96/72 = 1.333px. Points are commonly used in print design and email HTML. 12pt body text (a common print standard) = 16px.
Use em when you want an element's size to scale relative to its own parent — for example, button padding in em means the padding scales when you change the button's font size. Use rem for your site-wide type scale, spacing system and design tokens because rem values are predictable regardless of how deeply nested an element is.
Related tools

More free CSS and web dev tools