CSS / Reference / letter-spacing, word-spacing: Compare Character and Word Spacing
Use CSS letter-spacing to change the space between characters and word-spacing to adjust the spaces between words. Positive lengths increase spacing and negative lengths reduce it. If the letters in a heading look crowded, adjust character spacing. If each word looks fine and the word boundaries need more room, adjust word spacing.
Which spacing property should you use?
| Property | Where it applies | Example values |
|---|---|---|
letter-spacing |
Between adjacent typographic character units | normal, 2px, -0.02em |
word-spacing |
At word separators that remain after white-space processing | normal, 12px, 0.16em |
Both properties initially use normal. A value of 0px adds zero extra space, so the font’s natural spacing and any spaces in the text still remain. Text justification can also affect the final gaps.
The W3C CSS Text specification describes where each property adds spacing. letter-spacing · word-spacing
Compare spacing on identical text
Save this complete document as css-spacing-example.html in UTF-8 and open it in a browser. Every sample uses identical text and the same font. Compare the second and third lines with the first.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Compare spacing on identical text</title>
<style>
body { margin: 1rem; font: 1rem/1.5 system-ui, sans-serif; }
main { max-width: 32rem; margin-inline: auto; }
.sample { padding: .5rem; background: #edf4fc; }
.letters { letter-spacing: 2px; }
.words { word-spacing: 12px; }
</style>
</head>
<body>
<main>
<p>normal</p>
<p class="sample">CSS HTML</p>
<p>letter-spacing: 2px</p>
<p class="sample letters">CSS HTML</p>
<p>word-spacing: 12px</p>
<p class="sample words">CSS HTML</p>
</main>
</body>
</html>
On the second line, the characters within CSS and HTML spread apart. On the third line, only the gap between the two words gets wider.
- Change
2pxto0pxin.lettersand check that the line matches the baseline. Then restore it. - Change
12pxto-2pxin.wordsto narrow the gap. Restore12pxafter comparing. - Replace the text in all three samples with
CSSHTML. Word spacing now has no separator to widen, while character spacing still affects the second line.
Relative lengths and inheritance
Apply letter-spacing: 0.08em directly to a heading if the spacing should scale with its font size. At a font size of 20px, the extra spacing is 1.6px.
Both properties inherit. If a parent computes 0.08em to 1.6px, its child inherits 1.6px even if the child’s font size is 40px. Declare 0.08em on the child itself to calculate the spacing using its own font size.
When the spacing looks different
word-spacing has no separator to adjust in Japanese or Chinese text written without spaces. The same holds between Korean syllables within one word. In joining scripts such as Arabic, browsers can handle tracking differently to preserve the shape of connected letters.
If the gaps surprise you, inspect both properties in the browser’s Computed panel. Then check for actual spaces between words, inherited values and an active text-align: justify rule.
Check wrapping and text clipping
Larger gaps can turn a heading or button label into two lines. Check narrow and zoomed layouts with real text. If an element has both a fixed height and overflow: hidden, make sure the box can grow or that wrapped text stays visible.
Users should still be able to read and operate the page after increasing text spacing. The WCAG 2.2 text spacing criterion tests whether the page accommodates those user settings. W3C’s explanation of the text spacing criterion
For related font and line-height settings, see CSS Fonts, Font Sizes, and Line Height.




