User Agent Parser
Parse user agent strings to identify browser, operating system, device type, and rendering engine. Detect bots and crawlers.
What is a user agent string?
A user agent string is a text identifier that browsers and other HTTP clients send with every request. It tells the server what software is making the request, including the browser, operating system, and device.
A typical user agent looks like:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Why user agents are complex
User agents are notoriously messy due to decades of browser history. Most browsers claim to be “Mozilla” and “Safari” for compatibility, even when they’re neither.
Chrome’s user agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
It claims to be Mozilla, WebKit, Gecko, Chrome, AND Safari - all for historical compatibility reasons.
Parsing user agent components
Browser detection order matters - Check specific browsers before generic ones:
- Edge (contains “Chrome” too)
- Opera (contains “Chrome” too)
- Chrome
- Safari
- Firefox
Operating system patterns:
Windows NT 10.0= Windows 10 or 11Mac OS X= macOSLinux= LinuxAndroid= AndroidiPhone OS= iOS
Device type indicators:
Mobile= PhoneTablet= TabletTV= Smart TV
Detecting bots and crawlers
Major search engine bots identify themselves:
Googlebot/2.1 (+http://www.google.com/bot.html)
bingbot/2.0 (+http://www.bing.com/bingbot.htm)
Social media crawlers:
facebookexternalhit/1.1
Twitterbot/1.0
LinkedInBot/1.0
Command-line tools:
curl/7.68.0
wget/1.20.3
python-requests/2.25.1
User agent in different contexts
Server-side - For content negotiation, analytics, bot detection:
user_agent = request.headers.get('User-Agent')
if 'bot' in user_agent.lower():
serve_static_html()
Client-side - For feature detection (though feature detection is preferred):
// Not recommended - use feature detection instead
const isChrome = navigator.userAgent.includes('Chrome');
// Better approach
const hasTouch = 'ontouchstart' in window;
Client hints: the modern alternative
Client Hints provide structured device information without the messy user agent string:
Sec-CH-UA: "Chrome";v="120", "Chromium";v="120"
Sec-CH-UA-Mobile: ?0
Sec-CH-UA-Platform: "Windows"
Benefits:
- Structured, easy to parse
- Opt-in (privacy friendly)
- Reduces fingerprinting surface
Common user agent use cases
Analytics - Track browser and OS usage.
Content adaptation - Serve mobile-specific content.
Bot management - Allow/block specific crawlers.
Compatibility - Serve polyfills for older browsers.
A/B testing - Target specific browser versions.
How this tool works
This tool parses your browser’s user agent (or a custom string you provide) and extracts browser, OS, device, and engine information. It also detects bots and crawlers. Powered by a QuantCDN Edge Function.