concept Frontend & browsers
Web font loading, FOUT and layout shifts
A fallback font can make text readable before a web font arrives. See why replacing it can add a line, why hiding text is different, and why neither a font swap nor a line count measures layout shift.
What it means
A late web font can change where a line of text ends. While the browser waits for the font, it can lay out the text using a substitute called a fallback font. font-display influences whether that text is visible and whether the web font can replace the fallback later. If the replacement makes words wider, a paragraph that was already readable can gain a line.
Seeing fallback text before the web font replaces it is a flash of unstyled text (FOUT). A flash of invisible text (FOIT) is different: the letters are hidden during the wait, even though the text can already occupy space. Neither term tells you whether a line break will change.
Try it
Simulation. Leave the policy at swap and font arrival at 800 ms. Change only the observation time from 500 ms to 800 ms. The question is not just which font you see, but how many words still fit across the same 200 px line.
Web font loading, FOUT and layout shifts
Show how late font metrics and font-display choices change text layout
Fallback text is visible; font may still arrive during swap period.
Display state
- Policyswap
- Outcomefallback
- VisibleYes
- Line delta0
Line counts use fixed synthetic glyph widths; no font fetch, real geometry or CLS measurement is made. Invisible text is not zero layout space.
20 equal-width items, 5 items per line under the toy rule (one oversized item if needed); 4 lines. Visible text in this fixture. Blocks are a scaled illustration, not actual font geometry.
Evaluated inputs
- Required scenario evidence
- provided
- Illustrative font-display policy
- swap
- Font arrival
- 800 ms
- Observation time
- 500 ms
- Fallback word width
- 40 px
- Line width
- 200 px
- Custom word width
- 50 px
Toy periods in ms: swap 0/unbounded, block 3000/unbounded, fallback 100/3000, optional 100/0; values illustrative, not exact browser behavior. Arrival at end accepted by convention. Twenty equal-width words without inter-word gaps, max one oversized word per line, not real shaping/CLS. Font availability stipulated.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
| Observation time | Visible font | Words that fit per line | Lines for 20 words |
|---|---|---|---|
| 500 ms | Fallback, 40 px per word | 5 | 4 |
| 800 ms | Custom, 50 px per word | 4 | 5 |
At 500 ms, the font has not arrived. Five fallback words fit exactly. At 800 ms, the font is available and swap permits the replacement. Now only four words fit, so the fifth word moves to the next line. The result is one extra line compared with the fallback layout, not a layout-shift score.
Keep the observation at 800 ms and change the custom word width to 40 px. The custom font is still in use, but the paragraph now fits on four lines. Timing explains the replacement; word width explains the extra line in the first comparison. Reset restores the original widths and the 500 ms observation.
When arrival changes the result
The simulation puts the font arrival on a timeline with two periods. During the block period, unavailable text is laid out with fallback widths but the letters are invisible. During the swap period, fallback text is visible while waiting, and the web font can still replace it. If both periods end without an eligible arrival, the fallback stays. These durations are illustrative, not browser timing guarantees.
| Policy | Block duration | Swap duration |
|---|---|---|
swap | 0 ms | Unbounded |
block | 3000 ms | Unbounded |
fallback | 100 ms | 3000 ms |
optional | 100 ms | 0 ms |
Consider the original 500 ms observation with arrival still set to 800 ms. Under block, the paragraph occupies four lines but the letters are invisible. Under optional, the same four lines are readable, and the 800 ms arrival will be too late to replace them. An expired display window is not evidence that the font failed to load.
Arrival time matters even when you look well after the deadline. With the fallback policy, the model accepts an arrival at exactly 3100 ms, the end of its block and swap periods combined. At an observation time of 4000 ms, that font is in use. Move just the arrival to 3101 ms and the fallback stays. Accepting the exact endpoint is a convention of this simulation.
Set the container width to 240 and keep the original widths of 40 and 50. The toy wraps 20 items into four fallback lines and five custom lines; changing font-load timing changes which count is current. The line-count difference is not a layout shift score, and the invisible block period still reserves layout under the stated fixture.
In practice
On the actual page, compare the same paragraph at the same available width before and after the web font appears. Was the text readable during the wait? Did a word move to the next line at replacement? Did the content below the paragraph move? Those observations distinguish a visibility change from a wrapping change and from movement elsewhere on the page.
If movement accompanies the replacement, compare the actual fonts. Metric overrides can bring selected fallback measurements closer to those of the web font and reduce one source of movement. They do not make every glyph the same width or guarantee identical wrapping.
Use the display policy to reason about what the reader sees while waiting, and the font metrics to reason about what may move afterward. The simulation counts equal-width words with no gaps; it never tracks page elements. To establish visual stability, measure cumulative layout shift (CLS) on the real page with its actual text and fonts.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Is FOUT invisible text?
FOUT refers to visible fallback before swap.
Do equal line counts prove zero layout shift?
No. Equal line counts in the toy layout proxy do not establish that actual page elements stayed in place or that CLS is zero.
Can metric overrides help?
Metric overrides can make selected fallback metrics closer to those of a replacement font. They do not force identical glyph widths, line wrapping or a zero layout shift on a real page. Test actual fonts and content separately.
Is font-display swap a zero-shift guarantee?
No. The line count uses fixed glyph widths and an ideal wrapping rule. It cannot measure a visual shift or CLS; the invisible block period also does not imply zero layout space.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- CSS Fonts Module Level 4
font-display; section 4.11 (font metric overrides). Font display periods affect visibility and use. Metric overrides can align selected fallback metrics but do not guarantee identical glyph widths or zero layout shift.
Checked .
- Chrome/web.dev: Optimize Cumulative Layout Shift
Web fonts. Metric overrides can make a fallback font closer in size to a web font and reduce one source of layout shift. Actual CLS must be measured, not inferred from this toy.
Checked .