How User Agent Parser works
A user agent string is the line of text a browser or bot sends in the User-Agent header of every request. This parser reads one and reports six things: Browser, Version, Engine, Operating system, OS version and Device type. It recognises Chrome, Edge, Firefox, Safari, Opera, Samsung Internet, Vivaldi and older Internet Explorer, on Windows, macOS, iOS, Android, Chrome OS and Linux, and it flags common crawlers. Tokens are checked from most specific to least, because an Edge string also contains Chrome and Safari. It is a compact rule-based parser, not a device database, so it does not name phone models, and unusual clients come back as Unknown.
User agent string examples and what they parse to
Each row is the result this tool gives for a common string. Strings are shortened here to the part that differs; all begin with Mozilla/5.0.
| Tokens in the string | Browser and version | Engine | OS and version | Device type |
|---|---|---|---|---|
| (Windows NT 10.0; Win64; x64) ... Chrome/126.0.0.0 Safari/537.36 | Chrome 126.0.0.0 | Blink | Windows 10 or 11 | Desktop |
| (Windows NT 10.0; Win64; x64) ... Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0 | Edge 126.0.0.0 | Blink | Windows 10 or 11 | Desktop |
| (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0 | Firefox 127.0 | Gecko | Windows 10 or 11 | Desktop |
| (Macintosh; Intel Mac OS X 10_15_7) ... Version/17.5 Safari/605.1.15 | Safari 17.5 | WebKit | macOS 10.15.7 | Desktop |
| (iPhone; CPU iPhone OS 17_5 like Mac OS X) ... Version/17.5 Mobile/15E148 Safari/604.1 | Safari 17.5 | WebKit | iOS 17.5 | Mobile |
| (iPad; CPU OS 17_5 like Mac OS X) ... Version/17.5 Mobile/15E148 Safari/604.1 | Safari 17.5 | WebKit | iOS 17.5 | Tablet |
| (iPhone; CPU iPhone OS 17_5 like Mac OS X) ... CriOS/126.0.6478.153 Mobile/15E148 Safari/604.1 | Chrome 126.0.6478.153 | WebKit | iOS 17.5 | Mobile |
| (Linux; Android 14; Pixel 8) ... Chrome/126.0.0.0 Mobile Safari/537.36 | Chrome 126.0.0.0 | Blink | Android 14 | Mobile |
| (Linux; Android 14; SM-S918B) ... SamsungBrowser/25.0 Chrome/121.0.0.0 Mobile Safari/537.36 | Samsung Internet 25.0 | Blink | Android 14 | Mobile |
| (Linux; Android 13; SM-X710) ... Chrome/126.0.0.0 Safari/537.36 | Chrome 126.0.0.0 | Blink | Android 13 | Tablet |
| (X11; CrOS x86_64 14541.0.0) ... Chrome/126.0.0.0 Safari/537.36 | Chrome 126.0.0.0 | Blink | Chrome OS 14541.0.0 | Desktop |
| (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0 | Firefox 127.0 | Gecko | Linux, no version | Desktop |
| (compatible; Googlebot/2.1; +http://www.google.com/bot.html) | Unknown | Unknown | Unknown | Bot or crawler |
An Android string without the word Mobile is classed as a tablet, which is the convention Chrome follows on Android.
Browser tokens, in the order they are checked
The first match wins, which is how an Edge string is kept from being reported as Chrome or Safari.
| Order | Token looked for | Reported as |
|---|---|---|
| 1 | Edg/, Edge/, EdgA/ or EdgiOS/ | Edge |
| 2 | OPR/ or Opera/ | Opera |
| 3 | SamsungBrowser/ | Samsung Internet |
| 4 | Vivaldi/ | Vivaldi |
| 5 | Firefox/ or FxiOS/ | Firefox |
| 6 | Chrome/ or CriOS/ | Chrome |
| 7 | Version/ followed later by Safari | Safari |
| 8 | MSIE or rv: followed later by Trident | Internet Explorer |
Chromium browsers that add no token of their own, such as Brave, send the same string as Chrome and are reported as Chrome by any parser.
Windows NT version numbers in user agents
| Token | Windows release shown |
|---|---|
| Windows NT 10.0 | 10 or 11 |
| Windows NT 6.3 | 8.1 |
| Windows NT 6.2 | 8 |
| Windows NT 6.1 | 7 |
| Windows NT 6.0 | Vista |
| Windows NT 5.1 | XP |
Any other number is shown as written.
Why a parsed user agent can be wrong or vague
- Chrome and other Chromium browsers now send a reduced string: the version is cut to the major number (126.0.0.0), Android phones report Android 10 and the model K, and the desktop platform text is fixed.
- Safari and Chrome on a Mac report Mac OS X 10_15_7 whatever the real macOS version is, so 10.15.7 does not mean the machine runs Catalina.
- Safari on an iPad asks for desktop sites by default and sends a Macintosh string, so it is parsed as macOS on a desktop.
- Chrome and Firefox on iOS are built on Apple's WebKit, which is why a CriOS or FxiOS string shows the WebKit engine and not Blink or Gecko.
- Crawlers are flagged when the string contains bot, crawl, spider, slurp or a few known names such as GPTBot, ClaudeBot and facebookexternalhit. Command-line clients such as curl/8.6.0 match none of these and fall through to Unknown browser with the default device type Desktop.
- Internet Explorer 11 dropped the MSIE token. Its string is reported with the Trident engine and the right Windows version, but the browser name comes back as Unknown.
- The original Edge (versions 12 to 18, token Edge/) ran on Microsoft's EdgeHTML engine, but its string also contains Chrome/, so the Engine value reads Blink.
- Firefox on a Mac writes the version with dots (Mac OS X 10.15), and only the part before the first dot is picked up, so the OS version shows 10.
Use the result for diagnosis, not for feature decisions
A parsed user agent is useful when you are describing traffic: working out which browser a bug report came from, separating crawlers from visitors in a log, or checking why a server rule matched.
It is a poor basis for deciding what code to run. The string can be changed by the client, the detail in it is being reduced on purpose, and any list of browser rules goes out of date as new versions ship. To decide whether to use an API, test for the API itself in JavaScript, or use @supports in CSS.
Chromium browsers also offer User-Agent Client Hints: separate Sec-CH-UA request headers and the navigator.userAgentData object, which give the brand, platform and mobile flag as structured values. This tool reads only the classic string.
How to use it
- 1
Copy a user agent from a server log, an analytics export or a bug report.
- 2
Paste it into User agent string, replacing the sample Chrome on macOS string.
- 3
Read Browser, Version and Engine in the Parsed panel.
- 4
Check Operating system, OS version and Device type (Desktop, Mobile, Tablet, or Bot or crawler).
- 5
If a value shows Unknown, look at the reference tables below to see which tokens the parser recognises.