How to Use Google Lighthouse for Performance Audits
· Category: Web Performance
Short answer
Google Lighthouse is an open-source tool that audits web pages for performance, accessibility, SEO, and best practices. It can run in Chrome DevTools or from the command line.
Steps
- Open Chrome DevTools and navigate to the Lighthouse tab.
- Choose the categories and device type to simulate.
- Click "Analyze page load" and wait for the report.
- Review the scores and prioritized improvement suggestions.
- Run Lighthouse in CI with the Node CLI for regression testing.
Tips
- Use the Lighthouse CI GitHub Action to enforce budgets on pull requests.
- Run multiple audits and average the scores for consistency.
- Focus on the metric diagnostics rather than the overall score alone.
Common issues
- Extensions and cached data skew lab results; use Incognito mode.
- Different machines produce different scores due to CPU throttling differences.