|
Converters & Units 100% Client-Side · 0 Bytes Sent to Server Instant In-Memory Execution

PX to REM & EM Converter

Convert pixel values to REM and EM for responsive CSS web design. Configurable root base font size (default 16px) with instant bidirectional calculation.

Standard browser default is 16px (1rem = 16px).

px
Quick Presets:
Pixels (PX)Absolute

Based on 16px root base

Root Relative
Root EM (REM)
Parent EM (EM)Contextual

Ready-to-Use CSS Declarations

Font Sizefont-size: 1rem; /* 16px */
Marginmargin: 1rem;
Paddingpadding: 1rem;
Widthwidth: 1rem;
Heightheight: 1rem;
Gap (Flex/Grid)gap: 1rem;

Standard PX to REM & Tailwind Scale Reference Table

Calculated dynamically for base 16px root font size.

Pixels (PX)REM (Root 16px)EM EquivalentTailwind CSS ClassCommon UsageAction
4px0.25rem0.25emtext-[4px] / p-1Borders, micro spacers
8px0.5rem0.5emtext-xs / p-2Small badges, icons
10px0.625rem0.625emtext-[10px] / p-2.5Footnotes, captions
12px0.75rem0.75emtext-xs / p-3Secondary text, tags
14px0.875rem0.875emtext-sm / p-3.5Compact body, forms
16px1rem1emtext-base / p-4Default root body font
18px1.125rem1.125emtext-lg / p-4.5Subheadings, lead text
20px1.25rem1.25emtext-xl / p-5Card titles, h4
24px1.5rem1.5emtext-2xl / p-6Section headings, h3
28px1.75rem1.75emtext-[28px] / p-7Major headers
32px2rem2emtext-3xl / p-8Page titles, h2
36px2.25rem2.25emtext-4xl / p-9Hero headers
40px2.5rem2.5emtext-[40px] / p-10Display text
48px3rem3emtext-5xl / p-12Large hero titles, h1
56px3.5rem3.5emtext-[56px] / p-14Banner titles
64px4rem4emtext-6xl / p-16Giant typography
72px4.5rem4.5emtext-7xl / p-18Billboard numbers
96px6rem6emtext-8xl / p-24Massive branding display
Display Pixel Size & Page Length Ruler

Display PX Size & Page Length Calculator Online

Inspect your device's current viewport display pixel dimensions, calculate document page lengths in CSS pixels, and measure with the interactive pixel ruler.

Viewport Width1920px
Viewport Height1080px
Device Pixel Ratio1x DPR
Screen Resolution1920 × 1080
Interactive CSS Pixel Ruler (0 to 800px)1 CSS px = 1/96th inch
0
50
100
150
200
250
300
350
400
450
500
550
600
650
700
750
800

Step-by-Step Instructions

1

Set root base size

Set your root font-size (default is 16px).

2

Enter pixels or rem

Type your pixel value to get REM, or type REM to get pixels.

3

Copy CSS rule

Copy the computed rem value straight into your CSS or Tailwind stylesheet.

Key Features & Capabilities

  • Bidirectional PX to REM and REM to PX calculation
  • Customizable root font size (16px default, 10px, 14px, etc.)
  • Computes EM units simultaneously
  • Includes a quick reference cheat sheet for standard sizes (12px, 14px, 16px, 20px, 24px, 32px)

Frequently Asked Questions

What is the mathematical formula for converting pixels (px) to rem?

The formula is `rem = px / rootFontSize`. By default in modern web browsers, the root HTML font size is `16px`. Therefore, `24px / 16px = 1.5rem` and `32px / 16px = 2rem`. If your CSS sets `html { font-size: 62.5%; }`, the base font size becomes `10px`, making `16px = 1.6rem`.

Why should developers use rem instead of px for responsive web typography?

Using `rem` (root em) units allows font sizes and layout spacing to scale dynamically according to user browser accessibility preferences. When visually impaired users adjust their default browser font size from 16px to 24px, layouts built with `rem` scale proportionally, whereas hardcoded `px` values remain locked and fail accessibility audits (WCAG 2.1 Level AA).

What is the difference between rem and em in CSS?

`rem` is relative exclusively to the root `<html>` element's font size, providing predictable scaling across deeply nested components. In contrast, `em` is relative to its immediate parent element's font size, which can cause compound scaling issues when nested inside multiple sized parent elements.

How do I generate a full Tailwind CSS or CSS variable spacing scale from px?

You can configure a custom base root pixel value (e.g., 16px or 10px) in the tool settings, and it will compute equivalent CSS declarations, clamp() fluid typography formulas, and custom Tailwind spacing tokens for your theme configuration.

Discover complementary online tools in the same workflow.