Back to Utilities

User-Agent Parser

Parse any User-Agent string into browser, OS, engine, and device details.

Advertisement
Loading...

What this tool does

The User-Agent string is a header sent by every HTTP request that identifies the client software (browser, operating system, device). Parsing this string reveals the browser name and version, operating system, rendering engine, and device type (mobile, tablet, desktop). This tool extracts all these components from any User-Agent string.

Modern web development has moved beyond User-Agent parsing for many use cases. The Client Hints API (Sec-CH-UA-*) provides more accurate information with less parsing overhead, and feature detection (does the browser support this feature?) is preferred over browser detection (is this Chrome 90+?). However, User-Agent parsing remains useful for analytics, compatibility fallbacks, and identifying bots and crawlers.

Usage Example

// Example User-Agent string
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
//
// Parsed:
//   Browser:  Chrome 120.0
//   OS:       macOS 10.15 (Catalina)
//   Engine:   Blink (WebKit)
//   Device:   Desktop
//   Mobile:   No
//   Bot:      No

// Chrome on Android
// Mozilla/5.0 (Linux; Android 13; SM-S908B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36

Common Edge Cases

  • Bots and crawlers often have non-standard User-Agent strings that do not follow the browser convention. Maintain a separate list for bot detection.
  • Browsers can spoof their User-Agent string, so do not use it for security decisions. Treat the parsed information as advisory, not authoritative.
  • Frozen User-Agent strings (proposed by Google) reduce the granularity of browser version info, making future User-Agent parsing less useful.
  • New browsers and devices are released constantly; any User-Agent parser must be regularly updated with the latest patterns.
  • WebView-based browsers (in-app browsers in social media apps) often have very similar strings to the system browser, making them hard to distinguish.

FAQ

Is User-Agent parsing still relevant?
For most use cases, no. Feature detection (checking if a feature exists before using it) is more reliable. Use User-Agent parsing only for analytics, bot detection, or as a last-resort fallback for legacy compatibility.
Why does my iPad show as a desktop?
Modern iPadOS Safari identifies as macOS to avoid being served the mobile version of sites. This is by design from Apple. To detect iPad, check for touch support and the Safari engine in addition to the OS.
How do I detect bots reliably?
Combine User-Agent parsing with reverse DNS lookups (verify that the IP matches the claimed hostname), rate limiting, and CAPTCHA challenges. No single signal is sufficient, but multiple weak signals together are reliable.
Advertisement