Skip to main content
The Lighthouse CLI is the most flexible way to run audits. It exposes all configuration options as command-line flags and supports multiple output formats.

Installation

npm install -g lighthouse
# or
yarn global add lighthouse

Basic usage

lighthouse <url> [options]
lighthouse https://example.com
# saves ./example.com_<date>.report.html by default

Logging flags

FlagTypeDefaultDescription
--verbosebooleanfalseDisplays verbose logging during the run.
--quietbooleanfalseSuppresses all progress, debug logs, and errors.

Configuration flags

FlagTypeDefaultDescription
--save-assetsbooleanfalseSave the trace contents and devtools logs to disk alongside the report.
--list-all-auditsbooleanfalsePrint a list of all available audits and exit.
--list-trace-categoriesbooleanfalsePrint a list of all required trace categories and exit.
--additional-trace-categoriesstringAdditional Chrome trace categories to capture, comma-delimited.
--config-pathstringPath to a custom config JS file. Overrides --preset when both are provided.
--presetstringUse a built-in configuration preset. Choices: perf, experimental, desktop.
--chrome-flagsstring""Space-delimited flags to pass to Chrome on launch. Uses CHROME_PATH env var if set.
--portnumber0Debugging protocol port. Use 0 for a random port.
--hostnamestring"localhost"Hostname for the debugging protocol.
--form-factorstringAffects scoring and skips mobile-only audits when set to desktop. Choices: mobile, desktop. For desktop audits, prefer --preset=desktop.
--screenEmulationSets screen emulation parameters. Use --screenEmulation.disabled to disable, or set individual sub-flags (see below).
--screenEmulation.mobilebooleanEmulate a mobile viewport.
--screenEmulation.widthnumberEmulated viewport width in pixels.
--screenEmulation.heightnumberEmulated viewport height in pixels.
--screenEmulation.deviceScaleFactornumberEmulated device scale factor.
--screenEmulation.disabledbooleanDisable all screen emulation.
--emulatedUserAgentstringOverride the user agent string sent with requests.
--max-wait-for-loadnumberMilliseconds to wait before considering the page done loading. High values can cause instability.
--enable-error-reportingbooleanEnable anonymous error reporting. Use --no-enable-error-reporting to opt out.
--gather-mode, -Gstring/booleanCollect and save artifacts to disk, then quit. Optionally provide a folder path.
--audit-mode, -Astring/booleanLoad saved artifacts from disk and run audits only. Defaults to ./latest-run/.
--only-auditsarrayRun only the specified audit IDs.
--only-categoriesarrayRun only the specified categories. Available: accessibility, best-practices, performance, seo.
--skip-auditsarraySkip the specified audit IDs.
--disable-full-page-screenshotbooleanSkip full-page screenshot collection, which can be large.
--gather-mode and --audit-mode can be combined as -GA to run the full audit while also saving artifacts to disk for later re-analysis.

Output flags

FlagTypeDefaultDescription
--outputarray["html"]Output format(s). Choices: json, html, csv. Accepts multiple values.
--output-pathstringFile path for the report. Use stdout for console output. When multiple formats are specified, the standard extension is appended to the base path.
--viewbooleanfalseOpen the HTML report in a browser after the run.

Output path behavior

CommandOutput
lighthouse <url><HOST>_<DATE>.report.html
lighthouse <url> --output jsonJSON sent to stdout
lighthouse <url> --output html --output-path ./report.html./report.html
lighthouse <url> --output json --output html --output-path ./myfile.json./myfile.report.json and ./myfile.report.html
lighthouse <url> --output json --output html<HOST>_<DATE>.report.json and <HOST>_<DATE>.report.html

Other flags

FlagTypeDefaultDescription
--versionbooleanPrint the Lighthouse version and exit.
--helpbooleanShow the help text and exit.
--cli-flags-pathstringPath to a JSON file containing default CLI flags. Command-line flags take priority over file-based ones.
--localestringLocale for the report output (e.g. en-US, fr).
--blocked-url-patternsarrayBlock network requests matching these URL patterns.
--disable-storage-resetbooleanSkip clearing the browser cache and storage APIs before the run.
--throttling-methodstringThrottling implementation to use. Choices: devtools, provided, simulate.
--throttling.rttMsnumberSimulated network RTT at the TCP layer (ms).
--throttling.throughputKbpsnumberSimulated network download throughput (Kbps).
--throttling.requestLatencyMsnumberEmulated network RTT at the HTTP layer (ms).
--throttling.downloadThroughputKbpsnumberEmulated network download throughput (Kbps).
--throttling.uploadThroughputKbpsnumberEmulated network upload throughput (Kbps).
--throttling.cpuSlowdownMultipliernumberCPU slowdown multiplier for simulated and emulated throttling.
--extra-headersstringJSON string or path to a JSON file of additional HTTP headers to send with requests.
--precomputed-lantern-data-pathstringPath to a file with precomputed Lantern simulation data, overriding observed estimates.
--lantern-data-output-pathstringPath to write Lantern simulation data for reuse in future runs.
--pluginsarrayNames of Lighthouse plugins to run.
--channelstring"cli"Identifies the run channel for internal tracking.
--chrome-ignore-default-flagsbooleanfalseIgnore Lighthouse’s default Chrome flags.

Usage examples

# Open HTML report in a browser after the run
lighthouse https://example.com --view

# Run with a custom config file
lighthouse https://example.com --config-path=./myconfig.js

# Save trace and named JSON report
lighthouse https://example.com --output=json --output-path=./report.json --save-assets

# Disable device emulation and throttling
lighthouse https://example.com --screenEmulation.disabled --throttling-method=provided --no-emulatedUserAgent

# Launch Chrome with a specific window size
lighthouse https://example.com --chrome-flags="--window-size=412,660"

# Run headless with quiet logging
lighthouse https://example.com --quiet --chrome-flags="--headless"

# Send custom HTTP headers
lighthouse https://example.com --extra-headers "{\"Cookie\":\"session=abc\", \"x-api-key\":\"secret\"}"

# Load headers from a file
lighthouse https://example.com --extra-headers=./headers.json

# Run only performance and SEO categories
lighthouse https://example.com --only-categories=performance,seo

Lifecycle (gather/audit) mode

Separate the gather and audit phases to reuse collected artifacts or integrate with external tools.
# Gather artifacts only, save to ./latest-run/
lighthouse https://example.com -G

# Audit pre-collected artifacts from ./latest-run/
lighthouse https://example.com -A

# Gather and audit, also saving artifacts
lighthouse https://example.com -GA

# Use a custom folder for artifacts
lighthouse -GA=./my-artifacts https://example.com
When using -A (audit-only mode), Lighthouse skips the browser entirely and reads artifacts from disk. The URL argument is still required for report metadata but no network request is made.

Connecting to an existing Chrome instance

To audit a page that requires authentication or a specific browser state, launch Chrome manually with chrome-debug (installed globally alongside the CLI), log in, then point Lighthouse at the running instance.
# 1. Start a Chrome instance with an open debugging port
chrome-debug
# logs: "Debugging on port 9222"

# 2. In a separate terminal, run Lighthouse against the port
lighthouse https://mysite.com --port=9222

Real device testing

Disable emulation when auditing against a real connected Android device via ADB port forwarding.
adb forward tcp:9222 localabstract:chrome_devtools_remote

lighthouse https://example.com \
  --port=9222 \
  --screenEmulation.disabled \
  --throttling.cpuSlowdownMultiplier=1 \
  --throttling-method=provided

Build docs developers (and LLMs) love