Sub topic 7
Units: from 1/1000 em tracking values to CSS em
This chapter assumes you know what a glyph, point size, and tracking are, and that you have used either a design tool such as Figma, Illustrator, or InDesign, or basic CSS. It covers how to convert a tracking number from a design tool into a CSS letter-spacing value.
What an em is
An em is a unit of length equal to the current font size. At 16 px, 1 em is 16 px. At 64 px, 1 em is 64 px. An em is therefore a relative unit. It changes whenever the font size changes.
This matters for spacing. A gap of 2 px looks tiny on a large headline and huge on small text. A gap of 0.02 em stays in proportion at every size.
Thousandths of an em
Design tools usually measure tracking in thousandths of an em. InDesign and Illustrator show it as a plain number, such as 75 or -20. Figma can show tracking as a percentage. In the thousandths convention, 1000 units equal 1 em.
| Tool value (1/1000 em) | Fraction of an em | Pixels at 20 px | Pixels at 80 px |
|---|---|---|---|
| 10 | 0.01em | 0.2 | 0.8 |
| 25 | 0.025em | 0.5 | 2 |
| 75 | 0.075em | 1.5 | 6 |
| -20 | -0.02em | -0.4 | -1.6 |
The pixel columns show why the value scales. The tool number stays the same, and the real distance follows the font size.
The conversion
To convert, divide by 1000:
function trackingToEm(units) {
return units / 1000;
}
console.log(trackingToEm(75) + 'em'); // "0.075em"
console.log(trackingToEm(-20) + 'em'); // "-0.02em"If a tool shows a percentage, it is usually a percentage of the font size. In that case 5% is 0.05em, so divide by 100 instead. Check which unit your tool uses before you copy a number.
Using the result in CSS
The CSS letter-spacing property accepts lengths. Em units keep the spacing tied to each element's own font size.
.headline {
font-size: 4rem;
letter-spacing: -0.02em;
}
.eyebrow {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.12em;
}Here .headline is tightened by 20 units, and .eyebrow is opened up by 120 units. Each value is relative to its own element, so you can change font-size later without redoing the spacing.
Em versus px and rem
A value in px stays fixed, so it does not follow the font size. A value in rem follows the root font size, not the element's own size. For tracking, em is almost always the better choice, because tracking is meant to scale with the text it applies to.
Where em is calculated
An em in letter-spacing is resolved against the font size of the element that declares it. The computed length is then inherited by its children. If a parent sets letter-spacing: 0.1em at 16 px, a child with a 32 px font size inherits 1.6 px, not 0.1em of 32 px. To get proportional spacing in the child, set letter-spacing on the child as well.
.card {
font-size: 1rem;
letter-spacing: 0.1em; /* computes to 1.6px, and children inherit 1.6px */
}
.card .title {
font-size: 2rem;
letter-spacing: 0.1em; /* recomputed: 3.2px at this element's size */
}Common errors
- Pasting the tool number directly, such as
letter-spacing: 75em. That is 75 times the font size, and the text becomes unreadable. - Forgetting the sign. A tool value of -20 must become
-0.02em, not0.02em. - Mixing up percentage and thousandths. Divide by 1000 for thousandths and by 100 for percent.
- Using px for tracking on text that changes size at different breakpoints.
Exercise
A designer sets tracking to 120 in InDesign on a 14 px label. What is the CSS letter-spacing value, and how many pixels is it?
Show answer
120 / 1000 = 0.12, so the value is letter-spacing: 0.12em. At 14 px that is 0.12 × 14 = 1.68 px between glyphs.
Exercise
A parent has font-size: 1rem (16 px) and letter-spacing: 0.05em. A child inside it has font-size: 2rem. What letter-spacing does the child use, and what should you do if you want 0.05em of the child's own size?
Show answer
The child inherits the computed length 0.05 × 16 = 0.8 px. To get 0.05em of its own 32 px size (1.6 px), set letter-spacing: 0.05em on the child.