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 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
- Open Chrome DevTools → Lighthouse tab
- Select categories: Performance, Accessibility, Best Practices, SEO
- Choose device: Mobile (default) or Desktop
- Click Analyze page load — DevTools reloads the page with throttling
- Expand each audit to see specifics and fix suggestions
- Use Throttling: Simulated Slow 4G to match Lighthouse CLI behavior
Score Categories
| Category | What It Measures | Poor | Good |
|---|---|---|---|
| Performance | LCP, TBT, CLS, FCP, SI, TTI | 0–49 | 90–100 |
| Accessibility | ARIA, contrast, labels, keyboard | 0–49 | 90–100 |
| Best Practices | HTTPS, console errors, deprecated APIs | 0–49 | 90–100 |
| SEO | Meta, robots, crawlability | 0–49 | 90–100 |
Core Web Vitals in Lighthouse
| Metric | Good | Needs Improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | ≤ 2.5s | 2.5–4s | > 4s |
| INP (Interaction to Next Paint) | ≤ 200ms | 200–500ms | > 500ms |
| CLS (Cumulative Layout Shift) | ≤ 0.1 | 0.1–0.25 | > 0.25 |
| TBT (Total Blocking Time) | ≤ 200ms | 200–600ms | > 600ms |
| FCP (First Contentful Paint) | ≤ 1.8s | 1.8–3s | > 3s |
Top Performance Opportunities
- Eliminate render-blocking resources — Add
defer/asyncto scripts, inline critical CSS - Reduce unused JavaScript — Code-split with dynamic imports, tree-shake dependencies
- Properly size images — Serve responsive images with
srcset, use WebP/AVIF - Reduce server response time (TTFB) — Enable CDN, Brotli compression, HTTP/2
- Remove unused CSS — PurgeCSS, CSS Modules, or Tailwind's JIT purge
- Avoid enormous network payloads — Set JavaScript bundle size budget < 200KB gzip
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.
Related Products
on GumroadPremium Workflow Pack
Production-grade workflows, architecture guides, and deployment scripts for teams that ship. 10 advanced CI/CD workflows (blue-green, canary, E2E, security), 5 architecture deep-dives, code review checklist, PR process guide, and 5 battle-tested Bash deployment scripts.
Buy on Gumroad →GitHub Actions CI/CD Templates Pack
12 production-ready GitHub Actions workflow templates covering Node.js, Python, Docker, multi-environment deployments, security scanning, and auto-changelog. Copy, paste, ship.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
Web Performance Checklist
Interactive web performance checklist covering images, fonts, JavaScript, CSS, caching, and server. Check off items to track your score out of 100 and export as Markdown.
Open free tool →
Lighthouse Score Simulator
Estimate Lighthouse performance scores based on JS bundle size, CSS, images, TTFB, and render-blocking resources. Get LCP, FID, CLS, FCP estimates.
Open free tool →
Web Vitals Scorer
Check your Core Web Vitals scores. Enter LCP, INP, and CLS values to see instant Pass/Fail ratings with Good/Needs Improvement/Poor thresholds and optimization tips.
Open free tool →
More Free Tools
Related Articles
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.
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.
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.
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.
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.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →