How to detect headless Chrome and automated browsers
Short answer
Detect headless and automated browsers by combining signals: navigator.webdriver, software graphics renderers such as SwiftShader or llvmpipe, missing operating system fonts, a window exactly the size of the screen, traces left by automation protocols, and contradictions between the User-Agent, client hints and what JavaScript reports. Headless Chrome now shares the normal browser's code, so single flags stop working quickly.
Headless browsers run a real browser engine without a visible window, and automation frameworks such as Puppeteer, Playwright and Selenium drive them through a control protocol. They execute JavaScript, store cookies and render pages, so a check that only asks "does this client run JavaScript?" lets them through. Detecting them means finding the traces automation leaves and the contradictions between what the browser claims to be and what it is.
Why has headless Chrome become harder to detect?
Old headless Chrome was a separate implementation with many visible differences. Chrome has since unified the two: the current headless mode shares its code with normal Chrome, and since Chrome 132 the old mode ships only as a separate binary called chrome-headless-shell. Many differences that detection used to rely on simply disappeared.
On top of that, bot operators use patched builds and plugins that hide the best-known leaks, which how modern bots are built describes. Any single check can expire with the next browser or framework release. Contradictions between several layers last longer, because hiding them means faking an entire computer consistently.
Which automation flags still work?
navigator.webdriver is true when a browser is controlled by automation. MDN lists the conditions: in Chrome, the --enable-automation or --headless flag, or --remote-debugging-port set to 0; in Firefox, the Marionette flag or preference. Patching the value is easy, but patches leave traces of their own, such as a property defined in the wrong place or a getter whose source is not native code.
Default headless builds also put HeadlessChrome in the User-Agent. That catches careless scripts and nothing else.
Automation drivers add objects and bindings to the page that real browsers never have. ChromeDriver, for example, has long been associated with variables whose names start with cdc_. Frameworks that use the Chrome DevTools Protocol (CDP) also cause side effects: when the protocol's Runtime domain is enabled, the browser serialises objects passed to console methods so it can report them to the controller, and a page can observe that happening. Browser and framework updates have closed several of these leaks, so test every check against current versions before relying on it.
What does the graphics stack reveal?
Servers running headless browsers usually have no GPU, so the browser falls back to a software renderer: SwiftShader in Chrome, or Mesa's llvmpipe on Linux. The WebGL renderer string exposes this through the WEBGL_debug_renderer_info extension:
function graphicsInfo() {
const gl = document.createElement('canvas').getContext('webgl');
if (!gl) return { webgl: false, cores: navigator.hardwareConcurrency };
const ext = gl.getExtension('WEBGL_debug_renderer_info');
const renderer = ext ? gl.getParameter(ext.UNMASKED_RENDERER_WEBGL) : gl.getParameter(gl.RENDERER);
return {
webgl: true,
renderer,
software: /swiftshader|llvmpipe|softpipe|basic render/i.test(renderer),
cores: navigator.hardwareConcurrency,
};
}Some real people also get a software renderer: virtual machines, remote desktops and computers whose graphics driver the browser has blocked. The signal becomes strong in combination, for example a software renderer together with a high CPU core count typical of server hardware and a Linux platform, on a client that claims to be a Windows laptop.
The renderer string also has to fit the claimed system. Chrome on Windows usually reports an ANGLE renderer backed by Direct3D, Safari reports an Apple GPU, and a "Mac" whose renderer mentions Direct3D is not a Mac.
What do fonts, plugins and screen size show?
Container images for headless browsers ship with few fonts. A client claiming Windows should have Windows system fonts such as Segoe UI, and a Mac should have Apple's. You can test for a font by measuring text against fallback fonts:
function hasFont(name) {
const ctx = document.createElement('canvas').getContext('2d');
const sample = 'mmmmmmmmmmlli1WQ';
return ['monospace', 'serif', 'sans-serif'].some((fallback) => {
ctx.font = `72px ${fallback}`;
const base = ctx.measureText(sample).width;
ctx.font = `72px "${name}", ${fallback}`;
return ctx.measureText(sample).width !== base;
});
}document.fonts.check() is not a substitute, because it can return true for fonts that are not installed.
An empty navigator.plugins list used to be a classic headless sign. Current browsers follow the HTML standard and report a fixed list of PDF viewer entries, so that check has mostly aged out.
Window geometry still helps. A headless window often has the same size as the reported screen, with outerWidth equal to innerWidth because there is no browser interface around the page, and a screen with no space taken by a taskbar or dock. Full-screen users and kiosks look similar, so this signal also needs company.
How do you check the User-Agent against client hints and JavaScript?
Chromium browsers send User-Agent client hints on HTTPS requests, and JavaScript can read more of them through navigator.userAgentData. Firefox and Safari support neither, so their absence is normal there. Contradictions to look for:
- A Chrome User-Agent without
sec-ch-uaheaders on HTTPS. - A Safari or Firefox User-Agent with
navigator.userAgentDatapresent, which only Chromium has. - A platform hint that disagrees with the User-Agent, as in this request:
GET /login HTTP/2
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
sec-ch-ua: "Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"navigator.platform, fonts and the WebGL renderer pointing to a different operating system than the User-Agent.- Values read inside a Web Worker that differ from the same values in the page, which happens when a patch only covers the main page.
- A claimed browser version that lacks features that version ships with.
Compare the browser data with the network as well. A TLS fingerprint that does not match the claimed browser, or a time zone that does not fit the IP country, adds weight to the case.
How do you combine the signals?
Treat each check as a weight in a score. Contradictions deserve more weight than oddities, because a real browser can be unusual but rarely lies about its own operating system. Then group sessions by the combination of values: the same software renderer, core count, font set and window size across hundreds of IP addresses is a farm, even if each session passes on its own. Behaviour adds a separate layer, covered in behavioral bot detection, and uncertain sessions can get an invisible JavaScript challenge.
Test your checks in both directions. Run Puppeteer, Playwright and Selenium with default settings in your own test pipeline and confirm they are caught. Then check a sample of known humans on virtual machines, remote desktops, Linux desktops and privacy browsers to see how often each rule fires on them, as described in false positives in bot detection. Repeat after major Chrome releases. Fraud tools that fake complete fingerprints need a different approach, covered in detecting antidetect browsers.
Tools that help
StopBots is published by Kairal, which is one of the tools listed. The list is not a ranking.
- BotD is a free, open-source library from the FingerprintJS team that detects common automation tools in the browser, a reasonable first layer for a small site.
- Cloudflare Bot Management combines its edge signals with JavaScript detections and fits sites already on Cloudflare.
- DataDome is a commercial bot and fraud protection service that analyses requests server-side and in the browser, with integrations for common CDNs and web servers.
- Kasada is a commercial bot defence service that runs client-side checks for automation, aimed at sites facing persistent attacks.
- Kairal correlates browser, device, network and behaviour signals per endpoint and verifies uncertain visitors with invisible challenges.
Common questions
Can websites detect Playwright and Selenium?
Default setups are easy to detect, because they set navigator.webdriver and leave driver traces. Operators who patch those leaks are harder to catch, and detection then depends on contradictions in the environment, behaviour and network data more than on any framework-specific flag.
Is a headless browser always a bot?
It is always automation, but not always unwanted. Your own end-to-end tests, uptime monitors, link preview services, accessibility checkers and some AI agents run headless browsers. Allow the ones you know by IP, signed requests or credentials before your headless rules run.
What is headless browser fingerprinting?
It is the part of browser fingerprinting that looks for the values headless and automated browsers tend to produce, such as a software renderer, a server-class CPU core count and a font list from a Linux container. The same values on many IP addresses usually mark a bot farm.