User-Agent-Parser
Parsen Sie User-Agent-Strings um Browser, OS und Gerätetyp zu identifizieren
Parsing User-Agent Strings to Identify Browsers, OS, and Devices
The User-Agent HTTP header identifies the client making a request — but its format is a historical accumulation of compatibility hacks rather than a clean specification. Modern user-agent strings contain nested browser identifiers, rendering engine versions, platform tokens, and mobile indicators packed into a single string that is difficult to parse manually. The User-Agent Parser analyzes any UA string to extract browser name and version, operating system, device type (desktop, mobile, tablet, bot), and rendering engine using pattern matching against known token formats.
Paste any user-agent string to instantly see its components broken down: which browser and version, which OS and version, whether it is a mobile or desktop device, which rendering engine powers it, and whether it is a known bot or crawler. This is essential for debugging browser-specific issues, analyzing access logs, filtering bot traffic, and understanding your audience's technology profile. All parsing happens client-side using regex patterns.
Browser and Version Detection
The parser identifies browsers across all major engines and platforms:
- Chromium-based: Chrome, Edge, Brave, Opera, Vivaldi, Samsung Internet — all share the Chrome version token but have distinct identifiers
- Firefox-based: Firefox, Firefox Focus, Tor Browser — identified by the Gecko engine and Firefox token
- Safari/WebKit: Safari on macOS and iOS, Chrome on iOS (uses WebKit underneath)
- Legacy browsers: Internet Explorer, Edge Legacy (EdgeHTML), Opera Presto
Version extraction handles the varying formats across browsers — Chrome uses simple "Chrome/120.0" while Safari uses "Version/17.0" alongside an AppleWebKit version that is not the browser version.
Device and OS Classification
Operating system and device type detection enables platform-specific debugging:
- Desktop OS: Windows (with version mapping — "NT 10.0" = Windows 10/11), macOS (version extraction), Linux distributions, ChromeOS
- Mobile OS: iOS (iPhone/iPad distinction), Android (version and device model), Windows Phone
- Device type: Desktop, Mobile, Tablet — determined by platform tokens and mobile indicators
- Architecture: x64, ARM, ARM64 when present in the UA string
Bot and Crawler Identification
Distinguishing bots from real users is essential for analytics and access control:
- Search engine bots: Googlebot, Bingbot, Yandex, Baidu Spider, DuckDuckBot
- Social media crawlers: FacebookExternalHit, TwitterBot, LinkedInBot
- Monitoring tools: Pingdom, UptimeRobot, GTmetrix, PageSpeed Insights
- Library defaults: Python-requests, axios, curl, wget — often indicate API clients or scrapers
Bot detection helps separate real user traffic from automated requests in analytics, implement bot-specific responses (pre-rendered pages for SEO bots), and identify potential scraping or abuse patterns. The parser also detects spoofed bot user-agents by checking for inconsistencies in the token ordering and version numbers that real crawlers use, helping identify impersonation attempts that claim to be Googlebot but lack the correct token structure.
Understanding bot traffic composition helps infrastructure teams plan capacity correctly — a site receiving 60% bot traffic may appear to have double the actual user load if bots are not filtered from request metrics.
Code Examples
User-Agent Parse Results
# Input:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1
# Parsed result:
# Browser: Safari 17.0
# Engine: WebKit 605.1.15
# OS: iOS 17.0
# Device: Mobile (iPhone)
# Type: Real user (not a bot)
# Another example:
# Input: Googlebot/2.1 (+http://www.google.com/bot.html)
# Browser: Googlebot 2.1
# Engine: Unknown
# OS: Unknown
# Device: Bot
# Type: Search engine crawler (Google) Häufig Gestellte Fragen
What information can be extracted from a user agent string?
The parser extracts the browser name and version, operating system and version, device type (desktop, mobile, tablet), and rendering engine. It identifies major browsers including Chrome, Firefox, Safari, Edge, and Opera, as well as mobile browsers.
How accurate is user agent detection?
User agent strings follow conventions but are not standardized, so detection relies on known patterns. The parser handles common spoofing patterns (like Chrome-based browsers identifying as Safari/Chrome) and provides the most specific identification possible from the string.
Can it detect bots and crawlers?
Yes. The parser identifies common bots and crawlers (Googlebot, Bingbot, etc.) by matching known bot signatures in the user agent string. Bot detection is useful for analytics filtering and understanding which crawlers access your site.