User-Agent Parser: Decode Any Browser String
A User-Agent string crams browser identity, rendering engine, operating system, and device class into one dense, historically-cluttered line of text. This tool applies the same pattern-matching approach real UA-parsing libraries use — checking for the most specific tokens first (Edg, OPR, CriOS) before falling back to generic ones (Chrome, Safari) — to break a raw string down into readable fields.
Detection order matters: check the most specific browser token before the generic ones it's built on.
Why Detection Order Matters
Every Chromium-based browser's User-Agent contains 'Chrome/version' somewhere in the string, because they're all built on the same engine. A naive parser checking for 'Chrome' first would misidentify Edge, Opera, and Brave as plain Chrome. This parser checks distinguishing tokens (Edg/ for Edge, OPR/ for Opera, CriOS/ for Chrome on iOS) before falling back to the generic Chrome match.
Operating System Detection Quirks
iOS and iPadOS devices report 'like Mac OS X' in their platform string alongside a real iOS version number under a different key (CPU iPhone OS 17_4), using underscores instead of dots for historical reasons. Windows reports an internal NT kernel version (10.0 covers both Windows 10 and 11) rather than the marketing name, requiring a lookup table to translate NT version to a recognizable OS name.
The Limits of User-Agent Parsing
A User-Agent string is simply whatever the client chooses to send — there's no verification step, and any script or app can set it to anything. Treat parsed results as a best-effort hint for analytics, responsive-layout decisions, or debugging, never as a security control or a guarantee of the actual client software.
Practical Examples
Identifying a Mobile Safari Visitor
Parsing an iPhone User-Agent.
- 1.Paste the UA string
- 2.Result: Safari, WebKit engine, iOS, mobile device
Distinguishing Edge from Chrome
Both share the Chrome/version token.
- 1.Parser checks for Edg/ token first
- 2.Correctly reports Microsoft Edge, not Chrome
Fields Extracted
- Browser name and version
- Rendering engine (Blink, Gecko, WebKit, Trident)
- Operating system and version
- Device type: desktop, mobile, tablet, or bot
Good Use Cases
- Debugging analytics or log-parsing logic
- Testing responsive design detection code
- Understanding an unfamiliar UA string from support logs
- Learning how real UA-parsing libraries structure their pattern matching
Frequently Asked Questions
Why does Chrome's User-Agent string also mention Safari, KHTML, and Gecko?
Historical compatibility — browsers have added tokens from competing browsers' User-Agent formats over decades so that servers doing simple substring checks wouldn't accidentally exclude them. Chrome uses the Blink engine but its string still says 'like Gecko' and ends with 'Safari/537.36'.
How does the parser tell Chrome apart from Edge, Opera, and other Chromium browsers?
Chromium-based browsers add their own distinguishing token after the shared Chrome/version portion — Edge adds Edg/version, Opera adds OPR/version. This parser checks for those more specific tokens first, before falling back to a generic Chrome match.
Can a User-Agent string be spoofed or faked?
Yes, trivially — any client can send any User-Agent header it wants. Parsing gives you what the client claims to be, not a guaranteed fact; don't rely on it for security-sensitive decisions.
Why is device type sometimes ambiguous between mobile and tablet?
iPad's User-Agent string doesn't always include a clear tablet marker (especially in 'desktop-class' mode, where recent iPadOS versions report a Mac-like string), and Android tablets often include 'Mobile' inconsistently — device-type detection from UA string alone is inherently a heuristic, not a guarantee.
What's the difference between the rendering engine and the browser?
The rendering engine (Blink, Gecko, WebKit, Trident) is the underlying software that parses HTML/CSS and renders pages; the browser is the application built around it. Multiple browsers can share an engine — Chrome, Edge, Opera, and Brave all use Blink.
Is my data sent anywhere?
No, all parsing happens locally in your browser via regular expressions — no upload.