Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 36 ยท Lighthouse and Audits

Running Your First Lighthouse Audit

Run Lighthouse from DevTools: choose mode and device, pick categories, read the report, and learn why scores differ between runs and how to make audits repeatable.

Lighthouse is an automated tool that loads your page under controlled conditions and grades it in four categories: Performance, Accessibility, Best Practices and SEO. For each category it lists concrete problems, estimates how much each fix would save and links to an explanation. Lighthouse is built into Chrome DevTools, so a first audit takes less than a minute.

This lesson walks through running an audit, the options in the start screen and how to read the result without being fooled by a single number.

Running the audit

  1. Open the page you want to test in an Incognito window. Extensions change results, and Incognito disables them by default.
  2. Open DevTools and choose the Lighthouse tab. If it is not visible, use the double-arrow overflow menu.
  3. Choose a mode:
    • Navigation (default): reloads the page and audits the whole page load.
    • Timespan: records while you interact, which captures things like layout shifts and blocking time during a click flow.
    • Snapshot: analyzes the page in its current state, ideal for accessibility checks on a menu you opened or a form with errors.
  4. Choose a device: Mobile applies simulated mid-range phone settings (a throttled CPU and slow 4G network, a small viewport); Desktop uses a larger viewport and lighter throttling.
  5. Tick the categories you want. Performance, Accessibility, Best practices and SEO are the standard four; deselect the ones you do not need to run faster.
  6. Press Analyze page load. Do not touch the page while it runs. After about half a minute the report opens in the panel.

Run on the production URL or a production-like build. A development build with unminified code and hot reloading produces scores that do not describe what users get.

What the report contains

At the top you see four circular gauges colored by score: 90 to 100 green, 50 to 89 orange, 0 to 49 red. Under the Performance gauge, six metrics appear with their measured values (First Contentful Paint, Largest Contentful Paint, Total Blocking Time, Cumulative Layout Shift, Speed Index; the exact list follows the Lighthouse version). Below is a filmstrip of screenshots and a treemap link that shows JavaScript size per module.

Below that the report has these sections:

  • Opportunities: changes that would speed up the load, with an estimated saving in milliseconds (for example "Eliminate render-blocking resources", "Properly size images", "Reduce unused JavaScript").
  • Diagnostics: information that does not map to a number directly, such as "Avoid an excessive DOM size" or "Minimize main-thread work".
  • Passed audits: collapsed by default.
  • In other categories, items are grouped as "Contrast", "Names and labels", "Navigation", and so on, with the failing elements listed. Click Show more to see the offending HTML snippets, and in DevTools you can click a snippet to jump to that element in the Elements panel.

Next to each opportunity or diagnostic is a small icon: red triangle (failing), orange square (needs attention), green circle (passing), and grey for informational or manual checks.

Why your score changes between runs

Run Lighthouse three times on the same page and you may get 78, 81 and 74. This is normal. Sources of variance are other processes on your machine, network jitter, server response time, A/B tests, third-party scripts and random timings. Lighthouse reduces the noise by simulating throttling rather than slowing the real network, but it cannot remove it. Practical rules:

  • Compare medians of at least three to five runs, not single runs.
  • Change one thing at a time between runs.
  • Do not compare scores from different machines or Lighthouse versions; the scoring formula is updated over time.
  • Use the numbers behind the score (LCP in ms) rather than the score to judge a change.

The stand-in below computes a median and a spread for a series of runs, so you can decide whether a change is bigger than the noise.

JS Stand-in: is the improvement bigger than the noise?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Here the gain of 4 points is smaller than the run-to-run range of 7, so the honest conclusion is "possibly better, not proven". That is a useful discipline.

Command line and other ways to run it

The same engine runs outside DevTools: the Lighthouse CLI (npm install -g lighthouse then lighthouse https://example.com --view), PageSpeed Insights (which adds real-user data), and Lighthouse CI for automated checks in a build pipeline. Reports can be exported as JSON or HTML from the three-dot menu in the DevTools report, and a saved JSON file can be opened in the online viewer to share with colleagues. Every Lighthouse JSON file has the same structure, which makes it easy to read with a script, as the next stand-in does with a small made-up fragment.

JS Stand-in: list failing audits from a Lighthouse-like JSON

Press Run (or Ctrl + Enter) to see the console output here.

No output.

A sensible first audit

After the report appears, do not try to fix everything. Pick the biggest opportunity whose cause you understand, fix it, and rerun. The next lessons explain how the score is calculated and which accessibility and SEO items are worth your time.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which Lighthouse mode is best for auditing a menu that you have opened manually?

    Snapshot analyzes the current state of the page, without reloading it.
  2. 2. Which score range is shown in green?

    90 to 100 is green, 50 to 89 orange, 0 to 49 red.
  3. 3. Why should you run Lighthouse in an Incognito window?

    Extensions inject scripts and add load, changing the measurement.
  4. 4. Three runs score 70, 78 and 74. What is the best way to report the result?

    Medians over several runs reduce the effect of noise, and the spread tells you how much to trust small changes.

Summary

  • Lighthouse audits Performance, Accessibility, Best Practices and SEO in Navigation, Timespan or Snapshot mode, on Mobile or Desktop settings.
  • Use Incognito, a production-like build and do not touch the page during the run.
  • Read Opportunities and Diagnostics, and click elements to find the problem in the Elements panel.
  • Scores vary between runs: use medians and the underlying metrics.
  • The same engine is available as CLI, PageSpeed Insights and Lighthouse CI.

Next: Lighthouse Scores and Metrics