What is User Agent?

A user agent is a string a browser or bot sends identifying its software, version, and platform so servers can tailor responses.

A user agent is the software that acts on a user's behalf to access the web - most commonly a browser, but also search engine crawlers, API clients, and scripts. With every HTTP request, the user agent sends a User-Agent header: a text string that identifies the client's name, version, rendering engine, and operating system. Servers read this string to decide how to respond.

A typical browser user-agent string is a dense, historically messy line packed with tokens like Mozilla/5.0, the platform, and the browser engine and version. This clutter exists for backward-compatibility reasons dating back decades. Parsing it reliably requires care, which is why dedicated user-agent parsers exist to extract the browser, version, device type, and OS cleanly.

User agents matter for analytics, compatibility, and security. Analytics platforms parse them to report which browsers and devices your audience uses. Servers may serve different content or assets based on the client. Search engine bots identify themselves - Googlebot, Bingbot - with distinctive user agents, letting sites verify and manage crawler access through robots.txt rules.

It is important to remember that the user-agent string is self-reported and easily spoofed. Bots and scrapers routinely impersonate real browsers to avoid detection, so the header alone is not a trustworthy security control. For crawler verification, combine the user agent with reverse DNS checks. For feature decisions, modern development favors feature detection over user-agent sniffing.

Examples

  • Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/120.0 - desktop Chrome
  • Googlebot/2.1 (+http://www.google.com/bot.html) - Google's crawler
  • A custom API client: MyApp/1.4 (support@example.com)

Common questions

Can a user agent be faked?
Yes, trivially. The User-Agent header is set by the client and can be changed to any value, so it should never be trusted as a security measure. Bots frequently impersonate real browsers.
Why are browser user-agent strings so complicated?
Decades of backward-compatibility hacks. Browsers included tokens like 'Mozilla' to pass old server checks, and the strings accumulated cruft over time. That is why a parser is the reliable way to extract meaningful data.
How do search engines use user agents?
Crawlers identify themselves with specific user-agent strings like Googlebot. Sites can target rules to these agents in robots.txt, and can verify legitimacy with reverse DNS since the string alone can be spoofed.

Related tools

Related terms for User Agent