> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/GoogleChrome/lighthouse/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI quickstart

> Install Lighthouse globally and run your first audit from the command line.

The Lighthouse CLI gives you full control over audit configuration and output. Use it for one-off audits, automated scripts, or CI pipelines.

<Note>Lighthouse requires Node.js 22 (LTS) or later. Run `node --version` to check.</Note>

<Steps>
  <Step title="Install Lighthouse">
    Install the `lighthouse` package globally using npm or Yarn.

    <CodeGroup>
      ```bash npm theme={null}
      npm install -g lighthouse
      ```

      ```bash yarn theme={null}
      yarn global add lighthouse
      ```
    </CodeGroup>

    Verify the installation:

    ```bash theme={null}
    lighthouse --version
    ```
  </Step>

  <Step title="Run your first audit">
    Point Lighthouse at any URL. Chrome launches automatically, loads the page, collects data, and exits.

    ```bash theme={null}
    lighthouse https://example.com
    ```

    By default, Lighthouse audits all four categories (Performance, Accessibility, SEO, Best Practices) using simulated mobile throttling.

    <Tip>Add `--view` to automatically open the HTML report in your browser as soon as the audit finishes.</Tip>
  </Step>

  <Step title="View the HTML report">
    Unless you specify otherwise, Lighthouse saves an HTML report to a file in the current directory:

    ```
    example.com_<DATE>.report.html
    ```

    Open this file in any browser to see your scores, metric values, and actionable recommendations for every failing audit.

    You can also upload any `.report.json` file to the [Lighthouse Viewer](https://googlechrome.github.io/lighthouse/viewer/) to view and share reports online.
  </Step>

  <Step title="Try JSON output">
    Use the `--output` flag to change the report format. Lighthouse supports `html`, `json`, and `csv`.

    ```bash theme={null}
    lighthouse https://example.com --output json
    ```

    JSON output goes to stdout by default. Redirect it to a file with `--output-path`:

    ```bash theme={null}
    lighthouse https://example.com --output json --output-path ./report.json
    ```

    You can request multiple formats in a single run:

    ```bash theme={null}
    lighthouse https://example.com --output json --output html
    # saves example.com_<DATE>.report.json and example.com_<DATE>.report.html
    ```

    Other output examples:

    ```bash theme={null}
    # Save to a specific HTML file
    lighthouse https://example.com --output html --output-path ./report.html

    # Save named files for both formats
    lighthouse https://example.com --output json --output html --output-path ./myfile.json
    # saves ./myfile.report.json and ./myfile.report.html
    ```
  </Step>
</Steps>

## Common flags

| Flag                | Description                                                 |
| ------------------- | ----------------------------------------------------------- |
| `--view`            | Open the HTML report in a browser after the run completes   |
| `--output`          | Report format: `html`, `json`, or `csv` (repeatable)        |
| `--output-path`     | File path for the report output                             |
| `--only-categories` | Comma-separated list of categories to audit                 |
| `--preset`          | Use a built-in config: `perf`, `desktop`, or `experimental` |
| `--quiet`           | Suppress progress and log output                            |
| `--chrome-flags`    | Pass custom flags to the Chrome process                     |

<Tip>
  Use `--only-categories=performance` to skip Accessibility, SEO, and Best Practices audits. This significantly reduces run time when you only need performance metrics.

  ```bash theme={null}
  lighthouse https://example.com --only-categories=performance
  ```
</Tip>

Run `lighthouse --help` to see all available options.
