User Agent Strings Explained
Decode the confusing text your browser sends to websites, see how much it can be trusted and learn what is replacing it.
Key takeaways
- The
User-Agentheader is a self-description sent by the client with each request. - Old compatibility habits explain why a single string can mention Mozilla, AppleWebKit, Chrome and Safari together.
- Anyone can send any value, so it must not be used for security decisions.
- Several browsers now freeze or reduce parts of the string to limit fingerprinting.
- Developers should detect features in the page instead of guessing abilities from the browser name.
A user agent string is a line of text that a browser or other client sends with its requests to say what it is. It travels in the User-Agent HTTP header and typically names the browser, its version, the rendering engine and the operating system.
It's also famously confusing: most browsers claim to be several other browsers at once. It can be changed to say anything, and browser makers have been reducing the detail in it. Use it as a rough hint, never as proof.
What one looks like
Here is a typical shape for a Chromium-based browser on Windows, with an example version number:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 The format is a series of product tokens written as name/version, with comments in parentheses. The HTTP specification (RFC 9110) defines that general syntax but not what browsers put in it.
Why every browser claims to be Mozilla
In the early web, some sites checked the string and sent richer pages only to Netscape's browser, whose code name was Mozilla. Competing browsers added "Mozilla" to their own strings so they would receive the good version.
The pattern repeated. A newer engine would mention an older one it was compatible with. KHTML said it was like Gecko, Apple's WebKit grew out of KHTML and kept the phrase, and Chrome was built on WebKit and kept Safari's tokens. Browsers based on Chromium then append their own name, such as Edg/ for Microsoft Edge or OPR/ for Opera.
So order matters when reading one. A string containing Safari may be Safari, Chrome or something else. Parsers check for the most specific token first. The background on browser engines explains the family tree.
Firefox strings are shorter and use Gecko and rv: tokens. Mobile browsers usually include words such as Mobile, Android or iPhone. On iPhone and iPad, browsers from different companies have commonly been built on Apple's WebKit, with rules that have been changing in some regions.
What it doesn't reliably tell you
Several things make the string a poor source of fact.
Frozen values. To reduce tracking, browsers may report a fixed operating system version or a generic device model. The example above says Windows NT 10.0 for Windows 11 too. macOS version numbers are similarly capped in several browsers.
Desktop modes. Tablets often present themselves as desktop computers. iPad Safari commonly sends a Mac-like string.
Deliberate changes. Developer tools, extensions and settings such as "request desktop site" alter it.
Impersonation. Scripts and bots can copy a mainstream browser's string exactly.
In-app browsers. Pages opened inside other apps add their own tokens, or none you recognize.
Bots and other clients
Not every user agent is a browser. Command line tools identify themselves, for example curl/ followed by a version. Programming libraries, feed readers, uptime monitors and search crawlers do too.
Well-behaved crawlers use a recognizable name and a link describing them, and honor robots.txt rules addressed to that name. Since the name is easy to fake, major search engines publish ways to verify their crawlers, usually by reverse and forward DNS lookups or published IP ranges. See how web crawlers work and how sites spot automation.
If you write a script that calls other people's services, send an honest, descriptive user agent with a way to contact you where appropriate. It's part of being a polite client.
Where the string gets used
Despite its flaws, the header still does ordinary work.
Analytics group visits by browser family, operating system and device type. These figures help you decide what to test, as long as you read them as estimates.
Troubleshooting gets easier when an error report includes the string. If a bug appears only in one engine or one in-app browser, the logs often show the pattern.
Download pages use it to suggest the right installer. A good page treats this as a default and lists every option, because the guess can be wrong about processor architecture in particular.
Operations teams filter noisy clients, apply rate limits by declared tool name or serve a static page to a misbehaving script. This works against honest software and barely slows anyone who is trying to hide.
Compatibility fixes sometimes target a specific old version with a known defect. Record why each such rule exists and review it periodically. Rules written for one old browser have a habit of catching new ones whose strings happen to match, for instance when a version number gains a digit.
Client Hints
User-Agent Client Hints are a newer approach, implemented mainly in Chromium-based browsers. Instead of broadcasting everything, the browser sends a small set of headers by default, such as Sec-CH-UA, Sec-CH-UA-Mobile and Sec-CH-UA-Platform.
A server that needs more, such as the full version or the device model, asks with an Accept-CH response header, and the browser decides whether to provide it on later requests. Scripts have a matching interface, navigator.userAgentData, available over secure connections.
Support isn't universal. Firefox and Safari have not adopted it in the same way, so code can't depend on it everywhere. If your server's response varies by any of these headers, list them in the Vary header so caches don't serve the wrong version, as discussed in content negotiation.
What developers should do instead
Detect features. Ask the browser whether it can do the thing:
if ("share" in navigator) {
// show the Share button
} In CSS, @supports does the same for properties.
Design responsively. Screen width, pointer type and user preferences are available through media queries. They answer layout questions far better than "is this a phone?". See responsive design.
Parse with care. If you must read the string, for analytics or to work around a specific bug, use a maintained parsing library, handle unknown values gracefully and don't block visitors you don't recognize. A message saying "your browser is not supported" based on a name check often turns away browsers that would work fine.
Treat it as untrusted input. It's text from a stranger. Escape it before showing it in an admin page or log viewer, and parameterize it if you store it.
See and test your own
In your browser, open the developer tools console and type:
navigator.userAgent Or load a user agent parser or request header echo to see what arrives at a server.
To send a chosen value while testing your own site:
curl -A "my-test-client/1.0" https://example.com/ On Windows PowerShell, type curl.exe so you run curl itself. Developer tools in major browsers also let you override the string, usually under a network conditions or device emulation panel. Changing the string doesn't change the engine, so an emulated phone on your desktop won't reproduce engine-specific bugs.
Server logs record the header too. Reading server logs shows where to find it.
Why you shouldn't make security decisions with it
It can be tempting to allow an administration page only from "our company's browser", or to block anything that doesn't look like a browser. Neither protects much, because the sender chooses the value. A person who learns the rule satisfies it with one setting.
Real access control relies on things a stranger can't simply type: authentication, signed tokens, client certificates or network restrictions you enforce. The same applies to age checks, payment flows and download protection.
The string can still be a supporting signal. A signed-in session whose user agent suddenly changes from one platform to another may deserve a second look, alongside other evidence. Treat it as a reason to check, and expect innocent explanations such as an update or a "desktop site" toggle.
Privacy
On its own, a common string says little. Combined with your IP address, screen size, fonts, language and other traits, it contributes to browser fingerprinting. That's the reason for reducing its detail.
Switching your string to something unusual tends to backfire: a rare combination makes you stand out, and sites may break. If privacy is the aim, a browser with built-in fingerprinting protections is a more dependable route.
Common questions
Can a website tell which phone I have?
Sometimes roughly. Reduced strings often omit the model, though other signals and Client Hints may reveal more in some browsers.
Why does a site say my browser is outdated when it isn't?
Its detection code may not recognize your browser's token or version format. Updating helps, and so does telling the site owner.