# Lighthouse — Automated Web Performance Auditing by Google > An open-source tool by Google that audits web pages for performance, accessibility, SEO, and best practices, available in Chrome DevTools, as a CLI, and as a Node module. ## Install Save as a script file and run: # Lighthouse — Automated Web Performance Auditing by Google ## Quick Use ```bash # Install CLI globally npm install -g lighthouse # Run an audit lighthouse https://example.com --output html --output-path report.html # Or use Chrome DevTools > Lighthouse tab directly ``` ## Introduction Lighthouse is an automated auditing tool maintained by Google that evaluates web pages across five categories: Performance, Accessibility, Best Practices, SEO, and Progressive Web App compliance. It generates actionable reports that help developers identify and fix issues affecting user experience and search ranking. ## What Lighthouse Does - Audits page load performance with metrics like LCP, FID, CLS, and TTFB - Checks accessibility against WCAG guidelines and ARIA best practices - Validates SEO fundamentals including meta tags, structured data, and crawlability - Tests Progressive Web App criteria like service worker registration and manifest - Produces HTML, JSON, or CSV reports with detailed recommendations ## Architecture Overview Lighthouse drives a headless Chrome instance via the Chrome DevTools Protocol. It collects trace data, network logs, and DOM snapshots during a simulated page load, then runs a series of audits against the gathered artifacts. Each audit produces a score and diagnostic details. Results are aggregated into category scores weighted by impact. ## Self-Hosting & Configuration - Run via Chrome DevTools Lighthouse tab with zero setup - Install the CLI with npm for scripting and CI integration - Use `--preset=desktop` or `--preset=perf` to customize throttling and emulation - Configure custom audits or skip specific ones via a `--config-path` JSON file - Integrate with CI using Lighthouse CI to track scores over time and set budgets ## Key Features - Five audit categories covering performance, accessibility, best practices, SEO, and PWA - Core Web Vitals metrics aligned with Google search ranking signals - Lighthouse CI for automated regression testing in pull requests - User flow mode for auditing multi-step interactions like checkout flows - Timespan mode for measuring performance during specific user actions ## Comparison with Similar Tools - **WebPageTest** — remote lab testing with waterfall charts; Lighthouse focuses on local audits with broader category coverage - **PageSpeed Insights** — uses Lighthouse under the hood plus field data from CrUX; Lighthouse CLI runs locally - **axe-core** — specialized accessibility testing; Lighthouse includes axe-based checks alongside performance and SEO - **Unlighthouse** — scans entire sites using Lighthouse; Lighthouse audits one URL at a time by default - **Chrome DevTools Performance tab** — raw trace analysis; Lighthouse provides scored, actionable recommendations ## FAQ **Q: Are Lighthouse scores the same as PageSpeed Insights?** A: PageSpeed Insights uses Lighthouse for lab data but also includes field data from the Chrome User Experience Report, so scores may differ. **Q: Can I run Lighthouse in CI pipelines?** A: Yes. Lighthouse CI (LHCI) is designed for this, with GitHub Actions support, budget assertions, and historical tracking. **Q: How do I audit authenticated pages?** A: Use the `--extra-headers` flag to pass auth tokens, or use Lighthouse's user flow API to script login before auditing. **Q: Does Lighthouse support mobile and desktop emulation?** A: Yes. By default it simulates a mid-tier mobile device. Use `--preset=desktop` for desktop emulation with no throttling. ## Sources - https://github.com/GoogleChrome/lighthouse - https://developer.chrome.com/docs/lighthouse/ --- Source: https://tokrepo.com/en/workflows/ac7ff133-4384-11f1-9bc6-00163e2b0d79 Author: Script Depot