← Back to blog

HTTP User Agents: What They Are and How to Parse Them

November 2, 2026
HTTP User Agents: What They Are and How to Parse Them

An HTTP user agent is the software making a web request, and the User-Agent header is the text string it sends to say who it is. Servers read that string to see the browser, version, operating system and sometimes the device behind a request. You can detect it on the server by reading the request header, or in the browser with navigator.userAgent. Parsing it is possible but fragile, and modern browsers now send less detail than they used to.

This guide covers how to read a string, where to find examples, how to detect and parse it, and what to do when the string lies or goes missing.

Pingfloat
pingfloat.com
Inspect Your User-Agent String
Pingfloat’s user-agent tool shows the string your browser sends, alongside tools for website health, SSL checks, and network diagnostics.
Check your user agent

TL;DR

  • The User-Agent header identifies the client software making an HTTP request: browser, version, operating system, or a bot, script or download manager.
  • Detect it server-side from the request header, or client-side with navigator.userAgent. To see yours right now, use our What's My User Agent tool.
  • Parsing is a last resort. Strings are not uniform, clients can spoof them, and feature detection is usually the safer choice.
  • Browsers are reducing the detail in the string. Servers that need more ask for User-Agent Client Hints.

Table of Contents

What an HTTP User-Agent is

Every time a browser, app, crawler or script requests a page, it can attach a User-Agent header. MDN describes it as a string that lets servers and network peers identify the application, operating system, vendor and version of the requesting client. "User agent" is the general term for the client itself. That means a browser, but also a bot, a download manager or any other web client.

That is why the same header shows up in very different places:

  • A person opening a page in a desktop browser.
  • A phone app calling your API.
  • A search engine crawler fetching your pages.
  • A command-line script checking a URL.

For developers, the header is a cheap way to answer practical questions. Which crawler is hitting this endpoint? Is this request from a phone? Which browser version produced this error report? It is also where many of the questions below go wrong, so it helps to know what the string can and cannot tell you.

Anatomy of a User-Agent string

The formal shape is simple. MDN gives it as User-Agent: <product>/<product-version> <comment>. Real browser strings are messier, because they follow a long-standing pattern that begins with Mozilla/5.0, then a parenthesized block of system information, then platform and extension tokens.

A Firefox example, token by token

MDN's current example looks like this:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0

Read it from left to right:

TokenWhat it tells you
Mozilla/5.0A historical compatibility token. Almost every browser sends it, so it tells you nothing about the actual browser.
(Macintosh; Intel Mac OS X 10.15; rv:138.0)The comment: platform and operating system, plus rv, the Gecko version.
Gecko/20100101The rendering engine.
Firefox/138.0The browser and its version.

MDN notes that operating system details usually sit in the comment portion, but the syntax varies by browser. It can include the OS version, hardware information or CPU architecture. So you cannot rely on one universal layout.

Why Chrome and Safari strings look so similar

Because of that compatibility history, a string can name several browsers at once. MDN warns that a user agent may pretend to be another browser or include information about more than one. A token such as Safari appearing in the string does not prove the browser is Safari. It only proves the token is there. If you want to tell a rendering engine from a browser brand, a short JavaScript SEO audit guide shows why engines, not names, are what matter when you check how pages render.

For a catalog of strings from common browsers and crawlers, see our browser and crawler user agent reference. The wider user agent strings reference explains the tokens in more depth.

Where to find User-Agent string examples

The most dependable examples come from the documentation of the browser makers. MDN's User-Agent header page includes Firefox examples and a reduced Chrome on Android example. Our own reference pages group strings by type:

Two cautions apply when you copy strings from any list. First, strings change with every browser release, so a list that is a few years old will show versions nobody runs. Second, a list tells you what a string looks like, not what is safe to match against in production code.

How to detect a user agent

There are two places to read it.

On the server

Inspect the incoming request's User-Agent header. Every web framework exposes request headers, so it is usually one line to read. Log it alongside the status code and path when you debug, because it quickly shows whether a failing request came from a crawler, a monitoring probe or a real browser.

In the browser

MDN's glossary says browsers send the User-Agent header with requests, and that client-side JavaScript can read it through navigator.userAgent. Open the developer console and type navigator.userAgent to see exactly what your browser reports.

Checking without writing code

If you only want to see what a browser is sending, open the What's My User Agent tool. No install or account is needed. To inspect what a server sends back, the response headers inspector shows the other half of the conversation, and our post on HTTP headers explained covers how request and response headers fit together.

How to parse a User-Agent string

Parsing means turning the raw text into structured fields: browser, version, operating system, device type, bot or not. There are three common approaches.

Approach 1: a few regular expressions

The quick way is to search for known tokens such as iPhone or Android. DeviceAtlas's 2025 guide notes that this can misclassify devices and is not future-proof, because strings do not follow one standard pattern. Its practical view is that regex rules become a costly maintenance burden as browsers, devices, locales and sideloaded clients multiply the permutations.

That is a fair warning from a vendor that sells device detection, and it matches what most developers find after the first year. Still, a small regex is fine for a narrow job, such as flagging requests from one named crawler in your logs. If you do write one, test it against real sample strings first with our regex tester.

