DevOps
Toolin.io

How to Parse a User Agent String

4 min readDevOps

Every HTTP request includes a User-Agent header that identifies the client software, but these strings are notoriously long and cryptic. Parsing a user agent lets you extract the browser name, version, rendering engine, operating system, and device type from that dense string. This guide explains the format and shows how to decode any UA string instantly.

Quick Steps

  1. 1
    Open the User Agent Parser

    Go to the User Agent Parser in the DevOps category.

  2. 2
    View your browser's UA

    Your current browser's user agent string is automatically detected and parsed.

  3. 3
    Paste a different UA string

    Replace the auto-detected value with a user agent from your server logs or analytics.

  4. 4
    Read the parsed fields

    Review the browser, version, engine, OS, and device type extracted from the string.

User Agent Parser

Parse and explain browser User Agent strings

Open Tool

Anatomy of a User Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/124.0.0.0 Safari/537.36

Breakdown:
  Platform:  Macintosh (Intel Mac OS X 10.15.7)
  Engine:    AppleWebKit/537.36 (Blink)
  Browser:   Chrome 124.0.0.0
  Note:      "Safari/537.36" is a legacy compatibility token

Why User Agent Strings Are Confusing

For historical reasons, browsers include tokens from other browsers to ensure they receive content intended for those browsers. Chrome includes 'Safari' and 'Mozilla' tokens, Edge includes 'Chrome' tokens, and so on. This means you cannot simply search for a browser name in the string. A proper parser uses ordered pattern matching to identify the actual browser behind the compatibility tokens.

Using the User Agent Parser

1
Open the User Agent Parser

Navigate to the tool in the DevOps category. Your own browser's user agent is automatically detected and displayed.

2
Paste a custom user agent string

Replace the auto-detected string with any UA string you want to analyze, such as one from your server logs.

3
Read the parsed breakdown

The tool extracts and displays the browser name, version, rendering engine, OS name and version, and device type (desktop, mobile, tablet, bot).

4
Use the results

Apply the parsed data to debug browser-specific issues, filter analytics, or set up conditional logic in your application.

Common Use Cases

  • Debugging browser-specific rendering bugs by identifying the exact browser and version from logs
  • Filtering web analytics to separate bot traffic from real users
  • Detecting mobile vs. desktop visitors for responsive feature toggles
  • Auditing which browsers and OS versions your users actually run

Frequently Asked Questions

Why does every browser's user agent say 'Mozilla'?
In the early web, servers sent advanced content only to Mozilla (Netscape). Other browsers added 'Mozilla' to their user agent strings to avoid being served degraded pages. This legacy quirk persists in every major browser today.
Can I detect bots from the user agent?
Yes. Most well-behaved bots identify themselves in the user agent string (e.g. 'Googlebot', 'bingbot', 'facebookexternalhit'). The parser flags known bot signatures automatically. However, malicious bots may spoof legitimate browser user agents.
What is Client Hints and will it replace user agents?
Client Hints is a newer mechanism where the browser sends structured headers like Sec-CH-UA-Platform and Sec-CH-UA-Mobile instead of one long string. Major browsers are adopting it, but the traditional user agent header will remain for backward compatibility for years to come.

100% Private & Secure

This tool runs entirely in your browser. Your files and data never leave your device.

Related How-To Guides

Related Tools