Lighthouse
An open-source tool by Google that audits web page quality across performance, accessibility, SEO, best practices, and progressive web app criteria.
Detailed Explanation
Lighthouse is a comprehensive web quality audit tool. It runs in Chrome DevTools, from the command line, or as a CI/CD integration. It audits five categories: Performance (speed metrics), Accessibility (WCAG compliance), SEO (search optimization), Best Practices (web standards), and PWA (progressive web app features).
Lighthouse provides scores (0-100) for each category, identifies issues, and suggests specific fixes. It measures Core Web Vitals, checks for common problems (unoptimized images, render-blocking resources, missing meta tags), and validates accessibility.
Why It Matters
Lighthouse is the standard tool for web quality auditing. It identifies issues across performance, accessibility, and SEO, providing actionable recommendations.
Real-World Example
A developer runs Lighthouse and gets: Performance 65, Accessibility 92, SEO 88. Lighthouse identifies: unoptimized images (compress them), render-blocking CSS (defer non-critical CSS), and missing meta description (add one).
When to Use
Run Lighthouse regularly during development, before deployments, and during performance reviews. Integrate into CI/CD for automated quality gates.
Advantages
- Comprehensive quality audit
- Actionable recommendations
- Free and open-source
- Available in Chrome DevTools
- CI/CD integration (Lighthouse CI)
Disadvantages
- Lab data may differ from real-world performance
- Does not capture all real-world issues
- Scores can vary between runs
- Does not test cross-browser compatibility
- Can be slow for complex pages
Related Terms
Frequently Asked Questions
How do I run Lighthouse?
Open Chrome DevTools (F12) → Lighthouse tab → Generate report. Or install the CLI: `npm install -g lighthouse` and run `lighthouse https://example.com`. Or use PageSpeed Insights (web-based).
What is a good Lighthouse score?
90-100 is "Good." 50-89 is "Needs Improvement." 0-49 is "Poor." Aim for 90+ in Performance and 100 in Accessibility. Perfect 100s are not always necessary or practical.
How do I integrate Lighthouse into CI/CD?
Use Lighthouse CI: `npm install -g lhci` and configure `lighthouserc.js`. It runs Lighthouse on every build and fails if scores drop below thresholds. GitHub Actions integration is straightforward.
Why does my Lighthouse score vary between runs?
Lighthouse runs in lab conditions that can vary: network speed, server response time, and CPU load. Use Chrome User Experience Report (CrUX) for stable, real-world data.
Does Lighthouse test security?
Lighthouse checks some security aspects (HTTPS, no vulnerable libraries) but is not a security scanner. For comprehensive security testing, use specialized tools (OWASP ZAP, Snyk).