Free EX to PX Converter

Convert CSS x-height units (ex) to absolute pixel dimensions in real-time

EX to PX Converter

Font Sizepx
Font Family

Result: px

ex @ 16px serif = px

X-height ratio: 0.46

Font Size: 16px
x-height
Lowercase 'x' height: 7.4px
Common EX Presets:

What are EX Units in CSS?

EX units in CSS are relative units based on the x-height of the current font. 1ex equals the height of the lowercase letter 'x' in the specified font family and size.

// EX units in CSS
.typography {
  font-size: 16px;
  line-height: 2ex;
  margin-bottom: 1.5ex;
}

Why Use EX Units?

  • Font-Aware Sizing: Automatically adapts to different fonts
  • Typography Consistency: Maintains proportions relative to text
  • Readability: Perfect for line-height, margins, and spacing
  • Cross-Font Compatibility: Works consistently across different font families
  • Historical Typography: Based on traditional typographic measurements

Conversion Formula:

// EX to PX conversion formula
PX = EX × Font Size × X-Height Ratio

// Example: 2ex at 16px Arial (x-height ratio: 0.52)
16.64px = 2 × 16 × 0.52

// Where X-Height Ratio = Height of 'x' ÷ Font Size

X-Height Ratios for Common Fonts:

Font FamilyX-Height Ratio1ex at 16pxTypical UseFont Characteristics
Verdana0.558.8pxWeb typography, UILarge x-height, high readability
Arial0.528.32pxGeneral purpose, webMedium x-height, sans-serif
Georgia0.487.68pxReading, articlesWeb-safe serif, good x-height
Times New Roman0.467.36pxPrint, formal documentsSmall x-height, traditional
Courier New0.589.28pxCode, monospaceMonospace, large x-height
Helvetica0.528.32pxPrint design, brandingClassic sans-serif
Comic Sans MS0.548.64pxInformal, casualLarge x-height, rounded
Garamond0.447.04pxBooks, literatureSmall x-height, elegant

Visual Representation:

// Anatomy of typography measurements
Font Size: Total height from top of ascenders to bottom of descenders
X-Height: Height of lowercase 'x' (no ascenders/descenders)
Cap Height: Height of uppercase letters
Ascender Height: Height above x-height (b, d, h, etc.)
Descender Depth: Depth below baseline (g, j, p, q, y)
1ex = X-Height of current font

CSS Examples & Usage:

// Typographic spacing with EX units
.article-text {
  font-size: 18px;
  font-family: Georgia, serif;
  line-height: 1.6ex;
  margin-bottom: 2ex;
}

// Button padding relative to text
.btn {
  font-size: 16px;
  font-family: Arial, sans-serif;
  padding: 1ex 2ex;
}

// Form input sizing
input[type=&qout;text&qout;] {
  font-size: 14px;
  height: 3ex;
  padding: 0.5ex;
}

EX vs EM vs REM:

UnitBased OnUse CaseAdvantagesDisadvantages
EXX-height of current fontTypography spacing, vertical rhythmFont-aware, consistent proportionsVaries by font, less commonly used
EMCurrent font sizeRelative sizing, responsive typographySimple, widely supportedCompounds in nested elements
REMRoot font sizeGlobal scaling, consistent sizingConsistent, no compoundingLess flexible for component scaling
PXAbsolute pixelsFixed sizes, precise controlPrecise, predictableNot responsive, accessibility issues

Best Practices:

  • Use EX units for line-height to maintain typographic rhythm
  • Combine with EM units for comprehensive typographic scale
  • Test with different fonts as x-height varies significantly
  • Use for vertical spacing (margins, padding) in text-heavy layouts
  • Consider accessibility - EX units scale with text size changes
  • For body text, 1.4-1.6ex line-height is optimal for readability

Historical Context:

// EX units in typographic history
Origin: Traditional typography measurement
Relation to EM: In metal type, 1em = width of 'M', 1ex ≈ 0.5em
Digital Adaptation: CSS adopted EX as x-height measurement
Modern Use: Less common than EM/REM but valuable for typography
Browser Support: Excellent (all modern browsers)

Common EX Values:

// Typical EX unit applications
Line height: 1.5-1.8ex (optimal readability)
Paragraph spacing: 1.5-2ex (visual separation)
Button padding: 0.5-1ex (vertical), 1-2ex (horizontal)
Form inputs: 2-3ex height
Heading margins: 0.5-1ex top, 1-1.5ex bottom
Block quotes: 1ex left padding
List items: 0.5ex between items

What is the CSS EX Unit and How Does it Relate to Pixels?

In advanced web typography, the EX unit represents a relative measurement based on the physical height of a lowercase x character in the current font-family. Because different typefaces feature unique design proportions, two fonts set to the same 16px size can have vastly different visual heights. Verdana has a large x-height (about 55% of total size), whereas Times New Roman features a narrower, condensed structure (about 46% of total size). Converting EX to PX helps web designers compute exact dimensions to build perfectly aligned vertical grids.

The Mathematical Formula

To convert EX measurements into pixels, multiply the target EX value by the font-size and the specific font's x-height ratio:

PX = EX × Active Font Size × X-Height Ratio

For example, if you design a paragraph gap of 1.5ex using Helvetica (X-Height ratio 0.52) at 16px font-size:

1.5ex × 16px × 0.52 = 24 × 0.52 = 12.48px

EX to PX Conversion Table (Base 16px Font Size)

Quickly reference pixel values across common typefaces assuming a standard font size of 16px:

EX SizingTimes New Roman (Ratio 0.46)Arial / Helvetica (Ratio 0.52)Verdana (Ratio 0.55)
0.5 ex3.68 px4.16 px4.40 px
1.0 ex7.36 px8.32 px8.80 px
1.5 ex11.04 px12.48 px13.20 px
2.0 ex14.72 px16.64 px17.60 px
3.0 ex22.08 px24.96 px26.40 px
4.0 ex29.44 px33.28 px35.20 px
5.0 ex36.80 px41.60 px44.00 px

When to Use EX Sizing in Layout Design

Because EX units map exactly to lowercase visual height, they are perfect for managing the vertical rhythm of editorial layouts. Use EX to define paragraph margins, blockquote paddings, and alignment coordinates for inline ornaments (like custom checkmarks or bullet icons). This ensures the spacing shrinks and expands in perfect alignment with the lowercase character boxes, maintaining optical balance.

Frequently Asked Questions (FAQs)

An EX to PX Converter is a free online typography tool that converts CSS EX units (based on the physical x-height of lowercase characters) to absolute pixels (PX) relative to the selected font size.

The EX unit represents the x-height of the current typeface. This is exactly the height of the lowercase letter 'x' in the active font-size and family.

The formula is: PX = EX × Font Size × X-Height Ratio. For example, if using Arial at 16px font size (where Arial has an x-height ratio of approximately 0.52), 2ex = 2 × 16 × 0.52 = 16.64px.

EX units are ideal for vertical spacing, padding, margins, and inline icons because they scale directly with the lowercase visual height of the text rather than its bounding box. This maintains perfect typographic rhythm.

Yes, EX is a relative CSS unit. If the user resizes their font size or if the root layout updates, elements sized in EX will scale proportionally, preserving legibility.