Typography Best Practices
Learn how to choose fonts, build type scales, set readable line heights, control text width and create consistent responsive typography.
Typography is one of the most important parts of web design. Font choice, size, weight, line height, spacing and text width all affect how easily users can read and understand a page. Good typography creates visual hierarchy, improves usability and gives a website a consistent visual identity.
Effective web typography is not simply about choosing an attractive font. A type system should work across different screen sizes, remain readable for long periods and clearly distinguish headings, body text, labels, navigation and other interface elements.
Why Typography Matters
Users spend a large part of their time reading text on websites and applications. Poor typography can make otherwise useful content difficult to understand. Text that is too small, tightly packed, poorly contrasted or inconsistently styled increases cognitive effort and makes pages harder to scan.
- Improve readability and comprehension.
- Create a clear visual hierarchy.
- Make interfaces easier to scan.
- Strengthen brand consistency.
- Improve accessibility.
- Create predictable responsive layouts.
- Make content feel more organized and professional.
Choose Fonts for the Content and Context
The best font depends on the type of content and the environment where it will be displayed. A font that works well for a large marketing heading may not be the best choice for long documentation or dense application interfaces.
| Use Case | Typography Considerations |
|---|---|
| Body text | Prioritize readability and comfortable spacing |
| Headings | Use stronger visual hierarchy and appropriate weight |
| UI labels | Keep text compact but readable |
| Code | Use a suitable monospace font |
| Navigation | Favor clarity and quick recognition |
| Marketing text | Brand personality can have greater influence |
Limit the Number of Fonts
Using too many unrelated typefaces makes an interface feel inconsistent and can increase loading requirements. Most websites can build a complete typography system with one primary family and, when necessary, a second family for specific purposes.
A common approach is to use one sans-serif family throughout an interface and use a separate monospace family for code. Another approach is to combine a display typeface for headings with a highly readable text typeface for paragraphs.
Use a Consistent Font Stack
Websites should define fallback fonts in case the preferred font cannot be loaded. A font stack gives the browser alternative choices and helps maintain usable typography across different systems.
body {
font-family:
Inter,
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
}Fallback fonts should have reasonably similar characteristics to the primary font. Large differences in width or height can cause layout changes when a fallback is displayed.
Build a Type Scale
A type scale defines relationships between text sizes. Instead of choosing every font size independently, designers can create a predictable set of sizes for body text, small text, headings and display elements.
| Role | Example Size |
|---|---|
| Small text | 14px |
| Body | 16px |
| Large body | 18px |
| H4 | 20px |
| H3 | 24px |
| H2 | 32px |
| H1 | 48px |
These values are only examples. The correct scale depends on the design, content density and target devices. The important principle is consistency: related text levels should have clearly distinguishable but harmonious sizes.
Use a Modular Scale
A modular scale generates typography sizes using a consistent ratio between levels. For example, a base size can be multiplied by a ratio to produce progressively larger or smaller values.
Base size: 16px
Ratio: 1.25
16px
20px
25px
31.25px
39.06px
48.83pxA modular scale can make a type system feel more systematic than selecting arbitrary sizes. However, designers should still adjust values when necessary because mathematical consistency does not always produce the best result for every interface.
Choose an Appropriate Body Font Size
Body text should be large enough to read comfortably without forcing users to zoom or strain their eyes. A common starting point for desktop interfaces is around 16px, although the ideal size depends on the font, x-height, content width and device.
Some fonts appear smaller than others at the same CSS font size because their internal proportions differ. Therefore, the numerical value alone does not determine perceived readability.
Set a Comfortable Line Height
Line height controls the vertical distance between lines of text. If it is too small, lines can visually merge together. If it is too large, paragraphs can lose cohesion and become harder to scan.
body {
font-size: 16px;
line-height: 1.6;
}Body text often benefits from a line height around 1.4 to 1.8, but the appropriate value depends on the font and line length. Headings usually require tighter line height because they contain fewer lines and use larger text.
| Text Type | Typical Approach |
|---|---|
| Body text | Approximately 1.4–1.8 |
| Large heading | Approximately 1.1–1.3 |
| UI labels | Often around 1.2–1.5 |
| Code | Often around 1.4–1.7 |
Control Line Length
Even a well-designed font can become difficult to read when paragraphs stretch across an extremely wide screen. Long lines make it harder for the eyes to move from the end of one line to the beginning of the next.
A practical solution is to constrain the width of text content. Many reading-oriented interfaces use a maximum width measured in characters or a similar relative unit rather than allowing paragraphs to occupy the entire viewport.
.articleText {
max-width: 70ch;
}Use Font Weight Carefully
Font weight helps establish hierarchy, but excessive use of bold text reduces its ability to communicate importance. If everything is bold, nothing stands out.
| Weight | Common Use |
|---|---|
| 400 | Body text |
| 500 | Secondary emphasis and UI text |
| 600 | Buttons, labels and subheadings |
| 700 | Major headings and strong emphasis |
| 800+ | Display typography when appropriate |
These values are not universal rules. A particular font may look heavier or lighter at the same numerical weight, and not every font provides every weight.
Create Clear Heading Hierarchy
Typography should make the structure of a page immediately visible. Headings should differ from body text through a combination of size, weight, spacing and sometimes font family.
h1 {
font-size: clamp(2.25rem, 5vw, 4rem);
line-height: 1.1;
font-weight: 800;
}
h2 {
font-size: clamp(1.75rem, 3vw, 2.5rem);
line-height: 1.2;
font-weight: 700;
}
p {
font-size: 1rem;
line-height: 1.6;
}The exact values are less important than maintaining a predictable relationship between levels. Users should be able to distinguish major sections, subsections and supporting text at a glance.
Use Spacing to Separate Text Groups
Typography is not only about the properties of individual characters. The space around text also affects how users perceive relationships between elements. Headings should usually have enough space before and after them to make section boundaries clear.
Paragraphs should also have sufficient separation. When lines and paragraphs are packed together, users may have difficulty identifying where one idea ends and another begins.
.article p {
margin: 0 0 1.25rem;
}
.article h2 {
margin: 3rem 0 1rem;
}Avoid Excessive Letter Spacing
Letter spacing, also called tracking, changes the horizontal distance between characters. It can be useful for small uppercase labels or display typography, but excessive spacing can reduce readability.
Body text normally works best with natural letter spacing. If a font already has carefully designed proportions, large tracking adjustments can make words look fragmented.
Use Text Transform Intentionally
Uppercase text can create visual emphasis, but long passages written entirely in uppercase are generally harder to scan than normal mixed-case text. Reserve uppercase styling for short labels, navigation elements or other situations where it improves hierarchy.
Pair Fonts Carefully
When two font families are used together, they should have enough contrast to establish a purpose but enough compatibility to feel like part of the same system. A display font can be paired with a neutral text font, for example.
| Pairing Strategy | Example Purpose |
|---|---|
| Sans-serif + sans-serif | Modern interface |
| Serif + sans-serif | Editorial or content-focused design |
| Display + neutral sans-serif | Marketing and branding |
| Text font + monospace | Documentation and developer tools |
Avoid combining several highly distinctive fonts without a clear reason. Strong visual differences can compete for attention instead of creating hierarchy.
Make Typography Responsive
Typography should adapt to available screen space. A heading that looks balanced on a large desktop monitor may become excessively large on a phone and wrap into many lines.
Responsive typography can use CSS media queries, relative units or functions such as clamp() to create smooth scaling between minimum and maximum sizes.
h1 {
font-size: clamp(2rem, 6vw, 4.5rem);
}The clamp() function allows a value to scale with the viewport while remaining inside defined minimum and maximum limits. This can reduce the need for many breakpoint-specific font sizes.
Prefer Relative Units for Flexible Systems
Relative units such as rem, em and percentages can make typography systems more flexible. rem is particularly useful for creating sizes relative to the root font size.
:root {
font-size: 16px;
}
body {
font-size: 1rem;
}
h1 {
font-size: 3rem;
}Relative units also make a design system easier to maintain because changing the base scale can influence multiple components consistently.
Consider Font Loading Performance
Web fonts can affect page performance because the browser may need to download font files before displaying text in the intended typeface. Large font files, unnecessary weights and excessive font families increase the amount of data that must be transferred.
- Load only the font families you actually use.
- Avoid unnecessary font weights.
- Prefer modern font formats such as WOFF2.
- Use appropriate font-display behavior.
- Consider self-hosting when it fits the project.
- Preload only critical fonts when there is a clear performance benefit.
Performance and typography should be considered together. A visually perfect font that significantly delays text rendering may create a worse user experience than a carefully selected font that loads quickly.
Use Font-Display Appropriately
The font-display property controls how text behaves while a web font is loading. Different values balance immediate text rendering, fallback behavior and eventual font swapping in different ways.
@font-face {
font-family: "Example Sans";
src: url("/fonts/example-sans.woff2") format("woff2");
font-display: swap;
}The right strategy depends on the role of the font and the user experience you want. For many websites, displaying readable fallback text quickly and swapping to the custom font when available is a practical approach.
Typography and Accessibility
Accessible typography should make text comfortable to read for as many users as possible. Font size, line height, contrast, spacing and responsive behavior all contribute to readability.
- Use sufficiently large body text.
- Provide comfortable line spacing.
- Avoid excessively long lines.
- Maintain adequate text contrast.
- Do not communicate meaning through typography alone.
- Allow text to scale without breaking the layout.
- Avoid overly decorative fonts for essential content.
Typography also interacts with other accessibility requirements. For example, changing font size should not make text overlap or disappear, and important information should remain understandable when users increase browser text size.
Do Not Rely on Font Weight Alone
Bold text can create emphasis, but weight alone should not be the only way important information is communicated. This is especially relevant for status messages, errors and other interface states where users may have difficulty distinguishing subtle visual differences.
Use Typography Tokens
Design systems benefit from reusable typography variables or tokens. Instead of defining unrelated font sizes throughout a project, create a small set of standardized values for common roles.
:root {
--font-size-sm: 0.875rem;
--font-size-md: 1rem;
--font-size-lg: 1.125rem;
--font-size-xl: 1.5rem;
--font-size-2xl: 2rem;
--font-size-3xl: 3rem;
}Typography tokens make global adjustments easier and help maintain consistency across pages and components. They are especially useful in large applications where many developers work on the same interface.
Use a Limited Set of Text Styles
A good typography system does not need dozens of unique styles. A smaller set of reusable styles is easier to understand and keeps the interface visually consistent.
| Style | Purpose |
|---|---|
| Display | Large promotional headings |
| H1 | Primary page heading |
| H2 | Major section heading |
| H3 | Subsection heading |
| Body | Primary reading text |
| Small | Secondary information |
| Label | Short interface labels |
| Code | Source code and technical values |
Avoid Typography Inconsistency
A page can feel poorly designed even when every individual text element looks acceptable if font sizes, weights and spacing are used inconsistently. For example, two buttons with identical roles should not unexpectedly use different font sizes or weights.
Common Typography Mistakes
- Using too many font families.
- Choosing fonts based only on appearance.
- Using extremely small body text.
- Setting line height too tightly.
- Allowing paragraphs to become excessively wide.
- Using heading levels for visual sizing instead of document structure.
- Using too many font weights.
- Loading unnecessary font files.
- Using excessive letter spacing in body text.
- Creating different typography rules for similar interface elements.
- Ignoring responsive behavior.
- Failing to test typography on real devices.
Typography Best Practices Checklist
- Choose fonts based on readability, content and brand requirements.
- Keep the number of font families under control.
- Define reliable fallback font stacks.
- Create a consistent type scale.
- Use a modular scale when it improves consistency.
- Choose a comfortable body text size.
- Use readable line heights.
- Limit the width of long-form text.
- Use font weight to establish clear hierarchy.
- Control spacing between headings and paragraphs.
- Use CSS rather than semantic heading levels for visual sizing.
- Make typography responsive.
- Prefer reusable typography tokens in design systems.
- Load only the fonts and weights that are necessary.
- Test typography for accessibility and performance.
How to Evaluate a Typography System
A typography system should be evaluated in the context of the complete interface rather than by looking at individual font samples. Read several paragraphs, inspect headings, test navigation labels and resize the viewport to see how the system behaves.
Check both dense and sparse content. A typography system that looks good on a landing page may not work equally well in documentation, tables, forms or dashboards. Different content types should still feel like parts of the same system.
Testing Typography on Different Devices
Typography should be tested on desktop monitors, tablets and mobile devices. Screen size, pixel density, operating system rendering and available fonts can all affect how text appears.
- Check heading wrapping on small screens.
- Verify that body text remains comfortable to read.
- Check navigation and button labels for wrapping.
- Test text at increased browser zoom.
- Inspect fallback fonts when custom fonts are unavailable.
- Check long words, URLs and code samples.
Frequently Asked Questions
What is the best font size for web body text?
There is no universal value, but 16px is a common starting point. The actual choice should consider the font's proportions, line height, content width, device and accessibility requirements.
How many fonts should a website use?
Most websites can work well with one primary font family and optionally a second family for a specific role such as display text or code. Using fewer fonts usually makes the system easier to maintain and can reduce loading costs.
What is a good line height for body text?
A line height around 1.4 to 1.8 is a useful starting range for many body text styles, although the ideal value depends on the font, size and line length.
How wide should paragraphs be?
Long-form text should generally be constrained rather than allowed to span an entire large screen. A maximum width around 60–75 characters is a common starting point for comfortable reading.
Should I use px or rem for font sizes?
Both can be used, but rem is often useful for scalable design systems because it expresses sizes relative to the root font size and makes global adjustments easier.
How can I make typography responsive?
Use relative units, media queries or functions such as clamp() to allow text sizes to adapt between minimum and maximum values while maintaining readable proportions.
Does typography affect accessibility?
Yes. Font size, line height, spacing, contrast, text width and responsive behavior all influence how easily users can read and understand content.
Helpful Typography Tools
A Typography Scale Generator helps create consistent font-size systems, a Modular Scale Calculator calculates proportional type scales, a Font Pair Generator helps find compatible font combinations, a Font Stack Generator creates CSS fallback stacks, and a CSS Font Face Generator simplifies the creation of @font-face declarations for custom web fonts.
Conclusion
Good web typography combines readability, hierarchy, consistency, accessibility and performance. Choose fonts according to their purpose, create a predictable type scale, use comfortable line heights and text widths, control visual hierarchy with size and weight, and make the entire system responsive. Avoid unnecessary font families and weights, optimize font loading and use reusable typography tokens when building larger interfaces. A carefully designed typography system makes websites easier to read, easier to navigate and easier to maintain.