Px to Em Converter
CSS speaks two size languages — pixels, which are absolute, and ems, which scale with the reader’s font size. Enter pixels and a base size, and this px to em converter returns em, rem, points and percent in one pass.
Em: The Unit That Means "The Current Font Size"
The em began in metal type as the width of a capital M and became in CSS a pure ratio: 1 em = the element's font size. The conversion is a division by the base — at the near-universal 16 px browser default, 24 px ÷ 16 = 1.5 em, the worked default and the commonest single conversion in the field. What the ratio buys is scaling: a layout dimensioned in ems grows and shrinks with the text it frames, and — the accessibility heart of the matter — with the reader's chosen font size, which browsers let users raise for comfort or necessity. A page built in fixed pixels stays stubbornly small for the low-vision reader; a page in relative units respects the setting. That is why style guides and the WCAG guidance push text and its containers toward em/rem, and why this modest division is among the most-performed in web work: it is the toll gate between a design's pixel mock-up (Figma speaks pixels) and production CSS (which should speak relative units wherever type is involved). The W3C's accessibility guidelines are the doctrine's source.
Em, Rem, Pt, Percent: One Value, Four Dialects
The converter returns four dialects because real work crosses all four. Em scales from the parent element's font size — compounding in nested contexts, which builds naturally-proportioned component internals (padding that grows with a heading's own size). Rem (root em) scales always from the html element's size — predictable everywhere, the modern default for global sizing, and numerically equal to em whenever the local context inherits the root, as the note states. Pt (point) is print's unit crossing over: 1 pt = 1/72 inch, and at CSS's 96 px per inch, px × 0.75 = pt — 24 px is 18 pt — the bridge used when a print stylesheet or a PDF target enters the job. Percent is em wearing a % sign: font-size percentages divide by the base the same way (150% = 1.5 em), legacy stylesheets being full of them. One value, four spellings, a single division underneath — the page prints all four because the stylesheet you inherit will use whichever you did not choose.
Worked Examples: The Conversions That Recur
At the standard 16 px base, the pocket table writes itself: 12 px = 0.75 em (small print), 14 px = 0.875 em, 16 px = 1 em (body text itself — the base defined as the unit), 18 px = 1.125, 20 px = 1.25, 24 px = 1.5 (a typical H2), 32 px = 2 (H1 territory), 48 px = 3. Notice the fractions are all tidy — sixteenths divide cleanly into quarters and eighths, a quiet convenience of the 16 default that designers exploit when choosing sizes. Change the base and the table re-derives: a site whose root is set to 62.5 percent (the old 10 px trick, making 1 rem = 10 px and every division trivial) converts 24 px to 2.4 rem — readable arithmetic bought at the price of overriding the reader's default, a trade modern accessibility practice discourages. The converter takes any base precisely because bases are a per-site decision: enter yours, and its table is the one your stylesheet lives by.
Why Not Just Use Pixels? The Honest Case for Each
The pixel is not the villain of the relative-unit sermon — it is the right unit for what must not scale: hairline borders (1 px is a physical hairline by design), image dimensions, and shadows and effects whose size is decorative rather than textual. The doctrine, stated fairly: type and type-adjacent spacing in rem/em, hairlines and raster assets in px, print targets in pt — and media queries in em (a subtlety worth knowing: em-based breakpoints respond to the user's font setting, so a low-vision reader gets the single-column layout sooner, as they should). The converter serves the border crossings of that doctrine: the mock-up's 24 px heading becomes 1.5 rem, the print spec's 12 pt body text becomes 16 px, the legacy sheet's 87.5% becomes 0.875 em — each a single division or multiplication by the base, all of them printed together here so the dialects stop being a source of quiet ±25 percent errors in production.
The 62.5 Percent Trick and Why It Faded
A famous historical shortcut deserves its autopsy here, because legacy stylesheets still carry it: setting the root font size to 62.5 percent makes it exactly 10 px (62.5% of the 16 px default), so rems become decimal — 24 px is 2.4 rem, 13 px is 1.3 rem — and px-to-rem conversion turns into moving a decimal point. An entire generation of developers worked this way, and templates from the era assume it. The practice faded for the reason this page's accessibility section gives: the trick overrides the reader — a user who has set their browser to 20 px for readability has their setting scaled to 12.5 px by the 62.5 percent rule, and the site's rems then honour the ratio but not the reader's chosen size in the way plain defaults would. Modern practice keeps the root at 100 percent (or untouched) and simply does the division by 16 — or asks a converter. If you inherit a 62.5% stylesheet, set this page's base to 10 and its table becomes that stylesheet's native tongue.
Related Tools
More from the Conversion Calculators hub: the Pixels to Inches Converter — the same pixels, crossed into the physical world — the Binary to Hexadecimal Converter, and the Decimal to Hexadecimal Converter — because CSS colours live in hex, the third language of the stylesheet.
Frequently Asked Questions
How many pixels is 1 em?
As many as the base font size — 16 px at the universal browser default, which is why 1 em and 16 px are quoted interchangeably in default contexts. Set the root to another size and the em follows it: that is the unit's entire nature, a chameleon by design. The converter's base field exists for the non-default contexts (a 10 px root trick site, a kiosk display with an 18 px root), and in default work you may read its 16 as fixed — while remembering it is a setting, not a constant of nature.
Should I use em or rem?
Rem for global sizing (type scale, section spacing), because it is predictable — one base, no compounding surprises. Em for component internals that should proportion themselves to the component's own text (a button's padding relative to its label size, an icon sized to its heading). The failure mode to avoid is deep em compounding in font sizes themselves — nested lists shrinking 0.9 em per level into illegibility was the classic bug of the em era and the reason rem was invented. This converter's numbers serve both; the choice is an architecture decision the arithmetic happily supports either way.
How do I convert em back to pixels?
Multiply by the base: 1.5 em × 16 = 24 px. The reverse crossing is the audit direction — reading a production stylesheet's rems against the mock-up's pixels to verify the build — and it is the same base doing the work with the operation inverted. Percentage font sizes reverse the same way after dividing by 100 (87.5% = 0.875 em = 14 px at the default base), the three spellings collapsing into one quantity under both directions of the arithmetic.
Why is 1 pt equal to 0.75 px — or is it the other way?
It is the other way, and the question catches a real slipperiness: 1 pt = 1.333 px, and 1 px = 0.75 pt. The chain is definitional — a point is 1/72 inch, a CSS inch is 96 px, so a point is 96/72 = 1.333 px. Print people converting a 12 pt body size get 16 px; screen people converting 24 px get 18 pt (the worked default's third figure). The converter prints pt from px with the 0.75 factor, and the direction is stated here in words because factor-direction errors are the commonest in the whole unit family.
How do viewport units and container units relate to em?
They are cousins in the relative family: vw and vh scale from the screen's size rather than any font, and the newer container-query units (cqw and kin) scale from a component's box — each answers "relative to what?" differently. Em and rem remain the type-anchored pair: the only units that follow the reader's font preference, which is why accessibility guidance keeps them at the centre of text sizing while viewport units serve hero sections and display type. The converter's base-division is the type pair's arithmetic; the viewport family needs no conversion, only a percentage of a known screen.
Does the em conversion apply to margins and widths too?
Yes — any CSS length accepts em/rem, and the base is the same font size, so a 24 px margin and a 24 px font convert identically (1.5 em at the default). The one nuance is whose font size: for the font-size property itself, em refers to the parent's size; for every other property, it refers to the element's own computed font size — a distinction that matters in nested components and that rem abolishes by always meaning the root. The arithmetic on this page is the common case; the nuance is why experienced developers test the nested case rather than trusting the division blindly.