Skip to content
All articles

68ch Is Not 68 Characters

5 min read

Every article on this site used to sit in a column set to max-w-[68ch]. The intent is obvious and sound: keep lines around 68 characters, inside the range most typographic guidance puts at roughly 45 to 75 for comfortable reading.

When I finally measured it, the lines ran 103 to 108 characters. The column was 747px wide. Nothing was broken in the CSS. The unit simply does not mean what its name suggests.

What ch actually is

1ch is the advance width of the digit 0 in the element's font, at the element's font size. Not the average character. Not a lowercase letter. One specific glyph.

In a monospaced font every glyph is the same width, so 68ch really is 68 characters. In a proportional font it depends entirely on how wide that font draws its zero compared with the letters you actually set. Geometric sans faces tend to draw round, generous digits — and text is mostly narrow lowercase.

Here, with Plus Jakarta Sans at 15px, the numbers came out like this:

  • 68ch resolved to 747px, so one ch was about 11px — roughly 0.73em.
  • Running text averaged about 7.1px per character, roughly 0.47em.
  • So one ch held about one and a half real characters, and 68 of them held around 105.

The ratio is a property of the typeface. Swap the font and the same 68ch gives a different line length, which is the opposite of what reaching for a character-based unit was supposed to buy.

Measure it instead of trusting it

The only reliable number is the one from the rendered page. This counts characters per line in the first paragraph by measuring each character and grouping them by the line they land on:

const text = document.querySelector('article p').firstChild
const range = document.createRange()
const lines = new Map()
for (let i = 0; i < text.length; i++) {
  range.setStart(text, i)
  range.setEnd(text, i + 1)
  const top = Math.round(range.getBoundingClientRect().top)
  lines.set(top, (lines.get(top) ?? 0) + 1)
}
console.log([...lines.values()])

Drop the last value — it is the short final line of the paragraph — and look at the rest. Run it on a few paragraphs, at the widths people actually read at.

The fix here

Two changes. The column became 36rem, a unit that does not depend on any glyph, and body text went from 15px to 17px, which is a more usual size for long-form reading anyway. Measured afterwards: 64 to 79 characters a line, 70 on average.

One thing to carry over if you make the same change: the title, the cover art and the text all shared that width, and they all have to move together. ch also resolves against each element's own font size, so a header and a body column both set to 68ch are only the same width if their font sizes match. A rem width does not have that problem.

When ch is still the right unit

It is exact for monospaced text: code blocks, terminal output, anything tabular in a fixed-width face. It is also fine for loose limits where the precise number does not matter — a short lede that just should not run the full width of a large screen.

For a reading column, where the whole point is a specific line length, measure the result in the font you ship and size the column from that. The unit with the character-shaped name is the one least likely to give you the characters you asked for.