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

Headless Chrome is Chrome running without a visible browser window. It is used to automate browser tasks on servers, in containers and in CI pipelines: testing web applications, capturing screenshots, generating PDFs, inspecting the rendered DOM, analyzing performance and checking responsive layouts. Current Headless mode uses the same browser implementation as regular Chrome, so its behavior is suitable for high-fidelity automated tests.

You can run it directly from Chrome’s command line or drive it with Puppeteer, ChromeDriver and Selenium-WebDriver. The right approach depends on whether you need a quick one-off output, a repeatable test suite or a service that captures many URLs.

What “headless” means

A normal (headful) Chrome session displays tabs, toolbars and pages in a window. Headless Chrome starts the browser engine without drawing that user interface. Your program still gets a real page load: Chrome parses HTML, executes JavaScript, applies CSS, makes network requests and builds the rendered page. The difference is that no person needs to see or operate a window.

That makes Headless useful where a graphical desktop is unavailable or undesirable, such as Linux servers, Docker containers and continuous-integration (CI) workers. Modern Headless, updated in Chrome 112, is unified with regular Chrome’s browser implementation. The older implementation became a separate chrome-headless-shell binary after Chrome 132.0.6793.0. See the Chrome Headless documentation for the current distinction.

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

What is Headless Chrome used for?

Automated browser and end-to-end testing

Headless runs repeatable user journeys without manual clicks: open a page, sign in, submit a form, follow a checkout flow and assert that the expected text or element appears. Puppeteer provides a high-level JavaScript API for navigation and interaction, while ChromeDriver and Selenium-WebDriver provide driver-based alternatives. Running the same script on every CI commit catches regressions before release.

For results that remain stable, pair Headless with a pinned Chrome for Testing binary rather than an auto-updating desktop installation.

Screenshot capture and visual regression checks

Headless can save a viewport screenshot from the command line. Automation libraries can wait for application state, set a viewport and capture either the full page or one element. Teams compare these images between builds to detect changed spacing, fonts, colors or broken responsive layouts. A screenshot represents the rendered result after scripts run, not merely the original HTML response.

PDF generation

Chrome’s print pipeline can render a URL to PDF with --print-to-pdf. Puppeteer exposes the same capability with options for paper format, margins, headers and footers. This is useful for invoices, reports, documentation and archival copies generated on demand.

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.

Inspecting the rendered DOM

--dump-dom prints a serialized DOM after Chrome has parsed the document and executed scripts that modify it. That lets you inspect content produced by client-side frameworks. It is different from downloading source with curl: source is the server response, while the dumped DOM is the post-script document Chrome has built.

Performance and network-aware automation

Puppeteer can support performance analysis and intercept requests and responses. A test can record navigation timing, block an unnecessary resource, mock an API response or verify that a page does not request a disallowed host. These controls help diagnose slow pages and make tests deterministic.

Responsive and multi-display checks

Headless virtual screens can be configured for resolution, device scale, orientation, fullscreen, kiosk-style behavior, pop-up windows and multi-screen arrangements. Chrome documents this in Configure virtual screens in Headless mode. It is useful when a product must behave correctly at several viewport sizes or on more than one display.

Run common tasks from the command line

The examples below use a chrome executable available on your PATH. On some systems the binary is named google-chrome or chromium; substitute that name. The complete flag reference is in Chrome’s Headless command-line documentation.

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

Dump the rendered DOM

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

The command writes serialized markup to standard output. Redirect it to a file when another process will parse it.

Capture a screenshot

chrome --headless --screenshot --window-size=412,892 https://example.com/

Chrome writes a PNG in the current directory. --window-size sets the CSS viewport; it does not emulate every property of a named phone. For full-page or element-specific captures, use an automation library.

Print a page to PDF

chrome --headless --print-to-pdf https://example.com/

The output is a PDF generated by Chrome’s print layout. Site print CSS, delayed data and authentication requirements can affect what appears.

Control timing

--timeout limits how long Chrome waits before producing output. --virtual-time-budget advances timer-driven page code quickly, which can help when an animation or delayed script must run before capture. Choose values based on the application; a short timeout can save time but produce incomplete output.

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

Use Puppeteer for scripted workflows

Puppeteer is a JavaScript library maintained in the Chrome developer ecosystem. It can launch Headless, navigate, locate elements, upload files, intercept traffic and capture screenshots or PDFs. Install it in a Node.js project with npm install puppeteer; by default it downloads a compatible Chrome for Testing browser.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({
  headless: true,
});

const page = await browser.newPage();
await page.goto('https://developer.chrome.com/', {
  waitUntil: 'networkidle2'
});
await page.screenshot({path: 'page.png', fullPage: true});
await page.pdf({path: 'page.pdf', format: 'A4', printBackground: true});
await browser.close();

headless: true selects current unified Headless. Puppeteer also documents headless: 'shell' for the separate Headless Shell and headless: false for a visible browser. Use an explicit waitUntil, a selector wait or a bounded delay for pages whose data arrives after the initial response.

