October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
browser automation

How to Install and Run Chromium in Headless Mode

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Short answer: install Chromium or Chrome for your operating system, then run its executable with --headless. Add --dump-dom to inspect the rendered page or --screenshot to create an image. For repeatable automation, use Puppeteer or Selenium. The exact installation command depends on your OS and distribution, so identify that first rather than copying a Linux command onto Windows or macOS.

What headless Chromium is

Headless mode runs Chromium without opening a visible browser window. It still loads pages, executes JavaScript, builds the DOM, applies CSS and can produce screenshots or PDFs. This is useful on servers, CI runners, containers and desktop scripts where there is no graphical session.

Headless is not the same as downloading HTML with an HTTP client. Chrome’s --dump-dom output is the serialized DOM after the document has been parsed and scripts have run; a plain HTTP request normally returns only the original response body.

Choose the browser you will install

Decide whether you need a complete Chrome browser or the smaller shell binary used for automation.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Choice What it provides Use it when Puppeteer setting
Unified Chrome/Chromium Headless The regular browser implementation running without a window, with behavior and features aligned with headful Chrome. You need maximum compatibility with ordinary Chrome, extensions or browser features. headless: true
chrome-headless-shell A standalone shell for headless automation. It does not fully match the regular Chrome browser. You specifically need the former headless implementation or prioritize its documented automation performance characteristics. headless: 'shell'

Chrome’s documentation says unified Headless and headful modes are now the same implementation. Since Chrome 132, the old implementation is no longer included in the regular Chrome binary; it is distributed as chrome-headless-shell. Older guidance that recommends --headless=old is therefore obsolete for current Chrome. Precompiled shell binaries became available through Chrome for Testing in milestone 118.

Install Chromium without assuming an operating system

Installation is platform-specific. Use your operating system’s current Chromium, Google Chrome or Chrome for Testing instructions, and record the resulting executable path. The name may be chromium, chromium-browser, google-chrome or an absolute path such as /path/to/chrome. Package names, sandbox dependencies, fonts and library requirements vary by Linux distribution and release; there is no single command that is correct everywhere.

  • Linux: install Chromium or Chrome using the package source supported by your distribution, then verify the binary from a shell.
  • macOS: install Chromium or Chrome for Testing and use the executable inside the application bundle, or place it on your PATH.
  • Windows: install Chromium or Chrome for Testing and use the installed executable path in Command Prompt or PowerShell.

After installation, verify the browser before attempting automation:

chromium --version
# or replace chromium with the executable name/path on your system

If that command is not found, use the full executable path. A successful version response confirms that the shell can locate the browser; it does not yet prove that all headless runtime libraries or fonts are present.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run a direct headless smoke test

Chromium’s documented smoke-test pattern starts a headless browser with a DevTools endpoint and a URL:

chromium --headless --remote-debugging-port=9222 https://example.com

Keep this process running while a DevTools client connects to port 9222. Use a different port if another process already owns 9222. In a locked-down environment, bind the debugging endpoint to an interface that is not publicly reachable and close the process when finished; an exposed DevTools port can grant control over the browser.

Get rendered HTML or an image from the command line

Print the rendered DOM

chromium --headless --dump-dom https://example.com

The command writes the serialized DOM to standard output after parsing and script execution. Redirect it to a file when inspecting output:

chromium --headless --dump-dom https://example.com > rendered.html

Dynamic pages may continue changing after the initial load. For deterministic results, automation code with an explicit wait is usually more reliable than a one-shot command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save a screenshot

chromium --headless --screenshot --window-size=1280,800 https://example.com

Chrome saves the image in the current working directory. --window-size sets the viewport used for the capture; choose dimensions that match the page layout you are testing. Confirm the exact output behavior against the version installed on your machine, because command-line details can change between releases.

Automate Chromium with Puppeteer

