How a layout shift is scored
Each unexpected shift gets a score of impact fraction × distance fraction. The impact fraction is how much of the viewport the moving content covers, before and after the move combined. The distance fraction is how far it moved, relative to the viewport. Shifts that happen close together (less than 1 s apart, within a 5 s window) are added into one “session window”, and CLS is the worst window.
Late-loading banner calculator
impact 0.533 × distance 0.107 = 0.057 per shift
CLS 0.06 → Good
Viewport: 390 × 844 phone. Impact fraction = share of the viewport touched by the moving content before and after the move; distance fraction = how far it moved relative to the viewport height.
Common causes and fixes
| Cause | Fix |
|---|---|
| Images and videos without dimensions | Add width and height attributes, or CSS aspect-ratio |
| Ads, embeds and iframes | Reserve the slot with min-height at its most likely size |
| Cookie banners and promo bars inserted at the top | Overlay them (position fixed) instead of pushing content down |
| Web fonts swapping in with different metrics | Tune the fallback with size-adjust / ascent-override, or preload the font |
| Content injected after an API call | Render a skeleton of the same size first |
Animating top, height or margin | Animate transform instead, which never causes layout shifts |