User Agent String

Developer API · Global · Browser/OS/Device detection · JSON output

TL;DR

UserAgentString.com provides a free API to parse user agent strings and extract browser name, version, operating system, device type, and more. Feed it any user agent string and it returns a structured breakdown of what browser, OS, and device the user is on. Useful for analytics, browser detection, and debugging user-reported issues.

Quick start: http://www.useragentstring.com/?uas=Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36&getJSON=all

No API key needed — just make a request!

How to Use This API

1. Parse a Browser User Agent

Detect browser, OS, and device from a Chrome-on-Windows UA string:

http://www.useragentstring.com/?uas=Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36&getJSON=all

The uas parameter is the raw user agent string. Set getJSON=all to return all available fields as JSON.

2. JavaScript — Detect Your Own Browser

Parse the current user's browser on the server side by sending the UA string:

const ua = navigator.userAgent;
const url = 'http://www.useragentstring.com/?uas=' +
  encodeURIComponent(ua) + '&getJSON=all';

fetch(url)
  .then(r => r.json())
  .then(data => {
    console.log('Browser:', data.browser_name || data.agent);
    console.log('OS:', data.os_name);
    console.log('Device:', data.device_type);
  });

3. Python — Analyze Multiple User Agents

import requests

user_agents = [
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0",
    "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 Mobile/15E148",
    "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 Chrome/120.0.6099.144 Mobile Safari/537.36"
]

for ua in user_agents:
    resp = requests.get(
        'http://www.useragentstring.com/',
        params={'uas': ua, 'getJSON': 'all'}
    )
    data = resp.json()
    browser = data.get('browser_name', 'Unknown')
    os_name = data.get('os_name', 'Unknown')
    print(f"{browser} on {os_name}")
Try parsing a Chrome UA: http://www.useragentstring.com/?uas=Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36&getJSON=all

Frequently Asked Questions

What does the JSON response include?
With getJSON=all, the response includes: browser name, version, OS name, OS version, device type (desktop/mobile/tablet), rendering engine, and the raw UA string. Each field may vary depending on how well the UA is recognized.
Does this work for mobile browser detection?
Yes, it handles iOS Safari, Chrome for Android, Samsung Internet, and other mobile browsers. It can distinguish between phones and tablets based on the UA string patterns.
Can I use this server-side for analytics?
Absolutely. Pass the user-agent header from incoming HTTP requests to this API to enrich your analytics with browser and OS breakdowns. Cache results by UA hash to avoid repeated calls.
Is there HTTPS support?
The API runs on HTTP at http://www.useragentstring.com. There is no HTTPS version documented. This is fine for server-to-server calls but be aware of mixed content warnings if calling from HTTPS pages.
How does it handle bot/crawler UAs?
It detects Googlebot, Bingbot, Slurp, and other common crawlers. The browser name will show the bot name and device type may show "Spider" or "Crawler".
Are there non-JSON output formats?
Yes. The API also supports plain text output with various getText parameters. You can request specific fields like getText=agent for just the browser name.

API Details

API URL
http://www.useragentstring.com/
Documentation
www.useragentstring.com
Category
Developer
Authentication
Not Required
Geographic Coverage
Global

What You Can Build