User Agents

Web browsers and everyday web tech, explained

Headless Chrome User Agent: What It Is

· 6 min read · How the Web Works

In this article
  1. Background: Why Headless Chrome Exists
  2. What the Headless Chrome User Agent Actually Looks Like
  3. Is 'HeadlessChrome' a Standard Term?
  4. How the User Agent Is Sent and Why It Matters
  5. How to Find or Change the Headless Chrome User Agent
  6. Common Problems and Misconceptions
  7. Comparing Headless Chrome to Other Headless Browsers
  8. Frequently Asked Questions

The headless Chrome user agent is the browser identification string that Google Chrome sends when running in headless mode—a version of the browser with no graphical interface. It is not a separate product or a standard term; rather, it is the same Chrome user agent with the word HeadlessChrome inserted, and it is used by automated tools like Puppeteer and Selenium to signal that the request comes from a scripted, non-visual browser. This string matters because websites and analytics services often treat headless browsers differently, and understanding it helps developers debug scraping, testing, and automation issues.

Background: Why Headless Chrome Exists

Headless Chrome was introduced in Chrome 59 (June 2017) as a way to run the full Chrome engine without rendering a visible window. Before that, automated testing often relied on older tools like PhantomJS, which had a different engine and produced inconsistent results. Headless Chrome lets developers run the same Chromium rendering engine that real users see, but without the overhead of a display. It is used for:

  • Automated testing of web pages (e.g., checking layout, running JavaScript)
  • Taking screenshots and generating PDFs from web content
  • Web scraping and data extraction
  • Server-side rendering of JavaScript-heavy pages

The user agent string is part of how the browser identifies itself to web servers. In headless mode, Chrome alters that string to include HeadlessChrome, which is a deliberate signal—not a bug.

What the Headless Chrome User Agent Actually Looks Like

The exact string depends on the Chrome version and operating system. A typical example (from Chrome 120 on Windows) is:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/120.0.0.0 Safari/537.36

Compare that to a regular Chrome user agent on the same system:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

The only difference is the replacement of Chrome with HeadlessChrome in the product token. The rest—the Mozilla, AppleWebKit, and Safari parts—are legacy strings that Chrome keeps for compatibility with old websites that might otherwise break. The version number reflects the underlying Chrome version, so it changes with each release.

Is 'HeadlessChrome' a Standard Term?

No, HeadlessChrome is not a standard or formal term in the same way that, say, 'HTTP' is. It is an informal identifier used by Google in the user agent string. It is not slang, because it appears in official Chrome source code and documentation, but it is also not a standardized token recognized by any formal standards body like the IETF. The origin is straightforward: Google simply added the word 'Headless' to the Chrome product name to indicate the mode. In practice, you'll see it in server logs, analytics, and user agent parsing libraries. It is used in sentences like: 'The request came from a headless Chrome user agent, so we skipped the ad script.'

How the User Agent Is Sent and Why It Matters

When Chrome runs in headless mode, it sends the modified user agent in the HTTP User-Agent header with every request. This header is part of the HTTP protocol, and any server can read it. Websites can then decide how to respond. For example, a site might:

  • Serve a simpler version of the page to headless browsers to reduce load
  • Block automated access entirely (common for scraping protection)
  • Show a CAPTCHA or require JavaScript execution
  • Return different content, such as a login wall

This matters because automated tools often need to mimic a real browser to avoid being blocked. However, changing the user agent to hide headless mode is a gray area—it can violate a site's terms of service. For legitimate testing, it's usually fine to leave the default string.

How to Find or Change the Headless Chrome User Agent

If you're using Puppeteer (a Node.js library), you can retrieve the user agent with:

const browser = await puppeteer.launch({headless: true});
const page = await browser.newPage();
const ua = await page.evaluate(() => navigator.userAgent);
console.log(ua);

To change it, use:

await page.setUserAgent('My Custom User Agent');

In Selenium with ChromeDriver, you can set the user agent via command-line options:

chrome_options.add_argument('--user-agent=My Custom UA')

Note that Chrome also supports a --user-agent flag when launching from the command line, which applies to all requests. However, be aware that some sites check for other headless indicators (like the presence of HeadlessChrome in the navigator object), so changing the user agent alone may not fully disguise the browser.

Common Problems and Misconceptions

One frequent issue is that websites block headless Chrome because they see the user agent and assume it's a bot. This can break legitimate automated tests. Solutions include using the --headless=new mode (introduced in Chrome 112) which uses the same code path as the regular browser and may reduce detection, but it still sends HeadlessChrome.

A common misconception is that the headless user agent is the same as the regular one. It's not—the HeadlessChrome token is always present unless you manually override it. Another misconception is that removing the token makes the browser undetectable. In reality, headless mode leaves other traces, such as missing plugins, different rendering behavior, and the navigator.webdriver property set to true in some automation tools.

Another problem is that the user agent string can be stale if you're using an old version of Chrome. Always keep your browser updated to get the latest version number in the string, which some sites check for.

Comparing Headless Chrome to Other Headless Browsers

Headless Chrome is not the only option. Other headless browsers include:

  • Firefox headless – sends Firefox in the user agent, not HeadlessFirefox (it uses the same UA as regular Firefox).
  • PhantomJS – now discontinued, used PhantomJS in the UA.
  • HtmlUnit – a Java-based headless browser with its own UA.
  • Playwright – a library that can drive Chromium, Firefox, and WebKit headlessly; it uses the underlying browser's UA.

Compared to these, headless Chrome is the most widely used because it's fast, supports modern web standards, and integrates well with Puppeteer and Selenium. However, it is heavier than lightweight alternatives like HtmlUnit, which might be better for simple scraping tasks.

Frequently Asked Questions

Does headless Chrome always send the same user agent as regular Chrome?

No, it sends the same base string but with HeadlessChrome instead of Chrome. The rest of the string (OS, AppleWebKit, Safari) is identical.

Can I make headless Chrome use the regular Chrome user agent?

Yes, you can override it using the --user-agent flag or by calling page.setUserAgent() in Puppeteer. However, this may be considered deceptive and could violate a website's terms of service.

Why do some websites block headless Chrome?

Websites often block headless browsers to prevent scraping, automated fraud, or bot traffic. The user agent is one signal they use to identify non-human visitors.

Is the headless Chrome user agent the same across all operating systems?

No, the OS token changes (e.g., Windows NT 10.0, Macintosh, X11; Linux x86_64), but the HeadlessChrome part is consistent.

Does the user agent affect how a website renders?

Not directly. The user agent is just a string; the server may choose to send different content based on it, but the browser's rendering engine is the same regardless of the UA string.

Is it safe to use headless Chrome for web scraping?

It can be safe if you respect the website's terms of service and robots.txt. However, scraping can be illegal or unethical in some contexts, so always check the site's policies first.