CSS letter-spacing Property
The CSS letter-spacing property controls the amount of additional space between characters in text.
It can increase or decrease the spacing between characters to improve readability, create visual emphasis, or achieve a particular typographic appearance. The property is commonly used for headings, navigation links, buttons, labels, and other text elements.
letter-spacing Syntax
The letter-spacing property accepts the keyword normal or a CSS length value. Lengths may be positive, zero, or negative.
Basic Syntax
selector {
letter-spacing: 2px;
}
Normal Spacing
.text {
letter-spacing: normal;
}
Positive Spacing
.text {
letter-spacing: 3px;
}
Negative Spacing
.text {
letter-spacing: -1px;
}
Relative Lengths
.text {
letter-spacing: 0.05em;
}
.text {
letter-spacing: 0.1rem;
}
Calculated Values
.text {
letter-spacing: calc(0.05em + 1px);
}
.text {
letter-spacing: clamp(0px, 0.1em, 3px);
}
CSS-Wide Keywords
.text {
letter-spacing: initial;
}
.text {
letter-spacing: inherit;
}
.text {
letter-spacing: unset;
}
.text {
letter-spacing: revert;
}
.text {
letter-spacing: revert-layer;
}
The initial value is normal. Percentage values are not accepted directly by letter-spacing.
Property Values
The following values determine the additional spacing applied between typographic character units.
| Value | Description |
|---|---|
normal |
Uses the font's normal character spacing and allows the browser to adjust spacing when appropriate, such as during text justification. |
<length> |
Specifies additional spacing using a CSS length, such as 2px or 0.05em. |
0 |
Specifies no additional spacing while remaining distinct from normal for some text layout behaviors. |
calc() |
Calculates a spacing value from compatible length expressions. |
min() |
Uses the smallest value from a set of compatible length expressions. |
max() |
Uses the largest value from a set of compatible length expressions. |
clamp() |
Constrains spacing between minimum and maximum length values. |
initial |
Resets the property to normal. |
inherit |
Uses the computed value from the parent element. |
unset |
Uses the inherited value because the property is inherited. |
revert |
Reverts the property according to cascade origin rules. |
revert-layer |
Reverts the property according to cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | normal |
| Inherited | Yes |
| Applies to | All elements |
| Computed value | An absolute length or the keyword normal |
| Animation type | Length |
| Percentages | Not applicable |
| Negative values | Allowed |
| Primary purpose | Character spacing in text |
The property affects text layout and can change the width of words, lines, and text-containing elements.
How It Works
The browser normally positions characters according to the font's spacing information. The letter-spacing property adds or subtracts spacing between typographic character units.
Default Character Spacing
.text {
letter-spacing: normal;
}
The browser uses normal font spacing without an explicitly specified tracking adjustment.
Increase Character Spacing
.text {
letter-spacing: 2px;
}
The browser adds spacing between characters, making the text occupy more horizontal space.
Decrease Character Spacing
.text {
letter-spacing: -0.5px;
}
The browser reduces the spacing between characters, making the text more compact.
Text Layout
Changing letter spacing can affect line breaks, text wrapping, and the overall width of an element. It does not directly change the font size or line height.
Important Consideration
Letter spacing is applied according to typographic character boundaries, which do not always correspond to individual Unicode code points. Browsers must account for text shaping and writing-system rules.
normal Value
The normal value is the default setting. It uses the font's normal spacing behavior and allows certain adjustments during text layout.
Normal Spacing
.text {
letter-spacing: normal;
}
Reset Custom Spacing
.heading {
letter-spacing: 0.1em;
}
.heading.standard {
letter-spacing: normal;
}
normal vs. Zero
.text-one {
letter-spacing: normal;
}
.text-two {
letter-spacing: 0;
}
Both commonly produce similar visual spacing in ordinary text. However, normal permits browser adjustments in situations such as text justification, while an explicit zero specifies a fixed additional spacing amount.
Important Consideration
Use normal when no intentional tracking adjustment is needed. It generally provides the most natural spacing for the selected font.
Positive Values
Positive values increase the spacing between characters, producing a more open appearance.
Small Increase
.text {
letter-spacing: 0.5px;
}
Moderate Increase
.text {
letter-spacing: 2px;
}
Wide Spacing
.text {
letter-spacing: 5px;
}
Heading Example
.section-heading {
font-size: 1.5rem;
text-transform: uppercase;
letter-spacing: 0.08em;
}
This creates a moderately spaced uppercase heading.
Important Consideration
Large positive values can make words difficult to recognize and cause text to wrap unexpectedly. Use wide spacing selectively, particularly for short headings or labels.
Negative Values
Negative values reduce the spacing between characters. They are commonly used to tighten large headings or display text.
Slightly Tighter Text
.heading {
letter-spacing: -0.02em;
}
Compact Heading
.heading {
font-size: 3rem;
letter-spacing: -0.04em;
}
Fixed Negative Spacing
.heading {
letter-spacing: -1px;
}
Avoid Excessive Compression
.text {
letter-spacing: -4px;
}
Large negative values can cause characters to overlap or become difficult to distinguish.
Important Consideration
Negative spacing should be tested with the actual font and font size. A value that looks appropriate in one typeface may produce poor results in another.
Length Units
The letter-spacing property accepts CSS length units. Different units provide different relationships between spacing and the surrounding typography.
Pixels
.text {
letter-spacing: 2px;
}
Pixels provide a fixed CSS length independent of the element's font size.
Points
.text {
letter-spacing: 1pt;
}
Points are supported CSS length units, although they are less commonly used for screen typography.
Em Units
.text {
letter-spacing: 0.05em;
}
The spacing is calculated relative to the element's font size.
Rem Units
.text {
letter-spacing: 0.1rem;
}
The spacing is based on the root element's font size.
Viewport Units
.text {
letter-spacing: 0.2vw;
}
Viewport-relative spacing changes as the viewport width changes.
Important Consideration
For most typography, em is a practical choice because spacing scales with the text size. Fixed pixel values can be useful when a consistent absolute adjustment is required.
Relative Units
Relative units make character spacing responsive to font or layout dimensions.
Font-Relative Spacing
.heading {
font-size: 32px;
letter-spacing: 0.05em;
}
At a font size of 32 pixels, 0.05em represents 1.6 pixels of additional spacing.
Root-Relative Spacing
.heading {
letter-spacing: 0.1rem;
}
If the root font size is 16 pixels, the spacing is 1.6 pixels.
Character-Relative Units
.text {
letter-spacing: 0.1ch;
}
The ch unit is based on the advance measure of the zero glyph in the selected font.
Important Consideration
Relative units can help spacing adapt to typography, but they do not guarantee identical visual results across different fonts.
letter-spacing and font-size
The relationship between letter spacing and font size is important because the same fixed spacing value can look different at different text sizes.
Fixed Spacing at Different Sizes
.small-text {
font-size: 14px;
letter-spacing: 2px;
}
.large-text {
font-size: 48px;
letter-spacing: 2px;
}
The two-pixel adjustment represents a much larger proportion of the smaller text.
Proportional Spacing
.small-text {
font-size: 14px;
letter-spacing: 0.05em;
}
.large-text {
font-size: 48px;
letter-spacing: 0.05em;
}
Both elements use spacing proportional to their own font sizes.
Display Typography
.display-heading {
font-size: 4rem;
letter-spacing: -0.03em;
}
Large display headings sometimes benefit from slightly tighter spacing, depending on the font.
Important Consideration
Always evaluate letter spacing together with font size. A suitable tracking adjustment for a large heading may be inappropriate for small body text.
Font Family and Character Width
Different fonts have different character widths, kerning information, and spacing characteristics. The same letter-spacing value can produce noticeably different results across typefaces.
Sans-Serif Font
.text {
font-family: Arial, sans-serif;
letter-spacing: 0.05em;
}
Serif Font
.text {
font-family: Georgia, serif;
letter-spacing: 0.05em;
}
Monospace Font
.text {
font-family: Consolas, monospace;
letter-spacing: 0.05em;
}
Font Kerning
.heading {
font-kerning: normal;
letter-spacing: 0.02em;
}
Kerning adjusts spacing for particular glyph combinations, while letter-spacing applies an additional general spacing adjustment.
Important Consideration
Test tracking with the actual font used on the page. Font substitutions and fallback fonts can change the appearance of character spacing.
Font Weight
Font weight can influence the visual appearance of character spacing, especially in bold headings and labels.
Regular Text
.text {
font-weight: 400;
letter-spacing: 0.02em;
}
Bold Text
.text {
font-weight: 700;
letter-spacing: 0.02em;
}
Bold Heading
.heading {
font-size: 2.5rem;
font-weight: 700;
letter-spacing: -0.02em;
}
A slightly negative value may make a large bold heading appear more compact.
Important Consideration
Font weight does not automatically change the declared letter-spacing value. However, different font faces and weights may have different glyph metrics, affecting the visual result.
Headings
Letter spacing is frequently used in headings to create visual hierarchy and emphasize short text.
Large Display Heading
.display-heading {
font-size: 3.5rem;
font-weight: 700;
letter-spacing: -0.03em;
}
Uppercase Section Heading
.section-heading {
font-size: 1.25rem;
text-transform: uppercase;
letter-spacing: 0.1em;
}
Small Label Heading
.eyebrow-heading {
font-size: 0.875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
}
Important Consideration
Use modest spacing adjustments and preserve readable word shapes. Excessively wide tracking can make headings harder to scan, particularly when they wrap across multiple lines.
Navigation and Buttons
Navigation links and buttons often use short labels, making them suitable for small letter-spacing adjustments.
Navigation Links
.navigation a {
font-size: 0.875rem;
font-weight: 600;
letter-spacing: 0.04em;
}
Uppercase Navigation
.navigation a {
text-transform: uppercase;
letter-spacing: 0.08em;
}
Button Labels
.button {
font-size: 0.875rem;
font-weight: 600;
letter-spacing: 0.05em;
}
Compact Buttons
.button-small {
font-size: 0.75rem;
letter-spacing: 0.02em;
}
Important Consideration
Increased letter spacing can make navigation labels and buttons wider. Account for the additional width when designing responsive menus and compact interfaces.
Body Text
Body text generally benefits from the spacing built into the font. Large tracking adjustments can interfere with comfortable reading.
Default Body Text
body {
letter-spacing: normal;
}
Subtle Adjustment
.article-text {
letter-spacing: 0.01em;
}
Paragraph Example
.article-text p {
font-size: 1rem;
line-height: 1.6;
letter-spacing: normal;
}
Avoid Excessive Spacing
.article-text {
letter-spacing: 0.2em;
}
Such wide spacing is generally unsuitable for long paragraphs because it disrupts normal word recognition and line wrapping.
Important Consideration
Use the font's default spacing for ordinary body text unless a specific readability or design requirement justifies an adjustment.
letter-spacing and text-transform
The letter-spacing and text-transform properties are often combined for headings, labels, and navigation text.
Uppercase Text
.label {
text-transform: uppercase;
letter-spacing: 0.1em;
}
Lowercase Text
.label {
text-transform: lowercase;
letter-spacing: 0.03em;
}
Capitalized Text
.heading {
text-transform: capitalize;
letter-spacing: 0.02em;
}
Important Consideration
Uppercase text often looks better with a modest amount of additional tracking, but the ideal value depends on the font and text size. Avoid applying wide spacing indiscriminately.
letter-spacing vs. word-spacing
The letter-spacing and word-spacing properties both affect text spacing, but they control different typographic relationships.
| Property | Purpose |
|---|---|
letter-spacing |
Adjusts spacing between typographic character units. |
word-spacing |
Adjusts spacing at word-separation opportunities. |
Character Spacing
.text {
letter-spacing: 2px;
}
Word Spacing
.text {
word-spacing: 5px;
}
Combine Both
.text {
letter-spacing: 0.03em;
word-spacing: 0.1em;
}
The two properties can be combined when both character spacing and word separation require adjustment.
Important Consideration
Do not use letter-spacing as a substitute for word-spacing. Choose the property that matches the spacing relationship you want to control.
Text Alignment and Justification
Letter spacing can affect the distribution of text within a line, particularly when text is justified.
Left-Aligned Text
.text {
text-align: left;
letter-spacing: 0.02em;
}
Centered Text
.text {
text-align: center;
letter-spacing: 0.05em;
}
Justified Text
.text {
text-align: justify;
letter-spacing: normal;
}
With normal, the browser may adjust character spacing as part of the justification process, depending on the writing system and justification rules.
Explicit Letter Spacing
.text {
text-align: justify;
letter-spacing: 1px;
}
An explicit spacing value establishes a tracking adjustment while the browser applies the applicable text justification behavior.
Important Consideration
Text justification and letter spacing interact with language-specific layout rules. Test the appearance of justified text rather than assuming that spacing will be distributed identically in every browser or writing system.
Line Wrapping and Overflow
Increasing or decreasing letter spacing changes the amount of inline space occupied by text. This can affect line breaks and overflow.
Wider Text
.text {
letter-spacing: 0.15em;
}
Additional spacing makes text occupy more inline space and may cause it to wrap sooner.
Tighter Text
.text {
letter-spacing: -0.03em;
}
Reduced spacing can allow more characters to fit on a line.
No-Wrap Labels
.label {
white-space: nowrap;
letter-spacing: 0.08em;
}
The text remains on one line, but it can overflow its container if insufficient space is available.
Responsive Text Container
.text-container {
max-width: 100%;
overflow-wrap: break-word;
}
.text-container p {
letter-spacing: 0.02em;
}
Important Consideration
Check letter spacing at narrow viewport widths. Wide tracking can make buttons, navigation links, headings, and other compact elements overflow.
International Text and Writing Systems
Letter spacing interacts with text shaping and writing-system rules. Not all languages use the same character-spacing conventions.
Latin Text
.latin-heading {
letter-spacing: 0.05em;
}
Multilingual Text
.multilingual-text {
letter-spacing: normal;
}
Using normal spacing is often a safer starting point for multilingual content.
Language-Specific Styling
:lang(en).section-label {
letter-spacing: 0.08em;
}
:lang(ar).section-label {
letter-spacing: normal;
}
Language-aware selectors can apply different typographic treatments where appropriate.
Complex Scripts
Some writing systems require characters to connect or combine into shaped units. Browsers must preserve required shaping behavior rather than inserting arbitrary spacing within those units.
Important Consideration
Avoid applying large tracking values globally to multilingual content. Test typography with the actual languages and fonts used by the website.
Accessibility
Letter spacing affects readability and should be used carefully, particularly for long passages and small text.
Avoid Overly Tight Spacing
.body-text {
letter-spacing: normal;
}
Normal spacing generally preserves the character separation intended by the font designer.
Allow User Spacing Adjustments
Users may apply custom styles to increase text spacing. Layouts should accommodate these adjustments without clipping or obscuring content.
WCAG Text Spacing
WCAG 2.2 Success Criterion 1.4.12, Text Spacing, requires content to remain usable when users apply certain text spacing adjustments, including letter spacing of at least 0.12em.
This does not mean every website must use letter-spacing: 0.12em by default. It means the content should remain readable and functional when users increase spacing to the specified level.
Avoid Fixed-Height Text Containers
.text-panel {
min-height: 100px;
height: auto;
}
Flexible containers can better accommodate text that wraps differently after spacing adjustments.
Important Consideration
Do not use letter spacing to force text into a fixed width at the expense of readability. Prefer layouts that adapt to content and user typography settings.
Responsive Typography
Letter spacing can be adjusted across viewport sizes to maintain readable and balanced typography.
Responsive Heading
.heading {
font-size: 3rem;
letter-spacing: -0.03em;
}
@media (max-width: 600px) {
.heading {
font-size: 2rem;
letter-spacing: -0.01em;
}
}
Fluid Letter Spacing
.heading {
letter-spacing: clamp(0px, 0.1vw, 2px);
}
The spacing responds to viewport width while remaining within the specified limits.
Font-Relative Spacing
.heading {
font-size: clamp(1.5rem, 4vw, 3rem);
letter-spacing: 0.04em;
}
The letter spacing scales with the computed font size.
Important Consideration
Responsive tracking should support readability rather than introduce unnecessary visual changes. Check the resulting line breaks on narrow screens.
Animations and Transitions
The letter-spacing property supports interpolation between compatible length values, allowing smooth changes through CSS transitions and animations.
Transition Example
.button {
letter-spacing: 0.02em;
transition: letter-spacing 0.3s ease;
}
.button:hover {
letter-spacing: 0.08em;
}
Keyframe Animation
@keyframes expand-spacing {
from {
letter-spacing: 0;
}
to {
letter-spacing: 0.15em;
}
}
.animated-heading {
animation: expand-spacing 1s ease-in-out;
}
Reduced Motion Preference
@media (prefers-reduced-motion: reduce) {
.animated-heading {
animation: none;
}
.button {
transition: none;
}
}
Important Consideration
Animating letter spacing can change text width and cause layout shifts. Use subtle transitions and respect reduced-motion preferences.
Inheritance
The letter-spacing property is inherited. Child elements normally use the computed spacing value from their parent unless they specify another value.
Parent Spacing
.container {
letter-spacing: 2px;
}
Text inside the container inherits the spacing adjustment unless overridden.
Child Override
.container {
letter-spacing: 2px;
}
.container .normal-text {
letter-spacing: normal;
}
Explicit Inheritance
.child {
letter-spacing: inherit;
}
Reset to Initial Value
.child {
letter-spacing: initial;
}
This resets the property to normal.
Using unset
.child {
letter-spacing: unset;
}
Because the property is inherited, unset behaves like inherit.
Important Consideration
Inherited letter spacing can affect headings, links, buttons, and other nested elements. Apply spacing to specific text components when different sections require different typography.
letter-spacing Example
This example compares normal, positive, and negative letter spacing using the same text and font size.
HTML Example
<div class="letter-spacing-demo">
<div class="demo-row">
<h3>normal</h3>
<p class="demo-text normal">CSS TYPOGRAPHY</p>
</div>
<div class="demo-row">
<h3>letter-spacing: 1px;</h3>
<p class="demo-text spacing-small">CSS TYPOGRAPHY</p>
</div>
<div class="demo-row">
<h3>letter-spacing: 3px;</h3>
<p class="demo-text spacing-wide">CSS TYPOGRAPHY</p>
</div>
<div class="demo-row">
<h3>letter-spacing: -1px;</h3>
<p class="demo-text spacing-tight">CSS TYPOGRAPHY</p>
</div>
</div>
CSS Example
.letter-spacing-demo .demo-row {
margin-bottom: 18px;
}
.letter-spacing-demo h3 {
margin: 0 0 8px;
font-size: 0.875rem;
}
.letter-spacing-demo .demo-text {
margin: 0;
padding: 12px;
border: 1px solid #bfdbfe;
background-color: #eff6ff;
color: #1e40af;
font-family: Arial, sans-serif;
font-size: 1.25rem;
font-weight: 700;
}
.letter-spacing-demo .normal {
letter-spacing: normal;
}
.letter-spacing-demo .spacing-small {
letter-spacing: 1px;
}
.letter-spacing-demo .spacing-wide {
letter-spacing: 3px;
}
.letter-spacing-demo .spacing-tight {
letter-spacing: -1px;
}
normal
CSS TYPOGRAPHY
letter-spacing: 1px;
CSS TYPOGRAPHY
letter-spacing: 3px;
CSS TYPOGRAPHY
letter-spacing: -1px;
CSS TYPOGRAPHY
The examples show how positive values spread characters apart while negative values bring them closer together. The font size and weight remain unchanged.
Try Relative Spacing
.letter-spacing-demo .spacing-wide {
letter-spacing: 0.15em;
}
The spacing now scales with the element's font size.
Try a Different Font Size
.letter-spacing-demo .demo-text {
font-size: 2rem;
}
Compare how the same pixel spacing values appear at a larger font size.
Common Mistakes
Using Percentage Values
.text {
letter-spacing: 10%;
}
This is invalid because letter-spacing does not accept percentages. Use a length such as 0.1em instead.
Using Large Values for Body Text
body {
letter-spacing: 5px;
}
Large tracking adjustments can make paragraphs difficult to read and create unnecessary line wrapping.
Excessive Negative Spacing
.text {
letter-spacing: -5px;
}
Characters may overlap, reducing readability.
Confusing Letter Spacing with Word Spacing
Use letter-spacing for character spacing and word-spacing for additional spacing between words.
Ignoring Font Differences
The same tracking value can look different in serif, sans-serif, and monospace fonts.
Forgetting Inheritance
Applying letter spacing to a parent can affect all descendant text, including buttons, links, and headings.
Assuming normal and Zero Are Identical
normal and 0 often look similar, but they can behave differently when text justification requires spacing adjustments.
Ignoring Responsive Layouts
Wide tracking can cause navigation links, headings, and buttons to overflow on smaller screens.
Applying Tracking to Every Language
Some writing systems have shaping and spacing requirements that make global tracking adjustments inappropriate.
Important Considerations
Keep the following points in mind when using letter-spacing:
- The property controls additional spacing between typographic character units.
- The initial value is
normal. - The property is inherited.
- Positive values increase character spacing.
- Negative values decrease character spacing.
- Zero specifies no additional tracking.
normalcan allow spacing adjustments during text justification.- The property accepts CSS length values but not percentages.
emvalues scale with the element's font size.remvalues scale with the root font size.- Pixel values provide a fixed CSS length.
- Mathematical functions can calculate responsive spacing values.
- The appearance depends on the selected font and its glyph metrics.
- Font kerning and letter spacing are different typographic controls.
- Large headings may benefit from modest negative tracking.
- Uppercase headings and labels may benefit from modest positive tracking.
- Body text generally works best with the font's normal spacing.
- Wide tracking can change line wrapping and cause overflow.
- The property can affect text width without changing font size.
word-spacingcontrols a different aspect of text spacing.- Letter spacing interacts with text justification and writing-system rules.
- Complex scripts require appropriate text shaping behavior.
- Users must be able to adjust text spacing without losing content or functionality under applicable accessibility requirements.
- The property supports animation between compatible length values.
- Animations that change text width can cause layout shifts.
- Test spacing with the actual font, language, and responsive layout.
Browser Support
The CSS letter-spacing property is widely supported in all modern browsers, including Chrome, Edge, Firefox, Safari, and Opera.
Basic positive, negative, and normal values have long-established support. Some details of text shaping, justification, and spacing in complex writing systems may differ between browser engines.
For current compatibility information, visit Can I Use? and search for letter-spacing.
Specifications
The letter-spacing property is defined in the CSS Text Module Level 3 specification.
CSS Text Module Level 3: letter-spacing
The specification describes character spacing, typographic character units, and how letter spacing interacts with text layout.
For accessibility guidance related to user-adjusted text spacing, consult WCAG 2.2.
For additional documentation and examples, consult MDN Web Docs.