Capture one element

const card = await page.waitForSelector('.pricing-card');
await card.screenshot({path: 'pricing-card.png'});

Element screenshots avoid unrelated navigation and are convenient for component-level visual tests. Keep selectors stable and fail the test when the selector never appears.

Headless Chrome versus Headless Shell

Choice Implementation Best fit Trade-off
Current Headless (--headless) The regular Chrome browser implementation without its UI End-to-end tests, extensions and results that should match users’ Chrome Uses the broader Chrome feature set and its associated resources
chrome-headless-shell A separate, lighter legacy Headless implementation Jobs where a smaller environment and fewer dependencies matter Not the full unified Chrome implementation; verify that its behavior covers your test

Chrome’s Headless guide and the historical overview in Tools from Chrome for frictionless, automated testing describe this split. If fidelity to ordinary Chrome is the priority, start with unified Headless. If resource constraints dominate and your workflow does not require full Chrome behavior, evaluate the shell.

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

Build a repeatable CI workflow

  1. Pin the browser. Use a specific Chrome for Testing version so an automatic browser update does not change rendering between runs.
  2. Choose a driver. Use Puppeteer for a JavaScript-first API, or ChromeDriver with Selenium-WebDriver when your team already uses WebDriver.
  3. Set deterministic inputs. Fix viewport, device scale, timezone, locale, test data and network dependencies. Mock unstable third-party responses where appropriate.
  4. Wait for application state. Prefer a meaningful selector or application-ready signal over an arbitrary long sleep. Add a maximum timeout so a broken page cannot hang the job.
  5. Save diagnostics. On failure, retain a screenshot, console log, network log and (when useful) a DOM dump. These artifacts make a headless failure debuggable.
  6. Run the same command locally and in CI. Containerizing dependencies or using the same Chrome for Testing build reduces “works on my machine” differences.

Chrome’s automation overview explains how these components fit together and notes Puppeteer’s compatible-browser download behavior.

Or skip the browser setup

If your requirement is simply to obtain clean screenshots or PDFs from URLs, a hosted API avoids installing Chrome, managing sandbox flags and maintaining a browser worker. ScreenshotNeo is a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and response headers report the page verdict and billing status.

One GET request returns PNG, JPEG, WebP or PDF. The API supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets or custom viewports, retina scale, PDF paper and margin settings, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, request or resource blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Parameter names used by other screenshot APIs also work, easing migration.

It also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

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

cURL

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}`);

See the ScreenshotNeo documentation for request options and response headers. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan. Sign up for the free plan.

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

Troubleshooting Headless runs

Chrome exits immediately in a container

Check that the image includes Chrome’s shared libraries and fonts, and that the process has a writable temporary directory. A restricted sandbox or user namespace can also prevent startup; use the security configuration recommended by your container platform rather than copying unsafe flags blindly.

The screenshot is blank or incomplete

The page may still be loading data, require authentication or render content only after scrolling. Wait for an application-ready selector, use an appropriate navigation condition, and inspect console and network errors. For lazy images, scroll or use a full-page capture method that triggers loading.

Tests pass locally but fail in CI

Compare Chrome versions, fonts, locale, timezone, viewport and available resources. Pin Chrome for Testing, run the same container image and remove dependence on live third-party services. Retain a failure screenshot and DOM dump to identify environmental differences.

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

PDF layout differs from the screen

PDF uses print media rules. Check the site’s print CSS, set the intended paper format and margins, and enable background printing when colors or images are required. Wait for web fonts and data before calling the PDF method.

CAPTCHA or bot checks block automation

Do not attempt to bypass access controls. Use an authorized test environment, a test account or an API supplied by the site owner. A hosted capture service can report bot-check and failed-load verdicts instead of charging for an unusable capture.

Choosing the right approach

Need Good starting point
One screenshot, PDF or DOM dump Chrome command line
Multi-step interactions and assertions Puppeteer, ChromeDriver or Selenium-WebDriver
Version-stable CI tests Chrome for Testing plus a pinned driver and Headless mode
Lean runtime with limited dependencies Evaluate chrome-headless-shell against your required features
Production URL capture without browser maintenance ScreenshotNeo API or MCP server

Frequently Asked Questions

Does Headless Chrome execute JavaScript?

Yes. It loads pages and runs scripts like Chrome; --dump-dom reports the DOM after those scripts can modify it.

Can Headless Chrome run without a display server?

Yes. Its purpose is to run without a visible UI, making it suitable for servers, containers and CI workers.

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

Is Headless Chrome the same as Chromium?

Headless describes Chrome’s operating mode, not a separate browser brand. The exact binary and build you run determine whether you are using Google Chrome, Chromium or the separate Headless Shell.

Which automation interface should a new project use?

Use Puppeteer for a JavaScript-first Chrome workflow; choose ChromeDriver and Selenium-WebDriver when your organization already standardizes on WebDriver.

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.