Pixels to Rem (px to rem)
Last updated:
Pixels-to-rem conversions translate absolute pixel-based design-mockup values into CSS-absolute-relative rem-unit specifications for application-wide consistent scaling, accessibility-zoom-adaptive typography, design-system documentation, and design-token export pipelines. A 16 px design-mockup body-text translates to 1 rem CSS specification under the 16-px-default browser convention; a 24 px heading translates to 1.5 rem; a 14 px small-text translates to 0.875 rem; a 40 px display-heading translates to 2.5 rem. The factor is the multiplicative ratio between the pixel and the rem (root-html-font-size) under the standard 16-px-default browser font-size: 1 px = 1/16 rem = 0.0625 rem. Unlike em, rem is absolute-relative-to-root-font-size regardless of DOM nesting depth, providing consistent application-wide scaling.
How to convert Pixels to Rem
Formula
rem = px × 0.0625
To convert pixels to rem, divide the px figure by 16 (or multiply by 0.0625) — under the standard 16-px-default browser convention on the html root element. For mental math: divide the pixel value by 16, with common values memorisable as fractions: 4 px = 0.25 rem, 8 px = 0.5 rem, 12 px = 0.75 rem, 14 px = 0.875 rem, 16 px = 1 rem, 18 px = 1.125 rem, 20 px = 1.25 rem, 24 px = 1.5 rem, 32 px = 2 rem, 40 px = 2.5 rem, 64 px = 4 rem. The conversion runs at every design-mockup-pixel-source to CSS-rem-implementation-destination handoff boundary in modern design-system work, with the factor exact under the standard 16-px-default convention. Unlike em, the rem-based output is application-wide consistent regardless of DOM nesting depth.
Worked examples
Example 1 — 1 px
One CSS pixel equals 1/16 rem (0.0625 rem) under the standard 16-px-default browser font-size on the html root element. The factor is the reciprocal of the rem-to-px factor and is exact under the standard convention.
Example 2 — 16 px
Sixteen CSS pixels — the standard browser default body-text font-size — converts to exactly 1 rem on the CSS-absolute-relative-to-root typography reference. The px-figure is the design-mockup absolute source; the rem-figure is the CSS-application-wide-consistent implementation reference.
Example 3 — 24 px
Twenty-four CSS pixels — a typical web-page heading font-size — converts to 1.5 rem on the CSS-absolute-relative-to-root typography reference. The rem-figure preserves accessibility-zoom adaptation while specifying the visual heading size relative to the root html font-size.
px to rem conversion table
| px | rem |
|---|---|
| 1 px | 0.0625 rem |
| 2 px | 0.125 rem |
| 3 px | 0.1875 rem |
| 4 px | 0.25 rem |
| 5 px | 0.3125 rem |
| 6 px | 0.375 rem |
| 7 px | 0.4375 rem |
| 8 px | 0.5 rem |
| 9 px | 0.5625 rem |
| 10 px | 0.625 rem |
| 15 px | 0.9375 rem |
| 20 px | 1.25 rem |
| 25 px | 1.5625 rem |
| 30 px | 1.875 rem |
| 40 px | 2.5 rem |
| 50 px | 3.125 rem |
| 75 px | 4.6875 rem |
| 100 px | 6.25 rem |
| 150 px | 9.375 rem |
| 200 px | 12.5 rem |
| 250 px | 15.625 rem |
| 500 px | 31.25 rem |
| 750 px | 46.875 rem |
| 1000 px | 62.5 rem |
| 2500 px | 156.25 rem |
| 5000 px | 312.5 rem |
Common px to rem conversions
- 4 px=0.25 rem
- 8 px=0.5 rem
- 12 px=0.75 rem
- 14 px=0.875 rem
- 16 px=1 rem
- 20 px=1.25 rem
- 24 px=1.5 rem
- 32 px=2 rem
- 40 px=2.5 rem
- 64 px=4 rem
What is a Pixel?
In modern web typography under CSS specifications, the pixel (px) is the CSS reference pixel — a logical unit nominally equal to 1/96 inch (about 0.2646 mm) at the CSS reference viewing distance. The unit scales by device-pixel-ratio for high-DPI displays: a "Retina" display with 2x device-pixel-ratio renders one CSS pixel as a 2×2 grid of physical hardware pixels, preserving the visual size while doubling the rendering resolution. The CSS pixel relationship to other typography units is fixed under the 96-dpi convention: 1 inch = 96 px, 1 cm = 37.795 px, 1 mm = 3.7795 px, 1 pt = 4/3 px ≈ 1.3333 px, 1 pc = 16 px (with the pica equal to 12 points). The 96-dpi convention is the universal reference across modern web browsers (Chrome, Firefox, Safari, Edge), CSS specifications, and screen-typography work. Print-typography traditionally uses points (1 pt = 1/72 inch), and the 96-dpi-versus-72-dpi distinction explains the 4/3 factor between web pixels and print points. Modern operating systems may override the 96-dpi default through display-scaling settings, but CSS reference pixel calculations remain anchored to the 96-dpi reference.
The pixel (a portmanteau of "picture element") emerged in 1960s digital-image-processing research at JPL, Bell Labs, and similar laboratories as the discrete addressable unit of a raster-scanned digital image. The term was coined by JPL researcher Frederic C. Billingsley in 1965 in connection with the Mariner mission imaging-systems work. As digital displays evolved through the 1970s and 1980s — from monochrome CRT terminals through colour CRTs and into early LCD displays — the pixel became the fundamental unit of screen-based typography and graphics. The CSS Working Group standardised the CSS reference pixel in 1996 as part of CSS1, with the original definition tied to a 96-dpi reference viewing-distance of an arm's length from a desktop monitor. The 2010 CSS3 spec formalised the reference-pixel abstraction: 1 CSS pixel ≈ 1/96 inch at the reference viewing distance, scaled by device-pixel-ratio for high-DPI ("Retina") displays. Modern web typography overwhelmingly uses pixels (px) as the base unit for font-sizes, line-heights, padding, margins, and component dimensions, with em-and-rem relative units providing scale-relative-to-parent and scale-relative-to-root respectively. The 96-dpi reference convention also drives the conversion between pixels and traditional print-typography points (1 pt = 4/3 px at 96 dpi).
Web typography globally — CSS font-size, line-height, padding, margin, border-radius, border-width, and component-dimension specifications all use pixels as the base unit on every modern web browser. CSS frameworks (Tailwind CSS, Bootstrap, Material-UI, Ant Design) all use px as the primary spacing-and-typography unit, with em-and-rem relative units providing scale-relative-to-parent and scale-relative-to-root flexibility. Mobile-app typography on iOS uses points (which on iOS are implementation-detail-equivalent to CSS pixels at the reference scale, scaled by device-pixel-ratio), Android uses density-independent-pixels (dp/dip) which are similarly reference-scaled. Digital-image-processing and computer-graphics: image dimensions, sprite-sheet layouts, texture-coordinate-mapping all use pixels. Screen-typography: every modern operating-system font-rendering pipeline computes glyph dimensions in pixel-equivalent units. Game-development and game-engine frameworks (Unity, Unreal, Godot) use pixels as the canonical 2D-coordinate unit. Email-template typography uses pixels heavily for cross-client compatibility (Outlook, Gmail, Apple Mail all render pixel-based dimensions consistently). Print-design software (Adobe InDesign, Affinity Publisher) supports both pixel-and-point input with automatic 96-versus-72-dpi conversion at the print-output boundary.
What is a Rem?
In modern CSS the rem (rem) is an absolute-relative typography unit equal to the computed font-size of the root html element. Under the standard 16-px-default browser font-size, 1 rem = 16 px universally across the document, regardless of nesting depth or local font-size overrides. The unit avoids the cascading-multiplication behaviour of em — a "1 rem" value in a deeply-nested element always equals the same physical size as a "1 rem" value at the root element. Under typical 16-px-default browser conventions, 1 rem ≈ 16 px and 1 px = 0.0625 rem. The relationship is element-tree-independent (unlike em, which is cascading-element-relative). The "62.5% root-font-size trick" sets html { font-size: 62.5% } making the root 10 px and 1 rem = 10 px for simpler integer-fraction calculations (1.6 rem = 16 px, 2.4 rem = 24 px), though this trick is increasingly avoided in modern accessibility-aware design work because it can disrupt user accessibility-zoom settings. The 16-px-default convention is the universal modern web reference, with every major browser (Chrome, Firefox, Safari, Edge) defaulting to 16 px html font-size unless overridden.
The rem (root em) unit was formalised in CSS3 (around 2010) as an absolute-relative typography unit defined relative to the root html element's font-size, complementing the cascading-relative em unit from CSS1 (1996). The motivation was practical: em-units cascade through the DOM tree, multiplying scaling factors at each level of nested font-size override, which can produce unexpectedly-large or unexpectedly-small computed values in deeply-nested layouts. The rem unit avoids this by always being relative to the root html font-size regardless of nesting depth, providing consistent application-wide scaling. The introduction of rem coincided with the rise of responsive-web-design (Ethan Marcotte's 2010 article) and accessibility-aware typography practice, where designers wanted both adaptive scaling (responding to user-controlled root font-size) and predictable behaviour (no cascading multiplication). Modern CSS frameworks and design-systems (Tailwind CSS, Material-UI, Bootstrap 5+, Material Design) use rem extensively for application-wide spacing-and-typography scales, with rem-based scales like Tailwind's text-sm (0.875 rem ≈ 14 px), text-base (1 rem ≈ 16 px), text-lg (1.125 rem ≈ 18 px) becoming the universal pattern. The rem-based approach also supports the "62.5% root-font-size trick" where html { font-size: 62.5% } sets the root to 10 px, making 1 rem = 10 px for clean integer-fraction calculations.
Modern responsive-and-accessibility-aware web-typography globally — CSS frameworks (Tailwind CSS, Bootstrap 5+, Material-UI, Material Design, Carbon Design System, Chakra UI) use rem extensively for application-wide spacing-and-typography scales. Tailwind's default spacing-scale uses rem-based values (space-1 = 0.25 rem = 4 px, space-4 = 1 rem = 16 px, space-16 = 4 rem = 64 px), with the rem-based approach supporting accessibility-zoom adaptation and consistent visual rhythm across the application. Typography-component design uses rem for application-wide font-size scales (text-sm, text-base, text-lg, text-xl, text-2xl, etc.), giving predictable scaling regardless of component-nesting context. Layout-grid systems use rem for breakpoint-and-container-width specifications when accessibility-zoom adaptation is desired. Modern design-tokens (the JSON-or-YAML configuration of design-system primitive values used in Style Dictionary, Theo, Tokens Studio, etc.) commonly use rem-based values for cross-platform-consistent scaling. The rem unit is web-and-CSS-specific — it is not used in print-typography (where points are the canonical unit), email-templates (where px-and-pt are more universally compatible), or print-design software. Modern accessibility-best-practice recommends rem for typography-and-spacing to support user-controlled root font-size scaling.
Real-world uses for Pixels to Rem
Pixel design-mockup specifications translated to CSS rem for application-wide consistent scaling
Design-handoff from pixel-based design tools (Figma, Sketch, Adobe XD) to CSS-component implementation routinely translates pixel-based design-mockup values to rem-based CSS specifications when application-wide consistent scaling is desired. A 16 px design-mockup body-text translates to 1 rem CSS; a 24 px heading translates to 1.5 rem; a 14 px caption translates to 0.875 rem. The conversion runs at every design-tool-pixel-source to CSS-rem-application-implementation step in modern design-system work, with the px-figure on the design-mockup source and the rem-figure on the CSS-absolute-relative-to-root implementation that supports accessibility-zoom adaptation.
Pixel design-token values translated to rem for cross-platform-consistent design-system tokens
Design-tokens (the JSON-or-YAML configuration of design-system primitive values used in Style Dictionary, Theo, Tokens Studio, etc.) commonly translate from pixel source-values to rem-based output values for cross-platform-consistent scaling that supports accessibility-zoom adaptation in web-based design-system implementations. A 16 px source-token translates to 1 rem CSS-output; a 24 px source translates to 1.5 rem; a 4 px micro-spacing translates to 0.25 rem. The conversion runs at every pixel-design-token-source to rem-CSS-output step in modern design-token-pipeline work.
Pixel typography-scale translated to rem for design-system documentation and Tailwind-customisation
Design-system typography-scale values in pixels (h1: 40px, h2: 32px, h3: 24px, body: 16px, small: 14px) translate to rem for design-system documentation and Tailwind CSS customisation (text-sm: 0.875rem, text-base: 1rem, text-lg: 1.125rem). A 40 px h1 translates to 2.5 rem; a 32 px h2 translates to 2 rem; a 24 px h3 translates to 1.5 rem; a 14 px small translates to 0.875 rem. The conversion runs at every pixel-typography-scale source to rem-design-system-documentation step.
Pixel breakpoint specifications translated to rem for accessibility-zoom-aware responsive design
CSS media-query breakpoint specifications can translate from pixel values to rem values for accessibility-zoom-aware responsive design — rem-based breakpoints adapt to user font-size preferences while pixel-based breakpoints do not. A 768 px tablet-breakpoint translates to 48 rem; a 1024 px desktop-breakpoint translates to 64 rem; a 480 px mobile-large-breakpoint translates to 30 rem. The conversion runs at every pixel-breakpoint source to rem-media-query-specification step in modern accessibility-aware responsive-design work.
When to use Rem instead of Pixels
Use rem whenever the destination is CSS specifications for application-wide consistent scaling, design-system documentation for typography-and-spacing scales (Tailwind, Material-UI, Bootstrap, Material Design, Carbon Design System), accessibility-zoom-adaptive typography, design-token export pipelines (Style Dictionary, Theo, Tokens Studio), or any context where absolute-relative-to-root-font-size scaling is desired. Rem provides consistent scaling regardless of DOM nesting depth, unlike em which cascades through font-size overrides. Stay in pixels when the destination is design-mockup specifications, design-handoff to design-tools, image-and-graphics dimensions, or any context requiring absolute pixel-based values for design-tool-consumption. The rem-based approach is the modern accessibility-best-practice for typography-and-spacing in CSS, supporting user-controlled root font-size scaling for accessibility adaptation across modern design-system pipelines and component-library conventions.
Common mistakes converting px to rem
- Treating "1 px = 1 rem" as a rough equivalence. The two units differ by a factor of 16 under the standard 16-px-default browser convention, so substituting one for the other gives a sixteenfold typography-size error. The correct factor is 1 px = 1/16 rem = 0.0625 rem.
- Confusing rem (absolute-relative-to-root-font-size) with em (cascading-relative-to-current-font-size) when choosing the conversion target. For application-wide consistent scaling use rem; for component-internal proportional scaling use em. The rem value always equals the same physical size regardless of DOM nesting depth, while em cascades and multiplies through nested font-size overrides.
Frequently asked questions
How many rem in 1 px?
One CSS pixel equals 1/16 rem (0.0625 rem) under the standard 16-px-default browser font-size on the html root element. The factor is the reciprocal of the rem-to-px factor and is exact under the standard convention. The "1 px = 0.0625 rem" reference is universal in pixel-to-rem CSS-relative conversion in modern design-system and Tailwind-CSS work.
How many rem in 16 px (web body-text)?
Sixteen CSS pixels equals exactly 1 rem under the standard 16-px-default browser convention. That is the standard browser-default body-text font-size translated to CSS-absolute-relative-to-root typography reference. The 16 px to 1 rem conversion is the canonical reference in modern design-system documentation, Tailwind CSS text-base scale, and Bootstrap 5+ font-size base.
How many rem in 24 px (web heading)?
Twenty-four CSS pixels equals 1.5 rem under the standard 16-px-default browser convention. That is a typical web-page heading font-size translated to CSS-absolute-relative-to-root typography reference. The rem-figure preserves accessibility-zoom adaptation while specifying the visual heading size relative to the root html font-size for application-wide consistent scaling.
Quick way to convert pixels to rem in my head?
Divide the pixel figure by 16 — straightforward division for common values. For 16 px that gives 1 rem, for 24 px that gives 1.5 rem, for 32 px that gives 2 rem, for 8 px that gives 0.5 rem, for 14 px that gives 0.875 rem, for 40 px that gives 2.5 rem. The relationship is exact under the standard 16-px-default browser convention, with the simple "÷ 16" rule giving exact figures for everyday CSS-rem typography conversion.
How many pixels in 1 rem?
One rem equals 16 CSS pixels under the standard 16-px-default browser font-size on the html root element. Unlike em, rem is always absolute-relative-to-root-font-size regardless of DOM nesting depth, providing consistent application-wide scaling. The 16-px-default convention is universal across modern browsers but can be overridden by user accessibility settings.
When does px-to-rem conversion appear in real work?
It appears in pixel design-mockup specifications translated to CSS rem for application-wide consistent scaling and in pixel design-token values translated to rem for cross-platform-consistent design-system tokens. It also appears in pixel typography-scale translated to rem for design-system documentation and Tailwind-customisation and in pixel breakpoint specifications translated to rem for accessibility-zoom-aware responsive design. The conversion is one of the most-run pixel-to-CSS-relative typography conversions in modern design-system and design-token-pipeline work.
How precise should px-to-rem be for design work?
For design work the px-to-rem conversion is exact under the standard 16-px-default browser convention (1 px = 0.0625 rem), with the precision allowance coming from the underlying pixel-precision of the design-mockup source. Most design-system documentation uses common-fraction rem values (0.25 rem, 0.5 rem, 0.875 rem, 1 rem, 1.5 rem, 2 rem) corresponding to integer-pixel design-mockup sources, with intermediate values used when integer-pixel granularity is needed.