# Which snippet should I use?

> Source: <https://webperf-snippets.net/which-snippet>

Start from the symptom you see, not from the snippet name. Each table lists the snippet to run first and what to run next depending on what it shows. The same decision trees drive the [agent skills](https://webperf-snippets.net/#ai-agent-skills), so an agent follows the same path.

If you are not sure where to start, run [LCP](https://webperf-snippets.net/CoreWebVitals/LCP.md), [CLS](https://webperf-snippets.net/CoreWebVitals/CLS.md) and [INP](https://webperf-snippets.net/CoreWebVitals/INP.md). They tell you which of the sections below applies.

## Core Web Vitals are failing

| Symptom                          | Start with                                                                               | Then                                                                                                                                                                                                                                                                                                                                                                                                     |
| -------------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Largest Contentful Paint is slow | [LCP](https://webperf-snippets.net/CoreWebVitals/LCP.md)                                 | [LCP subparts](https://webperf-snippets.net/CoreWebVitals/LCP-Subparts.md) to find the slow phase, then [LCP trail](https://webperf-snippets.net/CoreWebVitals/LCP-Trail.md) to see how the candidate changes                                                                                                                                                                                            |
| The LCP element is an image      | [LCP](https://webperf-snippets.net/CoreWebVitals/LCP.md)                                 | [Image element audit](https://webperf-snippets.net/Media/Image-Element-Audit.md), [LCP image entropy](https://webperf-snippets.net/CoreWebVitals/LCP-Image-Entropy.md) and [priority hints audit](https://webperf-snippets.net/Loading/Priority-Hints-Audit.md)                                                                                                                                          |
| The LCP element is a video       | [LCP video candidate](https://webperf-snippets.net/CoreWebVitals/LCP-Video-Candidate.md) | [Video element audit](https://webperf-snippets.net/Media/Video-Element-Audit.md)                                                                                                                                                                                                                                                                                                                         |
| Layout shifts during load        | [CLS](https://webperf-snippets.net/CoreWebVitals/CLS.md)                                 | [Layout shifts during loading and interaction](https://webperf-snippets.net/Interaction/Layout-Shift-Loading-and-Interaction.md), [Find above-the-fold lazy-loaded images](https://webperf-snippets.net/Loading/Find-Above-The-Fold-Lazy-Loaded-Images.md) and [Fonts preloaded, loaded and used above the fold](https://webperf-snippets.net/Loading/Fonts-Preloaded-Loaded-and-used-above-the-fold.md) |
| Slow interactions                | [INP](https://webperf-snippets.net/CoreWebVitals/INP.md)                                 | [Interactions](https://webperf-snippets.net/Interaction/Interactions.md), then [Input latency breakdown](https://webperf-snippets.net/Interaction/Input-Latency-Breakdown.md)                                                                                                                                                                                                                            |

## The page loads slowly

| Symptom                                       | Start with                                                                                                                                | Then                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The server responds late                      | [TTFB](https://webperf-snippets.net/Loading/TTFB.md)                                                                                      | [TTFB sub-parts](https://webperf-snippets.net/Loading/TTFB.md#measure-ttfb-sub-parts) to see which phase is slow, [TTFB for all resources](https://webperf-snippets.net/Loading/TTFB.md#measure-ttfb-for-all-resources) to find slow requests, [Server-Timing and Early Hints](https://webperf-snippets.net/Loading/Server-Timing-Early-Hints.md) for the backend phases, and [Service worker analysis](https://webperf-snippets.net/Loading/Service-Worker-Analysis.md) if a service worker is involved |
| Nothing shows for a long time                 | [FCP](https://webperf-snippets.net/Loading/FCP.md)                                                                                        | [Find render-blocking resources](https://webperf-snippets.net/Loading/Find-render-blocking-resources.md), then [Critical CSS detection](https://webperf-snippets.net/Loading/Critical-CSS-Detection.md)                                                                                                                                                                                                                                                                                                  |
| Scripts block rendering                       | [Script loading](https://webperf-snippets.net/Loading/Script-Loading.md)                                                                  | [Validate preload, async and defer scripts](https://webperf-snippets.net/Loading/Validate-Preload-Async-Defer-Scripts.md) and [JS execution time breakdown](https://webperf-snippets.net/Loading/JS-Execution-Time-Breakdown.md)                                                                                                                                                                                                                                                                         |
| Third-party scripts are suspected             | [Third-party impact by domain](https://webperf-snippets.net/Loading/Third-Party-Impact-by-Domain.md)                                      | [First and third-party script info](https://webperf-snippets.net/Loading/First-And-Third-Party-Script-Info.md) and [First and third-party script timings](https://webperf-snippets.net/Loading/First-And-Third-Party-Script-Timings.md)                                                                                                                                                                                                                                                                  |
| Text files are sent uncompressed              | [Compression audit](https://webperf-snippets.net/Loading/Compression-Audit.md)                                                            | [Find render-blocking resources](https://webperf-snippets.net/Loading/Find-render-blocking-resources.md) to see whether they also block rendering                                                                                                                                                                                                                                                                                                                                                        |
| Inlined CSS or scripts are heavy              | [Inline CSS info and size](https://webperf-snippets.net/Loading/Inline-CSS-Info-and-Size.md)                                              | [Inline script info and size](https://webperf-snippets.net/Loading/Inline-Script-Info-and-Size.md)                                                                                                                                                                                                                                                                                                                                                                                                       |
| Long pages take a long time to render         | [Content visibility](https://webperf-snippets.net/Loading/Content-Visibility.md)                                                          | [DOM size and depth](https://webperf-snippets.net/Interaction/DOM-Size-and-Depth.md)                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Fonts load late or shift the layout           | [Fonts preloaded, loaded and used above the fold](https://webperf-snippets.net/Loading/Fonts-Preloaded-Loaded-and-used-above-the-fold.md) | [Webfont usage analyzer](https://webperf-snippets.net/Loading/Webfont-Usage-Analyzer.md) for faces that load but are never used                                                                                                                                                                                                                                                                                                                                                                          |
| Resource hints look wrong                     | [Resource hints validation](https://webperf-snippets.net/Loading/Resource-Hints-Validation.md)                                            | [Priority hints audit](https://webperf-snippets.net/Loading/Priority-Hints-Audit.md) and [Prefetch resource validation](https://webperf-snippets.net/Loading/Prefetch-Resource-Validation.md)                                                                                                                                                                                                                                                                                                            |
| The site is built with a JavaScript framework | [SSR hydration data analysis](https://webperf-snippets.net/Loading/SSR-Hydration-Data-Analysis.md)                                        | [JS execution time breakdown](https://webperf-snippets.net/Loading/JS-Execution-Time-Breakdown.md)                                                                                                                                                                                                                                                                                                                                                                                                       |
| Repeat visits are not fast                    | [Cache strategy analysis](https://webperf-snippets.net/Loading/Cache-Strategy-Analysis.md)                                                | [Service worker analysis](https://webperf-snippets.net/Loading/Service-Worker-Analysis.md)                                                                                                                                                                                                                                                                                                                                                                                                               |

## Navigation is not instant

| Symptom                              | Start with                                                                                               | Then                                                                                                 |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| Back and forward reload the page     | [Back-forward cache](https://webperf-snippets.net/Loading/Back-Forward-Cache.md)                         | Fix the reasons it lists                                                                             |
| The page redirects before it renders | [Client-side redirect detection](https://webperf-snippets.net/Loading/Client-Side-Redirect-Detection.md) | [TTFB](https://webperf-snippets.net/Loading/TTFB.md)                                                 |
| Next pages should feel instant       | [Speculation rules inspector](https://webperf-snippets.net/Loading/Speculation-Rules-Inspector.md)       | [Prefetch resource validation](https://webperf-snippets.net/Loading/Prefetch-Resource-Validation.md) |

## The page feels janky or frozen

| Symptom                                        | Start with                                                                                                                       | Then                                                                                                                                                                                                                                                  |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Choppy scrolling                               | [Scroll performance](https://webperf-snippets.net/Interaction/Scroll-Performance.md)                                             | [Long animation frames](https://webperf-snippets.net/Interaction/Long-Animation-Frames.md)                                                                                                                                                            |
| The page freezes                               | [Long tasks](https://webperf-snippets.net/Interaction/LongTask.md)                                                               | [Long animation frames](https://webperf-snippets.net/Interaction/Long-Animation-Frames.md), then [Long animation frames script attribution](https://webperf-snippets.net/Interaction/Long-Animation-Frames-Script-Attribution.md) to name the scripts |
| Each interaction repeats expensive layout work | [Forced synchronous layout](https://webperf-snippets.net/Interaction/Forced-Synchronous-Layout.md)                               | [DOM size and depth](https://webperf-snippets.net/Interaction/DOM-Size-and-Depth.md)                                                                                                                                                                  |
| Content moves when the user clicks             | [Layout shifts during loading and interaction](https://webperf-snippets.net/Interaction/Layout-Shift-Loading-and-Interaction.md) | [Interactions](https://webperf-snippets.net/Interaction/Interactions.md)                                                                                                                                                                              |
| Animations stutter                             | [Long animation frames](https://webperf-snippets.net/Interaction/Long-Animation-Frames.md)                                       | [Long animation frames helpers](https://webperf-snippets.net/Interaction/Long-Animation-Frames-Helpers.md)                                                                                                                                            |

## Images, video and SVG are heavy

| Symptom                                                     | Start with                                                                                                                                         | Then                                                                                     |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| Images are too big or blurry                                | [Oversized images](https://webperf-snippets.net/Media/Oversized-Images.md)                                                                         | [Image element audit](https://webperf-snippets.net/Media/Image-Element-Audit.md)         |
| Above-the-fold images are lazy-loaded                       | [Find above-the-fold lazy-loaded images](https://webperf-snippets.net/Loading/Find-Above-The-Fold-Lazy-Loaded-Images.md)                           | [Priority hints audit](https://webperf-snippets.net/Loading/Priority-Hints-Audit.md)     |
| Offscreen images load eagerly                               | [Find non-lazy-loaded images outside of the viewport](https://webperf-snippets.net/Loading/Find-non-Lazy-Loaded-Images-outside-of-the-viewport.md) | [Image element audit](https://webperf-snippets.net/Media/Image-Element-Audit.md)         |
| Images combine `loading="lazy"` with `fetchpriority="high"` | [Find images with lazy and fetchpriority](https://webperf-snippets.net/Loading/Find-Images-With-Lazy-and-Fetchpriority.md)                         | [Priority hints audit](https://webperf-snippets.net/Loading/Priority-Hints-Audit.md)     |
| Videos are slow to start                                    | [Video element audit](https://webperf-snippets.net/Media/Video-Element-Audit.md)                                                                   | [LCP video candidate](https://webperf-snippets.net/CoreWebVitals/LCP-Video-Candidate.md) |
| SVG files are large                                         | [SVG embedded bitmap analysis](https://webperf-snippets.net/Media/SVG-Embedded-Bitmap-Analysis.md)                                                 | Optimize the file, for example with SVGO                                                 |

## Some users have slow connections

| Symptom                                   | Start with                                                                                                                 | Then                                                                                                                                                          |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Users on mobile or slow networks struggle | [Network bandwidth and connection quality](https://webperf-snippets.net/Resources/Network-Bandwidth-Connection-Quality.md) | [Oversized images](https://webperf-snippets.net/Media/Oversized-Images.md) and [Compression audit](https://webperf-snippets.net/Loading/Compression-Audit.md) |

## Running the snippets

Paste any snippet into the DevTools console, or save it as a DevTools snippet, as described in [How to use](https://webperf-snippets.net/#how-to-use). To run them from a terminal or in CI, use the [CLI](https://webperf-snippets.net/CLI.md). To read the result of a snippet as a report, paste its returned object in the [visualizer](https://webperf-snippets.net/visualizer.md).
