All tools

User Agent Parser

Break down a browser user-agent string into browser, engine, OS, and device.

  • user agent
  • ua
  • browser
  • engine
  • os
  • device
  • detect
  • parse

About User Agent Parser

A user-agent string is the long, ugly identifier a browser sends in every HTTP request to identify itself — what browser, what version, what operating system, what device. The format is a forty-year history of vendors copying each other's identifiers to defeat sniffing, which is why every major browser still pretends to be "Mozilla/5.0" at the start. Parsing one means picking out the meaningful tokens with regular expressions tuned to each major browser family.

This parser identifies the browser (Chrome, Safari, Firefox, Edge, Opera, Samsung Internet, etc.), the rendering engine (Blink, WebKit, Gecko, EdgeHTML), the operating system (Windows, macOS, iOS, Android, Linux, Chrome OS) with version, and the device class (desktop, mobile, tablet, bot). It uses the same kind of regex-based detection most analytics tools use; results are heuristic, since UA strings are easy to spoof and Chrome is gradually replacing them with the Client Hints API.

How to use

Your own browser's user-agent is loaded by default. Paste any other UA string into the textarea to parse it — the breakdown updates live. Click "Use my browser" to reset to the current UA. The fields below show what the parser identified; "Raw" shows the original string for reference.

Common test inputs: paste a UA from your server's access logs to figure out which browser made the request, or copy a UA from a bot-detection block list to confirm it really is a bot before adding it to a deny rule.

Frequently asked questions

  • Why does every browser claim to be "Mozilla/5.0"?

    Historical accident. In the late 1990s, websites sniffed for "Mozilla" to decide whether to send the fancier HTML version of a page. Internet Explorer wanted those fancy pages, so it added "Mozilla/4.0" to its user-agent. Then Konqueror copied IE's string to get the IE pages, Safari copied Konqueror's for the same reason, and Chrome later copied Safari's. Today every major browser starts with "Mozilla/5.0" purely for backwards compatibility with that 25-year-old sniffing logic.

  • Why does Safari claim to use Gecko?

    For the same reason — Safari's engine is WebKit, but the user-agent string says "(KHTML, like Gecko)" so that pages sniffing for Gecko (Firefox's engine) would treat Safari as compatible. Chrome later copied Safari, so Chrome also claims to be "like Gecko" despite using Blink (a WebKit fork). The whole UA string is a museum of compatibility hacks.

  • Can user-agent strings be spoofed?

    Trivially. Every browser can set the User-Agent header to whatever you want, either through extensions, devtools, or command-line flags. Curl, wget, and every HTTP client library let you set it. So UA-based detection is unreliable for security (bots can pretend to be Chrome) but reasonable for analytics and feature detection where users have no incentive to lie.

  • What's replacing user-agent strings?

    User-Agent Client Hints — a structured set of HTTP headers (Sec-CH-UA, Sec-CH-UA-Platform, Sec-CH-UA-Mobile, etc.) that the browser sends only when the server explicitly asks for them. Chrome is gradually freezing the legacy User-Agent string to a minimal value and steering developers toward Client Hints; the transition has been slow and the legacy UA isn't going away soon.

  • How does the parser detect mobile vs desktop?

    Mostly by looking for tokens like "Mobile", "iPhone", "iPad", "Android", and "Tablet". Tablets are distinguished by "iPad" or by "Android" without "Mobile" (Android phones include both, Android tablets only the former). Some user-agents are deliberately ambiguous — iPadOS Safari now identifies as desktop Safari by default, which is why iPads sometimes show up as desktop devices here.

More Web & Dev tools