Skip to main content

Lighthouse Performance Audit Guide

Lighthouse is Google's open-source tool for auditing web performance, accessibility, SEO, and best practices. Run it from Chrome DevTools, the CLI, or CI/CD pipelines to catch regressions before they ship.

✓ CLI & DevTools usage ✓ CI/CD integration ✓ Score interpretation ✓ Top opportunity fixes

CLI Installation & Basic Usage

# Install globally
npm install -g lighthouse

# Basic audit — opens HTML report in browser
lighthouse https://example.com

# Headless (no browser window) + HTML report
lighthouse https://example.com \
  --chrome-flags="--headless" \
  --output html \
  --output-path ./lighthouse-report.html

# JSON output for programmatic processing
lighthouse https://example.com \
  --output json \
  --output-path ./report.json \
  --quiet

# Audit with custom throttling (disable throttling for unthrottled score)
lighthouse https://example.com \
  --throttling-method=provided \
  --output html

DevTools Lighthouse Panel

Score Categories

Category What It Measures Poor Good
PerformanceLCP, TBT, CLS, FCP, SI, TTI0–4990–100
AccessibilityARIA, contrast, labels, keyboard0–4990–100
Best PracticesHTTPS, console errors, deprecated APIs0–4990–100
SEOMeta, robots, crawlability0–4990–100

Core Web Vitals in Lighthouse

Metric Good Needs Improvement Poor
LCP (Largest Contentful Paint)≤ 2.5s2.5–4s> 4s
INP (Interaction to Next Paint)≤ 200ms200–500ms> 500ms
CLS (Cumulative Layout Shift)≤ 0.10.1–0.25> 0.25
TBT (Total Blocking Time)≤ 200ms200–600ms> 600ms
FCP (First Contentful Paint)≤ 1.8s1.8–3s> 3s

Top Performance Opportunities

Programmatic Usage (Node.js)

import lighthouse from 'lighthouse';
import * as chromeLauncher from 'chrome-launcher';

async function runAudit(url) {
  const chrome = await chromeLauncher.launch({ chromeFlags: ['--headless'] });
  const result = await lighthouse(url, {
    logLevel: 'error',
    output: 'json',
    port: chrome.port,
    onlyCategories: ['performance'],
  });

  const { lhr } = result;
  console.log(`Performance: ${lhr.categories.performance.score * 100}`);
  console.log(`LCP: ${lhr.audits['largest-contentful-paint'].displayValue}`);
  console.log(`TBT: ${lhr.audits['total-blocking-time'].displayValue}`);
  console.log(`CLS: ${lhr.audits['cumulative-layout-shift'].displayValue}`);

  await chrome.kill();
  return lhr;
}

runAudit('https://example.com');

Frequently Asked Questions

How do I run a Lighthouse audit from the command line?▼

Install globally with `npm install -g lighthouse`, then run `lighthouse https://example.com --output html --output-path report.html`. This generates a full HTML report. For headless CI use, add `--chrome-flags='--headless'`. You can also output JSON with `--output json` for programmatic processing.

What is the difference between Lighthouse CLI and DevTools Lighthouse?▼

The CLI runs Lighthouse in a controlled Node.js environment with simulated throttling and is suitable for CI/CD pipelines. DevTools Lighthouse runs directly in your browser with your real network conditions and extensions. DevTools may show different scores because browser extensions, cached resources, and real network latency affect results. Use CLI scores for consistent benchmarks and DevTools for debugging real-user issues.

Why does my Lighthouse score differ between runs?▼

Performance scores vary ±2–5 points per run due to CPU/network simulation variance, garbage collection timing, and background system load. To get a stable score, run Lighthouse 3–5 times and use the median. In CI, configure `numberOfRuns: 3` in your lighthouserc.js. Do not alarm on a single-point score change — focus on consistent regressions of 5+ points.

What are the most impactful Lighthouse opportunities to fix?▼

The highest-impact fixes are: (1) Eliminate render-blocking resources — defer non-critical JS/CSS. (2) Reduce unused JavaScript — code-split large bundles. (3) Properly size images and use modern formats (WebP/AVIF). (4) Reduce server response times (TTFB) — enable compression, CDN caching. (5) Remove unused CSS with PurgeCSS. These five categories typically account for 80% of performance score improvements.

How do I audit pages that require authentication?▼

Use Lighthouse with a Puppeteer script to pre-authenticate. In your lighthouserc.js, set `puppeteerScript` to a script that logs in before the audit. Alternatively, use `--extra-headers` to inject auth cookies or tokens. For Lighthouse CLI, you can also pass `--cookies` with a JSON file containing session cookies exported from DevTools.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Related Articles

Mar 28, 2026 · 14 min read

Web Performance 2026: INP, Core Web Vitals & Lighthouse CI

Master web performance in 2026: INP replacing FID, LCP and CLS optimization, Lighthouse CI in GitHub Actions, RUM with web-vitals.js, and setting performance budgets to keep your site fast.

Apr 2, 2026 · 25 min read

Performance Optimization 2026: Complete Guide to Frontend, Backend, and Infrastructure

Comprehensive performance optimization guide for 2026 covering Core Web Vitals, JavaScript bundle optimization, server-side rendering, caching strategies, database query optimization, CDN configuration, and real-world benchmarks.

Apr 2, 2026 · 13 min read

Performance Testing in 2026: Beyond Page Load Times

A practical guide to performance testing in 2026 — Core Web Vitals, load testing, stress testing, soak testing, and building a performance culture that treats speed as a feature. Includes tooling recommendations and actionable measurement strategies.

Apr 2, 2026 · 23 min read

Web Performance and Core Web Vitals 2026: Complete Optimization Guide

Complete guide to Core Web Vitals optimization in 2026. Covers LCP, INP, CLS, TTFB optimization with real code examples. Includes Next.js, React, Vite, Cloudflare Workers, and backend optimization strategies for achieving 90+ Lighthouse scores.

Mar 28, 2026 · 12 min read

Nx vs Turborepo CI Performance: Build Caching, Affected Commands, and Real Benchmarks 2026

Benchmark-driven comparison of Nx and Turborepo CI performance. Covers remote caching strategies, affected/changed detection, GitHub Actions integration, and migration guide.

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →