A font size converter saves you from working out sizes in your head when you move between design tools and code. Designers often think in points, while web developers work in pixels, em and rem. Enter a size and choose its unit, and this font size converter shows the equivalent in all of the others, along with a live sample of text. You can set your own base size if your page doesn't use the common default of 16 pixels. It's quick to use when you're matching a print design on the web, or moving a stylesheet to relative units.
How to use the font size converter
- Enter your font size.
- Choose its unit.
- Set the base size if it isn't 16 pixels.
- Press Convert.
How the units relate
| Unit | Type | What it means |
|---|---|---|
| px | Absolute | A CSS pixel, 1/96 of an inch |
| pt | Absolute | A point, 1/72 of an inch |
| em | Relative | A multiple of the parent element's font size |
| rem | Relative | A multiple of the root element's font size |
| % | Relative | A percentage of the parent's font size |
In CSS, 1 inch is defined as 96 pixels and 72 points, so 1 pt = 1.3333 px and 1 px = 0.75 pt.
A worked example
Suppose that a designer has specified body text at 12 points, and your page has a base size of 16 pixels. To get pixels, multiply by 96 ÷ 72: 12 × 1.3333 is 16 pixels. To get rem, divide by the base: 16 ÷ 16 is 1 rem. That's also 100%. Now take a heading at 24 pixels. It equals 18 points, 1.5 rem and 150%.
Common sizes at a 16-pixel base
| Pixels | Points | rem or em | Percent |
|---|---|---|---|
| 12 | 9 | 0.75 | 75% |
| 14 | 10.5 | 0.875 | 87.5% |
| 16 | 12 | 1 | 100% |
| 18 | 13.5 | 1.125 | 112.5% |
| 24 | 18 | 1.5 | 150% |
| 32 | 24 | 2 | 200% |
What's the difference between em and rem?
Both are relative units, but they're relative to different things. A rem is based on the font size of the root element of the page, so 1.5rem is the same size wherever it's used. An em is based on the font size of the parent element, so sizes can compound. If a list sits inside a box whose text is 1.2em, and its items are also set to 1.2em, the items end up at 1.44 times the base. Rem avoids those surprises, which is why many developers prefer it for font sizes. This converter treats both in the same way, using the base size that you've entered, so remember to use the parent's size as the base when you're working in em.
Why use relative units?
Some visitors increase the default font size in their browser so that text is easier to read. When your styles use rem or percent, your text scales along with that preference. Sizes that are set in pixels can stay fixed, which can make the page harder to use for those people. Relative units also make it easy to scale a whole design, since changing one base value adjusts every size that depends on it.
Print and screen
Points come from print, and they're still the normal way of describing type in design programs and word processors. On screens, the size that you see depends on the pixel density and on how far away you are, so a 12-point font on a phone won't match a printed page exactly. Treat these numbers as CSS values, and test your design on real devices before you finalize it.
Picking a readable size
A base of 16 pixels is a common starting point for body text on the web. Smaller text can be harder to read, especially on phones or for older readers. Leave enough space between lines, and make sure that there's good contrast between the text and the background. Headings should be clearly larger than the text beneath them, so that people can scan the page easily.
Moving a stylesheet from pixels to rem
If you're updating an older website, you can convert its sizes one at a time. First, decide on your base size, and leave it as the browser default if you can, as that respects each visitor's preference. Next, divide each pixel value by the base to get its rem value. So 14 pixels becomes 0.875rem, and 20 pixels becomes 1.25rem at a base of 16. Work through your headings and body text first, and then your smaller labels and captions. Test the page after you've made the changes, and try raising your browser's default font size to see that everything grows together. Some items, such as thin borders, usually look better when they stay in pixels, so you don't have to convert everything on the page. A gradual change is fine, and each section that you convert can be checked on its own. Keep a note of the values that you've settled on, so that the whole team uses the same set of sizes from then on.
Common mistakes
- Forgetting the base size. Relative units depend on it.
- Treating points and pixels as equal. 12 pt is 16 px.
- Nesting em sizes. They multiply together.
The px to em formula
The conversion is a single division, and going the other way is a single multiplication.
- em = pixels ÷ base font size
- pixels = em × base font size
The base is the number that matters most. For the font-size property, it is the size inherited from the parent element. For other properties, such as padding or margin, it is the computed font size of the element itself.
Pixels to em: worked examples
With a base of 16px, a 24px heading is 24 ÷ 16 = 1.5em, and 12px caption text is 12 ÷ 16 = 0.75em. Going the other way, 1.25em at the same base is 1.25 × 16 = 20px.
Now suppose a sidebar sets its font size to 20px, and you want a 30px title inside it. The base is now 20, so the title is 30 ÷ 20 = 1.5em. The em value is the same as in the first example, even though the final pixel size is different. That is the whole point of a relative unit.
Watch out for compounding
Because an em looks at the parent for font size, nested elements multiply. If a list has a font size of 0.8em, and a list inside it also has a font size of 0.8em, the inner text ends up at 0.64 of the outer base. At 16px, that takes it from 12.8px down to about 10.24px, which may be smaller than you expected. When you convert a value for a deeply nested element, use the parent's real computed size as the base here, rather than assuming 16. Browser developer tools will show you that computed size.
Rounding em values
Some sizes do not divide evenly. At a base of 16px, 13px is 0.8125em, and at a base of 18px, 13px is about 0.7222em. This converter shows up to four decimal places, which is accurate to a tiny fraction of a pixel. You can round the number if you prefer tidier code, but check the result in a browser, since rounding too far can shift small text noticeably.
Related web tools
Check readability with the color contrast checker, tidy your code with the HTML formatter, and shrink stylesheets with the CSS and JavaScript minifier.
What next
Use this often? Add Font Size Co to your Home screen.
Frequently asked questions
How does the font size converter work?
It changes your size to pixels, and then works out the other units from your base size.
How many pixels is 12 pt?
12 points is 16 pixels.
What is the difference between em and rem?
Em is relative to the parent element, and rem is relative to the root element.
What base size should I use?
Browsers commonly use 16 pixels, unless your page sets something else.
Is 1 pt the same as 1 px?
No. One point is about 1.333 pixels in CSS.
What is 16px in em?
At a 16px base, 16px is exactly 1em.
How does a px to em converter work?
It divides the pixel value by the base font size. At a 16px base, 24px becomes 1.5em.
Sources
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.