Sooner or later you meet one in the wild: an analytics row, a server log line or a bug report that identifies the visitor only as a long, cryptic string. It starts with Mozilla, mentions Safari even when the visitor swears they use Chrome, and hides the one fact you actually need near the end. A user agent string is not written to be read by humans, but it follows a pattern, and once you know the pattern you can read any of them.
This guide walks through one real-style string token by token and maps each part to what the User Agent Parser on Ovatly reports.
Contents
- Quick answer
- The example string, part by part
- Mozilla/5.0: the claim every browser makes
- The platform bracket: operating system and architecture
- AppleWebKit and the KHTML comment: engine heritage
- Chrome and Safari tokens: finding the real browser
- Why token order decides the answer
- How to parse a user agent string, step by step
- Worked example: a desktop Chrome string and an iPhone string
- Limitations
- Common mistakes
- FAQs
- Conclusion
Quick answer
A user agent string is read from the end backwards as much as from the start. The opening Mozilla/5.0 is a compatibility claim almost every browser makes. The bracketed section names the platform, such as Windows or an iPhone. The engine token, usually AppleWebKit, records rendering heritage rather than the current engine. The browser token that matters, such as Chrome/120.0.0.0, sits near the end, and the trailing Safari token is another heritage claim. Paste the string into the User Agent Parser and it reports the four facts worth knowing: browser and version, engine, operating system and device type.
The example string, part by part
Here is the string this guide uses, a typical desktop Chrome visit:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
It looks like one long name, but it is really five claims stacked together: compatibility, platform, engine, the browser itself, and one last heritage token.
Mozilla/5.0: the claim every browser makes
The string opens with Mozilla/5.0, and the visitor's browser is almost certainly not Mozilla in any modern sense. In the early web, servers served their best pages only to browsers whose strings began with Mozilla, so every competitor adopted the token to avoid being locked out. The habit never died. Today the token means only "this client wants the modern web", and a parser ignores it when deciding which browser sent the request. The first token in the string is the least informative.
The platform bracket: operating system and architecture
The bracketed section, (Windows NT 10.0; Win64; x64), describes the machine rather than the browser. Windows NT 10.0 is the operating system token, Win64 says the browser build is 64-bit, and x64 names the processor family. This is the part a parser turns into its operating system report.
One honest wrinkle matters here. The parser reports Windows NT 10.0 as Windows 10 / 11, because the string alone cannot distinguish the two; browsers froze that token deliberately. On a phone the bracket differs: an iPhone string carries the iOS version and a Mobile token, which is how the parser knows the device type is a phone.
AppleWebKit and the KHTML comment: engine heritage
Next comes AppleWebKit/537.36, followed by the comment (KHTML, like Gecko). WebKit is the engine Safari is built on, and Chrome's engine, Blink, began as a fork of WebKit, so Chrome still carries the WebKit token with a version number that stopped tracking anything meaningful years ago. The comment is older still: KHTML was the engine WebKit was forked from, and "like Gecko" reassures ancient sniffing code.
For the string above, the parser reports the engine as Blink, because the browser token identifies Chrome and Chrome's engine is Blink. The WebKit token is heritage, not a live description: several tokens describe where a browser came from, not what it is.
Chrome and Safari tokens: finding the real browser
Near the end sits Chrome/120.0.0.0, the token that names the actual browser and its version: Chrome, 120.0.0.0. After it comes Safari/537.36, which confuses everyone the first time. Chrome is not Safari. The token survives because Safari also descends from WebKit, and pages that once sniffed for Safari would reject a string without it. A well-built parser checks for Chrome before Safari so this trailing token does not win.
Edge and Opera rearrange the same trick: both are built on Chromium, so their strings contain the full Chrome token plus one of their own at the very end. Firefox is the exception: a Gecko token, a Firefox token, and no Safari claim.
Why token order decides the answer
Because so many strings contain each other's names, the order in which a parser tests tokens decides whether the answer is right. The parser on this page uses its own token rules rather than a third-party library, checking Edge, Opera, Samsung Internet, Chrome, Firefox, Safari, Internet Explorer and major bots. Edge and Opera are detected before Chrome, and Chrome before Safari, so a Chromium-based browser is never misreported as the browser it imitates. When nothing matches, the result shows as Unknown rather than a guessed match.
How to parse a user agent string, step by step
- Copy the full string from your log, analytics tool or bug report, without trimming it: the tokens near the end carry the answer.
- Open the User Agent Parser and paste the string in, or press the button to load your own browser's string instead.
- Read the breakdown: browser and version, engine, operating system and device type.
- Keep the honesty note in mind: a user agent is a claim the client makes, and it can be spoofed.
Worked example: a desktop Chrome string and an iPhone string
The desktop string above parses as: browser Chrome 120.0.0.0, engine Blink, operating system Windows 10 / 11, device Desktop. Every part of that answer maps to a token you have now read: Chrome and its version from the browser token, Blink from knowing what Chrome runs, Windows from the bracket (with the 10 / 11 hedge the frozen token forces), and Desktop from the absence of any mobile token.
Contrast an iPhone string, which carries Version/17.2 and Mobile in it. That one parses as Safari on iOS 17.2, device Mobile: the Version token supplies the browser version, the bracket supplies iOS, and Mobile settles the device type. No exact phone model, because iPhones identify only their family.
Limitations
A user agent is self-reported, and it is trivially faked: crawlers, privacy tools and curious users can send any string they like, which is why the parser also serves to check what a crawler claims to be. Modern browsers deliberately reduce the detail in their strings, so answers get less precise over time by design. The frozen Windows token means Windows 10 and 11 cannot be separated from the string alone, and exact device models appear only sometimes, mostly on Android.
Common mistakes
- Reading the trailing Safari token and reporting the visitor as a Safari user, when the Chrome token earlier in the string is the real browser.
- Treating
Windows NT 10.0as proof of Windows 10 specifically, when the same token serves Windows 11. - Using a user agent as identity evidence. It supports a bug report or an analytics segment; it proves nothing about who visited.
- Trimming the string before parsing it, which removes exactly the tokens that identify the browser.
- Expecting an exact handset model from an iPhone string. Apple does not put one there.
FAQs
Why does a Chrome string contain Safari and Mozilla? History. Every major browser claims Mozilla compatibility and includes WebKit heritage tokens so old server sniffing code keeps working. A parser has to check tokens in the right order: Edge and Opera before Chrome, and Chrome before Safari.
Why does Windows NT 10.0 show as Windows 10 / 11? Because the string alone cannot distinguish the two. Browsers froze the token at Windows NT 10.0 deliberately, so an honest parser reports the operating system as Windows 10 / 11 rather than guessing.
Can the parser tell me the exact phone model? Sometimes the model token is in the string, mostly on Android. iPhones and iPads only identify their family, and newer Android versions reduce this detail too.
Is my own user agent sent anywhere? No. Loading your browser's string and parsing it both happen locally on the page, so the string never leaves your machine.
Can a user agent string be trusted as proof of who visited? No. User agents are self-reported and trivially faked, and modern browsers reduce their detail on purpose. Use the result to understand a bug report or an analytics row, not to prove identity.
Conclusion
Read a user agent string as archaeology: the opening tokens are compatibility claims from the browser wars, the bracket describes the machine, and the browser token near the end is the one to trust. The User Agent Parser applies those rules in the right order and reports browser, engine, operating system and device type. When the same debugging session hands you a response code instead of a browser string, the companion guide explains the refusal codes servers send back: What Does a 403 Forbidden Error Mean and How Do You Fix It.
More tools for this kind of work live in the Developer Tools archive.