Parse Google Chrome User-Agent String
Learn how to parse a Google Chrome User-Agent string to extract the browser version, operating system, and rendering engine. Covers Chrome on Windows, macOS, and Linux.
Detailed Explanation
Understanding the Chrome User-Agent String
Google Chrome has the most widely used User-Agent string format on the web. A typical Chrome UA string on Windows looks like this:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Breaking Down Each Token
- Mozilla/5.0 — A legacy compatibility token inherited from Netscape Navigator. Every modern browser includes this prefix so servers do not serve degraded content.
- (Windows NT 10.0; Win64; x64) — The operating system and platform.
Windows NT 10.0maps to Windows 10 or Windows 11.Win64; x64indicates a 64-bit system. - AppleWebKit/537.36 — The rendering engine identifier. Chrome uses Blink (a fork of WebKit), but reports itself as WebKit for compatibility.
- (KHTML, like Gecko) — Another legacy token. KHTML was the rendering engine of Konqueror, which WebKit was forked from. "like Gecko" was added to avoid being blocked by sites that only served content to Gecko-based browsers.
- Chrome/120.0.0.0 — The actual Chrome version. The first number (120) is the major version, which increments roughly every 4 weeks.
- Safari/537.36 — Yet another legacy token. Chrome inherited this from the WebKit days, and it persists for backward compatibility.
Chrome on Different Operating Systems
On macOS, the platform token changes:
(Macintosh; Intel Mac OS X 10_15_7)
On Linux:
(X11; Linux x86_64)
On Chrome OS:
(X11; CrOS x86_64 14541.0.0)
Why Chrome's UA Is So Verbose
Chrome's User-Agent string includes tokens from Safari, WebKit, Gecko, and Mozilla for historical compatibility. This verbosity makes manual parsing error-prone, which is why dedicated UA parsers use carefully ordered regex patterns to extract the correct browser name and version.
Use Case
Web developers and analytics engineers parse Chrome UA strings to segment traffic by browser version, identify outdated Chrome installations that may lack support for newer CSS or JavaScript features, and distinguish Chrome from Chromium-based forks like Edge, Opera, and Brave.