How is it calculated?
The header is free text with a loose convention, described on MDN. A desktop Chrome request sends something like Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36. A parser matches known patterns in it to name the browser, the operating system and the device type. Crawlers add their own token, such as Googlebot or GPTBot, usually with a link to their documentation.
The string is getting less detailed. Chrome has reduced the user agent to fixed values for the operating system version and the minor browser version, and moved the detail to separate client hints a site has to ask for. Because the string is sent by the client, anyone can fake it.
Example
A visit sends Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Mobile/15E148 Safari/604.1. The parser reads Safari on iOS, device type mobile. A second request sends Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.4; +https://openai.com/gptbot and is recognised as OpenAI’s crawler, not a visitor.
Common mistakes
- Trusting a bot’s user agent as proof. Anyone can send
Googlebot. Operators that publish IP ranges or reverse DNS let you verify the claim. - Reading exact operating system versions from Chrome. After the reduction, Windows and Android versions in the string are often frozen values.
- Storing raw user agents as a harmless field. Combined with an IP address, the string helps identify a person, so privacy laws can treat it as personal data.