Puppeteer is the simplest Node.js route when you want selectors, waits, screenshots, PDFs or browser events rather than a single command. The puppeteer package ordinarily downloads a compatible Chrome for Testing and a chrome-headless-shell binary. Approximate download sizes documented by the project are 170 MB on macOS, 282 MB on Linux and 280 MB on Windows.

  1. Create a project and install Puppeteer: npm init -y, then npm install puppeteer.
  2. Create shot.js with the script below.
  3. Run node shot.js. The script writes example.png.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1280, height: 800, deviceScaleFactor: 1 });
    await page.goto('https://example.com', { waitUntil: 'networkidle2', timeout: 60000 });
    await page.screenshot({ path: 'example.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

headless: true selects unified Headless. To use the standalone shell downloaded by Puppeteer, change it to headless: 'shell'. Use the shell only when its reduced browser parity is acceptable.

Use a system-managed or remote browser

puppeteer-core does not download Chrome. It is appropriate when your operating system, container image or remote service manages the browser. Supply an executable path or a remote connection explicitly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const puppeteer = require('puppeteer-core');

(async () => {
  const browser = await puppeteer.launch({
    headless: true,
    executablePath: '/absolute/path/to/chrome'
  });
  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  console.log(await page.title());
  await browser.close();
})();

If package-install scripts are blocked by a corporate policy, install the browser separately with Puppeteer’s documented browser command, npx puppeteer browsers install, then point your script at the resulting executable as needed. Keep the Puppeteer and browser versions compatible.

Use Selenium instead

Selenium can launch the same browser when your test suite already uses WebDriver. In Python, add the headless argument to Chrome options and let your environment’s driver management locate a compatible browser and driver:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('--headless')
options.add_argument('--window-size=1280,800')

driver = webdriver.Chrome(options=options)
try:
    driver.get('https://example.com')
    print(driver.title)
finally:
    driver.quit()

Driver and browser compatibility remains an operational responsibility. If Selenium reports a session-creation or version error, check the browser version, driver version and executable paths before changing headless flags.

Make captures repeatable

  • Wait for the right condition: prefer a selector, a known application state or network-idle wait over an arbitrary short delay.
  • Set the viewport deliberately: responsive breakpoints change layout, so record width, height and device scale factor with each test.
  • Control fonts and locale: missing fonts, timezone and language settings can change line wrapping and screenshots.
  • Close every browser: use finally blocks or equivalent teardown so failed tests do not leave orphaned processes.
  • Keep debugging private: never publish an unauthenticated remote-debugging port, cookies or authorization headers.
  • Cache intentionally: browser caches improve speed but can hide deployment problems; disable or clear them when testing fresh assets.

Troubleshoot common failures

“Command not found” or an invalid executable path

The shell cannot locate Chromium. Run the version check with the full path, correct your PATH, or set Puppeteer’s executablePath. Do not assume the executable is named chromium on every platform.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The browser exits immediately in a server or container

Headless still needs compatible operating-system libraries, fonts and a functioning sandbox configuration. Install the dependencies specified for your distribution and inspect the browser’s stderr output. Avoid disabling the sandbox unless the environment is isolated and you understand the security trade-off; running as an unprivileged user is preferable.

A blank, incomplete or pre-JavaScript page is captured

The page may still be loading, may require a consent interaction, or may render only after a client-side request. Use Puppeteer’s waitUntil, wait for a meaningful selector, and increase the timeout for slow origins. A fixed sleep alone is fragile.

Screenshot dimensions or content differ from a visible browser

Compare viewport size, device scale factor, fonts, browser version, timezone and user agent. Headless and headful should share the modern Chrome implementation, but your script may still select different settings or wait at a different point in the page lifecycle.

Puppeteer cannot find its downloaded browser

Installation scripts may have been disabled, the cache may be unavailable, or a restricted network may have interrupted the download. Run npx puppeteer browsers install where policy permits, or use puppeteer-core with a browser path that your deployment manages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The old --headless=old flag fails

That mode was removed from the regular Chrome binary in Chrome 132. Use unified --headless, or obtain the separate chrome-headless-shell binary when that specific implementation is required.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is simply a reliable website image or PDF, ScreenshotNeo provides a hosted screenshot API at https://screenshotneo.com. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

See the complete parameter reference in the ScreenshotNeo documentation. A one-call capture looks like this:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. Features include full-page lazy-image loading, CSS-selector element capture, dark mode, device presets, retina scale, PDF controls, custom CSS and JavaScript, clicks, selector waits, request blocking, headers, cookies, user agents, timezone and geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account to try it.

Best Value

FAQ

Does headless Chromium need a display server?

No. Headless mode is designed to run without a visible desktop session. It still requires the operating-system libraries, fonts and permissions needed by the browser binary.

Can I use Chromium and Chrome interchangeably?

The command-line concepts are similar, but executable names, bundled components and version behavior differ. Test the exact binary that production will run.

When should I choose puppeteer-core?

Choose it when your deployment owns the browser version or connects to a remote browser. Choose puppeteer when an automatically downloaded compatible browser is more convenient.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can headless Chromium create PDFs as well as screenshots?

Yes. Use a browser automation library such as Puppeteer and its PDF API when you need paper size, margins, orientation or page-range control; the basic command-line examples above focus on DOM output and screenshots.

Is a headless screenshot guaranteed to match a user’s screen?

No. Viewport, device scale factor, fonts, browser version, locale, timezone, animations and page timing all affect pixels. Fix those inputs and wait for a stable application state when visual consistency matters.

Quick Recap

Bestseller No. 1
The Chromium Connection: A Lesson in Nutrition
The Chromium Connection: A Lesson in Nutrition
Used Book in Good Condition
$215.30
Bestseller No. 3
Bestseller No. 4
Bestseller No. 5
The Chromium Diet, Supplement and Exercise Strategy
The Chromium Diet, Supplement and Exercise Strategy
Used Book in Good Condition
$17.95

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.