Your analytics say Safari is your most popular browser, yet every support ticket mentions Chrome. A feature you switched on for one browser appears in another. A version check that worked last year now matches nothing. These are the classic symptoms of user agent sniffing done naively. The string looks like a plain label, but it is really a layered historical document, and reading it in the wrong order produces confident, wrong answers. This guide covers the mistakes behind those wrong answers, and how to read a string properly with the free User Agent Parser on Ovatly.

Contents

  • Quick answer
  • A string full of other browsers' names
  • Mistake one: matching the first familiar token
  • Mistake two: trusting frozen and reduced details
  • Mistake three: deciding features from the string
  • Mistake four: treating the string as proof
  • How to parse a user agent, step by step
  • Worked example: the desktop Chrome string
  • Limitations
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

User agent sniffing goes wrong for three reasons. First, the tokens mislead by design: every major browser claims Mozilla compatibility, and Chrome's string also contains a Safari token, so matching the first name you recognise misidentifies the browser. Second, the details are frozen or reduced on purpose: Windows NT 10.0 covers both Windows 10 and Windows 11, and version numbers are trimmed. Third, the string is self-reported and can be spoofed in seconds. Parse a string with ordered token rules when you need context, and use feature detection, not the string, to decide what a browser can do.

A string full of other browsers' names

A user agent is a line of text a browser or crawler sends with each request, naming itself through a set of tokens. The problem is that the tokens accumulated over decades of compatibility battles. Browsers added the names of other browsers to their strings so that servers which sniffed for a particular name would serve them the good version of a site. The result is that one modern string names several browsers and engines, only one of which is the real sender. The User Agent Parser exists because of this: it breaks a string into browser, engine, operating system and device type using well-known tokens, checked in an order that respects this history.

Mistake one: matching the first familiar token

The most common sniffing bug is a chain of substring checks in the wrong order. A Chrome string contains the token Safari/537.36, so code that tests for Safari before Chrome labels every Chrome visitor as a Safari visitor. An Edge or Opera string contains a Chrome token as well, so those browsers get counted as Chrome. The parser on this page avoids the trap by checking tokens in the right order: Edge and Opera are detected before Chrome, and Chrome before Safari. Any sniffing code you write needs the same discipline, from the most specific token to the least, or its answers will be systematically wrong rather than occasionally wrong.

Mistake two: trusting frozen and reduced details

Even read in the right order, the details in a string are vaguer than they look. Browsers froze some tokens deliberately: Windows NT 10.0 is reported as Windows 10 / 11 because the user agent alone cannot distinguish the two, and the token will not change to settle the question. Version numbers are reduced too. In the parser's own example, Chrome appears as Chrome/120.0.0.0, with the later version parts zeroed out, so code that depends on an exact build number depends on digits that were never promised. Device detail is shrinking the same way: the exact phone model token appears mostly on Android, iPhones and iPads identify only their family, and newer Android versions reduce this detail further.

Mistake three: deciding features from the string

The deepest mistake is using the string to decide what a browser can do: which features to enable, which code path to serve, which polyfill to load. A browser name and version is a poor proxy for capability. The same name covers different engines and platforms, capabilities change between versions in ways no table tracks perfectly, and a genuinely new browser matches nothing in your rules at all. Feature detection asks the browser directly whether it supports the thing you want to use, and it keeps working for browsers that did not exist when you wrote the code. Keep the user agent for context: analytics, support, debugging. Keep it away from capability decisions.

Mistake four: treating the string as proof

A user agent is a claim the client makes about itself, and claims can be invented. Anyone can set any string in a browser setting, a script or a bot, which is why the parser carries an honesty note: user agents are self-reported and trivially faked. That matters when the string feeds a decision with stakes, such as trusting that a visitor really is a search engine crawler. The parser is also honest about the opposite case: an unknown or future browser shows as Unknown rather than being guessed into a wrong match. A good indication is the ceiling of what any user agent can offer, never proof.

How to parse a user agent, step by step

  1. Open the User Agent Parser and paste the string you want to read. To inspect your own browser instead, press the button that loads its string.
  2. Read the breakdown: browser and version, engine, operating system and device type.
  3. Apply the honesty note before you act on the result: the string is a claim the client made, and it can be spoofed. Parsing happens locally on the page; nothing is sent anywhere.

Worked example: the desktop Chrome string

Take the tool's own worked example:

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

Read naively, this string is Mozilla, WebKit, Gecko and Safari at once. Parsed with ordered token rules, it resolves to one answer: browser Chrome 120.0.0.0, engine Blink, operating system Windows 10 / 11, device Desktop. Each mistake from this guide shows up in this one line: the Mozilla claim at the front, the Safari token near the end, the frozen platform, the zeroed version parts. The tool's second example is the mobile counterpart: an iPhone string carrying Version/17.2 and a Mobile token parses as Safari on iOS 17.2, device Mobile.

Limitations

The parser uses this page's own token rules, covering Edge, Opera, Samsung Internet, Chrome, Firefox, Safari, Internet Explorer and major bots, rather than a third-party library, so an unusual client can come back as Unknown. The limits of the string itself apply no matter how good the parsing is: frozen tokens cannot be unfrozen, reduced versions cannot be expanded, and a spoofed string parses exactly as confidently as an honest one. Parsing tells you what a string says, in the right order. It cannot tell you whether the claim was true.

Common mistakes

  • Testing for Safari before Chrome. Chrome's string contains a Safari token, so check order decides the answer.
  • Testing for Chrome before Edge or Opera. Both carry a Chrome token and get counted as Chrome.
  • Reading the Mozilla token as the browser. Every major browser claims Mozilla compatibility; it identifies nothing.
  • Trusting the version digits. Frozen platform tokens and reduced versions make precise version logic unreliable.
  • Gating features on the string. Use feature detection for capability; keep the string for context.
  • Treating a parsed result as identity. The string is self-reported and spoofable, an indication, never proof.

FAQs

Why does every user agent string start with Mozilla/5.0? History. Every major browser claims Mozilla compatibility so that old server sniffing code keeps working. The Mozilla token at the front of a string tells you almost nothing about which browser actually sent it.

Why does a Chrome user agent mention Safari? Chrome's string includes WebKit heritage tokens, including Safari, left over from its engine ancestry. A parser has to check tokens in the right order: Edge and Opera are detected before Chrome, and Chrome before Safari.

Can a user agent tell Windows 10 from Windows 11? No. Browsers froze the platform token at Windows NT 10.0 deliberately, so the string alone cannot distinguish Windows 10 from Windows 11. A careful parser reports the operating system as Windows 10 / 11.

Can I trust a user agent to identify a visitor or a bot? Not as proof. User agents are self-reported and trivially faked, and anyone can send a string that claims to be a browser or a crawler. Treat a parsed result as a good indication, never as evidence.

What should I use instead of UA sniffing to decide what a browser supports? Feature detection: test for the capability itself in your code. Browsers with the same name differ by version and platform, and new browsers appear that no sniffing table knows, so the string is the wrong tool for capability decisions.

Conclusion

User agent strings are historical documents, not name tags: they claim other browsers' names, freeze their own details and can be rewritten by anyone. Read them in token order when you need context, expect vagueness where browsers reduced the detail, and never let the string decide features or identity. When a bug report lands with a string attached, the companion guide on debugging a mobile layout bug using the user agent turns it into a concrete test environment. More tools for this kind of work are collected in the Developer Tools guide category.