What Is a User Agent? Definition & Examples
In this article
A user agent is a string of text that a web browser or other client software sends to a web server in an HTTP request, identifying itself and its capabilities. The server uses this information to tailor its response — for example, by sending a mobile-friendly version of a page to a phone or a different file format to a media player. The term also refers to the software itself (the browser, crawler, or app) that makes the request, but in everyday web development, "user agent" almost always means the identifying string.
Where the Term Comes From
The phrase "user agent" dates back to the early days of the internet, long before the web. In the 1980s, protocols like FTP and Gopher used client programs that acted on behalf of a human user. Those programs were called "user agents" because they were the agent (the intermediary) that the user sent to interact with a remote server. When the World Wide Web was created in the early 1990s, the first browsers — such as NCSA Mosaic and Lynx — adopted the same idea. The HTTP specification (RFC 1945, published in 1996) formalized the User-Agent header as a way for the client to identify itself. The term has been in continuous use since then, and it is standard in the technical vocabulary of web development.
What a User Agent String Looks Like
A typical user agent string contains several pieces of information, usually separated by spaces or parentheses. For example, a common Chrome browser on Windows might send:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
That string tells the server several things:
- Product and version: Chrome/120.0.0.0
- Operating system: Windows NT 10.0 (which corresponds to Windows 10)
- Rendering engine: AppleWebKit/537.36 and KHTML, like Gecko — a legacy of browser history
- Compatibility: Mozilla/5.0 and Safari/537.36 appear to satisfy old sites that expect those tokens
Mobile browsers add extra tokens like Mobile or iPhone. Bots and crawlers often have simpler strings, such as Googlebot/2.1 or curl/8.0. The exact format is not standardized — it is a convention that has evolved over time, so each browser family has its own style.
Why the Mozilla/5.0 Prefix Exists
One of the most confusing parts of a user agent is the leading Mozilla/5.0 even in browsers like Chrome and Edge that have no connection to Mozilla. The reason is historical. In the mid-1990s, Netscape Navigator (whose code name was Mozilla) was the dominant browser. Some websites would only send advanced frames-based pages to browsers that identified themselves as Mozilla. To avoid being blocked, other browsers began to include "Mozilla" in their user agent strings. This practice is called "user agent spoofing," and it became so widespread that even modern browsers still include it for compatibility with old sites that check for that token. The same logic explains the like Gecko and Safari tokens — they exist to satisfy sites that look for those specific identifiers.
How Servers Use User Agents
Web servers and websites use the user agent string for several practical purposes:
- Responsive design: Some sites serve different HTML or CSS to mobile devices based on the user agent, though modern responsive design usually uses viewport detection instead.
- Browser-specific features: A site might offer a download link for a plugin or a different video format depending on the browser.
- Bot detection: Search engines and social media crawlers identify themselves with a user agent, and sites can choose to allow or block them.
- Analytics: Web statistics tools use user agent data to report which browsers and operating systems visitors use.
- Access control: Some sites block known bad bots or older browsers that have known security issues.
However, user agent strings are not reliable for security or precise identification because they can be easily changed (spoofed) by the client. A determined user can set their browser to send any user agent they want.
How to View Your Own User Agent
You can see the user agent string that your browser sends by using a simple online tool or by checking your browser's developer console. In most desktop browsers, you can open the developer tools (usually by pressing F12), go to the Console tab, and type navigator.userAgent. That will print the string. Alternatively, you can visit a website that displays your user agent, such as a "what's my user agent" page. In the browser's settings, there is usually no direct way to see it, but the developer tools always expose it. On mobile browsers, you may need to use a third-party app or a web page that reads it.
Common Problems and Misconceptions
One common misconception is that the user agent is a reliable way to identify a user's browser or device. In reality, it is just a self-reported string that can be altered. For example, many privacy-focused browsers send a generic or randomized user agent to reduce tracking. Another misconception is that a user agent is a security feature — it is not; it is simply a declaration. A related problem is "user agent sniffing," where websites use the string to decide what content to serve. This can break when a new browser version appears or when a user changes their user agent. Modern web development favors feature detection (checking whether a browser supports a specific API) over user agent sniffing, because it is more robust. However, user agents remain essential for identifying bots and crawlers, since those typically do not spoof their identity.
How to Change Your User Agent
Changing your user agent is possible in most browsers, but the method differs. In Chrome, you can open Developer Tools, click the three-dot menu, select More tools, then Network conditions, and uncheck "Select automatically" to enter a custom string. In Firefox, you can use the Developer Tools' Responsive Design Mode or install an add-on. Edge has a similar built-in feature under Developer Tools. On mobile, you may need a third-party browser that supports user agent switching. Changing the user agent can be useful for testing how a site behaves on different devices, but it can also break sites that rely on it for layout or functionality. It is not a way to bypass paywalls or parental controls — those systems use other methods.
Frequently Asked Questions
Is a user agent the same as an IP address?
No. An IP address identifies the network location of the device making the request, while a user agent identifies the software (browser, app, or bot) that is making it. They are separate pieces of information sent in an HTTP request.
Can a user agent be used to track me?
Yes, but not alone. The user agent string is a fingerprinting signal that, when combined with other data like IP address, screen size, and installed fonts, can help identify a specific user. However, many browsers now add noise to their user agent or reduce the amount of detail it reveals to limit this.
Why do some websites block certain user agents?
Websites may block user agents that are known to be malicious bots, or that are outdated browsers with known security vulnerabilities. They might also block unknown bots to prevent scraping. Legitimate users with a normal browser rarely get blocked unless they have changed their user agent to something unusual.
What is the difference between a user agent and a browser?
A browser is the actual software you run (Chrome, Firefox, Safari). A user agent is the string that the browser sends to identify itself. The browser is the program; the user agent is part of the message it sends.
Do all HTTP requests include a user agent?
Most do, but it is not required by the HTTP specification. Some clients, like certain command-line tools or custom scripts, may omit it or send a generic one. Servers can still respond to requests without a user agent, but they may treat them differently.