What is a User Agent String?
The history, anatomy, and future of the string that tells servers who is visiting.
Definition
A user agent (UA) string is a text identifier sent by HTTP clients (browsers, crawlers, apps) in the User-Agent header of every request. It tells the server what software is making the request, including the browser name and version, operating system, device type, and rendering engine.
A typical modern Chrome user agent string looks like this:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36This single string contains references to Mozilla, AppleWebKit, KHTML, Gecko, Chrome, and Safari - even though it is a Chrome browser on Windows. This apparent chaos has historical reasons.
Why the String is So Complex
The complexity of user agent strings is a direct result of the browser wars of the 1990s and 2000s. Each new browser had to pretend to be its competitors to avoid being blocked by poorly written server-side UA detection code.
The Historical Chain
- NCSA Mosaic (1993): Set the
User-Agent: NCSA_Mosaic/2.0header. Servers began sending different content based on this string. - Netscape Navigator (1994): Named its engine "Mozilla" (Mosaic Killer). Servers checked for "Mozilla" to send advanced features. The string format became
Mozilla/version. - Internet Explorer (1995): Wanted to receive the same content as Netscape, so it claimed to be
Mozilla/4.0 (compatible; MSIE 6.0). - Firefox (2004): Used the Gecko engine. Added
Gecko/dateto signal its renderer. Servers started checking for "Gecko". - Safari (2003): Used WebKit (forked from KHTML). Added
KHTML, like Geckoso Gecko-targeting sites would work, plusSafari/version. - Chrome (2008): Forked WebKit into Blink. Added
Chrome/versionbut kept all the Safari, WebKit, and Gecko mentions for compatibility. - Edge (2019): Switched to Chromium. Added
Edg/versionto Chrome's full string.
The result: every browser claims to be every other browser, making the string almost useless without careful parsing.
Anatomy of a UA String
Despite the chaos, UA strings follow a loose structure. Here is Chrome 120 on Windows, broken down:
| Component | Value | Meaning |
|---|---|---|
| Platform | Mozilla/5.0 | Legacy compatibility token |
| OS Info | (Windows NT 10.0; Win64; x64) | Operating system and architecture |
| Engine | AppleWebKit/537.36 | Rendering engine (frozen version) |
| Compat | (KHTML, like Gecko) | Legacy compatibility claim |
| Browser | Chrome/120.0.0.0 | Actual browser and version |
| Compat | Safari/537.36 | Legacy Safari compatibility |
Common Use Cases
Analytics and Reporting
Web analytics platforms parse UA strings to generate browser, OS, and device reports. While not perfectly accurate (UA strings can be spoofed), they provide useful aggregate data about a site's audience.
Responsive Content Delivery
Servers sometimes use UA detection to serve different assets (e.g., WebP images to supporting browsers, mobile-optimized pages to phones). However, feature detection in JavaScript is generally preferred over UA sniffing for this purpose.
Bot and Crawler Detection
Search engine crawlers, monitoring services, and automated tools typically identify themselves in their UA strings. Googlebot, Bingbot, and other legitimate crawlers use recognizable patterns. Learn more in our guide on bot detection.
Debugging and Troubleshooting
When users report rendering issues, their UA string reveals the exact browser, version, and OS, helping developers reproduce the problem.
The Future: Client Hints
Modern browsers are freezing the UA string (reducing its specificity) and replacing it with Client Hints - structured HTTP headers that provide specific information on request. Instead of parsing a complex string, servers request exactly the data they need. Learn more in our guide on Client Hints.
Try It Yourself
Paste any user agent string into our User Agent Parser to instantly identify the browser, OS, device, and rendering engine. The tool also detects bots and shows Client Hints for your current browser.
Further Reading
- User-Agent — MDN
MDN reference for the User-Agent HTTP header.
- History of the User-Agent String — WebAIM
The classic retelling of how UA strings became so complex.
- User-Agent Client Hints — web.dev
Guide to the modern replacement for user agent strings.