HandyTools Hub

User Agent Parser

Identify browser, OS, and device from any user agent string

Every browser request carries a user agent string, and the raw line is hard to read by eye. This parser breaks any UA string into labeled facts: browser name and version, operating system, device type, vendor, and rendering engine. Paste a string from a log or an error report, or press the button to analyze your own browser and see what websites learn about you. Parsing happens in the page, so the string is not sent anywhere.

Reading a User Agent String

A typical desktop string looks like this:

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

The parser reads it as Browser Chrome 120.0.0.0, OS Windows 10, Device desktop, Engine Blink. Much of the string is historical: the leading Mozilla and the trailing Safari token exist so old browser-sniffing code keeps working, and neither means the browser is actually Mozilla or Safari. The meaningful clues are the platform token in parentheses and the final product tokens that name the browser and its version.

A Short History of the Mozilla Token

The word Mozilla at the start of almost every user agent is a relic. Netscape’s browser was code-named Mozilla, and when other browsers arrived they copied the token so servers that assumed “Mozilla means modern browser” would not turn them away. Microsoft chose “Mozilla/4.0 (compatible; MSIE…)” to pass such checks, and Chrome later added both Mozilla and Safari for the same reason. The result is that the leading tokens carry no reliable information. Read the string from the platform in parentheses outward, and trust the last product token — the browser name and version — more than anything before it.

What Each Field Means

FieldWhat it reportsExample
BrowserBrowser or named crawler, plus versionChrome 120.0.0.0
OSOperating system and versionWindows 10
Devicedesktop, mobile, tablet, or botmobile
VendorHardware maker when detectableApple
EngineRendering engine nameWebKit

Windows NT versions are mapped to familiar names: 10.0 becomes 10, 6.3 becomes 8.1, 6.2 becomes 8, 6.1 becomes 7, 5.2 and 5.1 become XP, and 5.0 becomes 2000. The engine field reports the runtime that turns markup into pixels — Blink for Chromium-based browsers, WebKit for Safari, Gecko for Firefox, and Trident for old Internet Explorer.

Worked Examples

  1. The Chrome string above parses to Chrome 120.0.0.0, Windows 10, desktop, Blink, with vendor Unknown.
  2. Mozilla/5.0 (iPhone; CPU iPhone OS 17_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Mobile/15E148 Safari/604.1 parses to Safari 17.1, iOS 17.1, mobile, vendor Apple, engine WebKit.
  3. Mozilla/5.0 (Linux; Android 13; SM-X700) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 parses to Chrome 119.0.0.0, Android 13, tablet, vendor Samsung, engine Blink, because the Android string has no Mobile token.
  4. Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) parses to Googlebot 2.1, device bot, vendor Google, with OS and engine Unknown because no matching token is present.
  5. An Edge string such as Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0 is reported as Edge, not Chrome, even though it contains the Chrome token.

How Detection Order Works

Bots are checked before browsers, with patterns for Googlebot, Bingbot, Baiduspider, and YandexBot; a bot that also looks like Chrome is still reported as the bot. Browser patterns then run in this order: Edge, Opera, Internet Explorer, Chrome, Safari, Firefox. Order matters because an Edge string also contains Chrome and a Chrome string also contains Safari. Device classification runs bot, then tablet, then mobile, then desktop, so tablet markers win over the generic Android or Mobile tokens. OS patterns run iOS, Android, Windows Phone, Windows, macOS, Linux, then Chrome OS.

Limitations and Spoofing

The user agent is self-reported, so any client can claim to be any browser — bots routinely pretend to be Chrome, and privacy extensions change the string on purpose. The parser is regex-based with a fixed pattern list, so niche or brand-new browsers return Unknown, and the engine version is never extracted. Windows 11 reports Windows NT 10.0 and therefore appears as Windows 10. Desktop-class iPadOS appears as a Mac. Vendor detection covers common phone and tablet brands but leaves many desktops unidentified. Use the results for debugging, log analysis, and curiosity, and combine them with feature detection when a decision actually depends on browser capabilities.

Practical Uses

  • Reproduce a bug that was reported on a specific browser and OS combination.
  • Audit server logs to see which browsers and crawlers actually visit, and in what proportion.
  • Check what your own browser reveals to every website you load.
  • Sanity-check saved user agent strings before adding them to a test suite.
  • Confirm that a bot you expected is presenting the identity it claims.

Frequently Asked Questions

How does the parser tell Edge apart from Chrome?

Edge user agents contain the word Chrome as well as an Edg token. The parser checks its browser patterns in a fixed order and tests Edge first, so an Edge string is classified as Edge rather than falling through to Chrome.

Why is the engine version always shown as Unknown?

The parser identifies the rendering engine by name (Blink, WebKit, Gecko, or Trident) but does not extract an engine version number from the string, so that field stays Unknown by design.

How does it decide a device is a tablet rather than a phone?

It looks first for tablet markers such as iPad, Tablet, PlayBook, and Silk. It also treats an Android user agent that lacks the word Mobile as a tablet, because Android tablets typically omit that token while phones include it.

Why does an iPad running iPadOS 13 or later show up as a Mac?

Recent iPadOS versions request desktop-class websites by default, so Safari sends a Macintosh and Mac OS X user agent instead of an iPad token. The parser sees no tablet marker and classifies it as a desktop Mac. This is a limitation of user agent parsing, not a bug.

Why is the device vendor Unknown for my desktop browser?

Vendor detection focuses on mobile and tablet hardware. Desktop user agents usually do not name a manufacturer, so the vendor field reports Unknown while the OS and browser fields are still filled in.

Can I use the user agent to reliably block bots?

No. User agents are self-reported and trivially spoofed, and this parser recognizes only a small set of named crawlers. Treat the result as a hint for analysis, not as a security control, and pair it with behavioral or network-level signals.

Reviewed by the HandyTools Hub team · Last updated