Approach 1: a few regular expressions

Approach 2: a parsing library

A library does the matching for you and returns fields. The open-source uasurfer project is a good illustration: its parse function takes a raw string and returns structured browser, OS, platform, device type, version and bot fields. Its documentation is also honest about the limits:

  • Telling an Android phone from a tablet can depend on the presence of a Mobile token.
  • Native apps may give no form factor at all.
  • Bot detection depends on a maintained list of names.

Whichever library you pick, check how often it is updated, because a parser is only as good as its pattern list.

Approach 3: don't parse, detect the feature

MDN is blunt about this. Browser detection by user agent sniffing is hard to do reliably and often causes bugs, and parsing should be a last resort. Where possible, test for the feature your code needs, not for the browser name. Our post on why developers should stop sniffing user agent strings walks through this in practical terms.

A simple decision rule

Your goalBetter approach
Use a CSS or JavaScript feature only if supportedFeature detection
Count browsers and operating systems in analyticsA maintained parsing library
Spot a specific crawler in server logsA targeted match, then verify it
Serve different layouts by deviceResponsive design first, UA only as a hint

Why you cannot fully trust the string

The header is declared by the client, and the client can say anything. MDN's glossary warns that spam bots, download managers and some browsers may announce themselves as a different client. A string that says it is a well-known search crawler is a claim, not proof.

For anything with consequences, such as access control, rate limits or blocking, do not rest on the string alone. Pair it with other signals. Our crawler identification reference explains how to recognize the major search and AI crawlers. As the AI search landscape grows, you will also see guides on how to optimize for ChatGPT, and crawler identification is the first step to knowing which of those bots actually visit your site.

User-Agent reduction and Client Hints

The string used to carry plenty of detail, and that is now a problem. MDN says detailed values have raised privacy concerns because they can be used to identify a client and for fingerprinting. Chrome for Developers explains that the historical Chrome string exposed the OS and version, device model, full browser version and mobile clues, and that the variety of those values created fingerprinting risk.

The response is called User-Agent reduction. Browsers freeze or remove high-detail values from the string. MDN's reduced Chrome on Android example shows a generic Android 10, a model of K and a major-only Chrome version.

If your server needs more, it can ask. Per MDN, the server requests selected User-Agent Client Hints with the Accept-CH header, and the client may then send Sec-CH-UA-* fields. Chrome frames this as a compromise: legitimate adaptation and analytics remain possible, but high-detail identifying values are not sent by default.

What this means for your code:

  1. Do not depend on exact OS versions or device models in the string.
  2. Ask for Client Hints only for the specific values you will use.
  3. Re-test any parser you rely on against current browser strings.

Debugging with user agents: a short workflow

When an issue only affects some visitors, the user agent is often the first clue.

  1. Log the header with each failing request, along with the URL and status code.
  2. Group failures by browser family and by bot versus human.
  3. Reproduce with the same string. A tool or script can send the same header, and a mismatch in behavior points to UA-based rules in your stack.
  4. Check the status codes you return. Our HTTP status codes reference helps, including the pages on 500 Internal Server Error and 503 Service Unavailable.
  5. Review your security headers while you are there. See the security headers checklist.

Our perspective

We built Pingfloat's user agent pages around one idea: you should be able to see what a client is sending in seconds, without installing anything or signing up.

In our experience, most user agent bugs come from treating the string as truth when it is a hint. We would rather help you read it, compare it against known strings and then decide whether you need it at all. Often you do not, and a feature check is the better tool.

That is why the tools and references sit side by side: a lookup of what your browser sends, catalogs of browser and crawler strings, and header inspection for the response. Use them together when you debug, and keep parsing for the cases where nothing else works.

Andreas

Try it on your own traffic

Pingfloat is a free suite of web tools for developers and IT professionals. Core tools work with no installation or account. Besides the user agent lookup, you can check HTTP response headers, run a traceroute, and keep an eye on availability with the website uptime monitor.

Pingfloat

See everything on the Pingfloat home page, or automate lookups through the Pingfloat public API.

FAQ

What is a user agent?

A user agent is the software that makes a request on your behalf, such as a browser, a crawler, a script or a download manager. It identifies itself to servers with the User-Agent header, which usually names the application, version and operating system.

What is the most common user agent?

There is no single answer, because it changes constantly with browser releases and with who visits a given site. Your own analytics are the reliable source. Most desktop and mobile browser strings start with Mozilla/5.0 for historical reasons, so look at the later tokens, such as Chrome or Firefox, to tell them apart.

How do I detect the browser from a user agent?

Read the header on the server or navigator.userAgent in JavaScript, then look at the engine and browser tokens. Be careful: a token only shows that the text is present, and clients can spoof strings. When you only need to know whether a feature works, test for the feature.

Can a user agent be faked?

Yes. Clients choose what to send, and bots, download managers and some browsers announce themselves as something else. Treat the string as a hint, and combine it with other checks when the decision matters.

Is the user agent string going away?

It is shrinking, not disappearing. Browsers are reducing the detail they send, and servers that need more can request User-Agent Client Hints. Plan for less detail, not none.

Sources