User agents explained: what they are and how to set one
By the ProxyOnly team · 16 Nov 2026 · 6 min read
A user agent is the label an app sends to say what it is. What the string means, what common tools send by default, how to set one, and why a site cannot trust it.
A user agent is the label that a client sends with every web request to say what software it is. It travels in the User-Agent request header. A browser sends a long string that names the browser and the system it runs on, a script sends the name of its library, and a search engine's crawler sends its own name. RFC 9110 defines the header as information about the software that originated the request.
Websites read it for statistics, to decide which version of a page to serve, and to apply rules about bots. One fact matters more than the rest: the string is a claim made by the client. Nothing checks it. This article shows what it looks like, what common tools send, how to set it, and why it should never be trusted on its own.
What a user agent string looks like
MDN gives the common format for web browsers as Mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions>. Its examples for Chrome on desktop look like this:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36Much of it is history and not information. Mozilla/5.0 says that the browser is compatible with Mozilla, and MDN notes that for historical reasons almost every browser sends it. AppleWebKit/537.36 (KHTML, like Gecko) and Safari/537.36 are inherited compatibility markers from the browser engine's past. The parts that carry information are the system in the first brackets and the browser name and version, Chrome/143.0.0.0.
Other clients are shorter. MDN lists the crawler string Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) and the library strings curl/7.64.1 and PostmanRuntime/7.26.5. A well-behaved crawler or script names itself and, in brackets, points to a page about it.
Why browsers show less than they used to
The string can be used to recognise a particular browser, which makes it part of browser fingerprinting. MDN explains that browsers now provide a reduced set of information in the header. Chrome's current strings keep the major version but show the minor numbers as zeros, which is why 143.0.0.0 has three zeros, and they use a fixed platform version and, on Android, a fixed device model. A server that needs more detail can ask for it through User-Agent Client Hints, and MDN marks the JavaScript interface for them as experimental with limited availability. Browser fingerprinting explained covers the larger picture.
MDN also warns against branching on the string. It calls parsing the user agent "very hard to do reliably" and often a cause of bugs, and recommends checking for the feature you need instead of the browser that has it.
What common tools send by default
Scripts identify themselves truthfully unless you change it. We ran a small server that echoes the header back, and sent a request from each tool:
import http.server, json
class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
body = json.dumps({"user-agent": self.headers.get("User-Agent")}).encode()
self.send_response(200)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
http.server.HTTPServer(("127.0.0.1", 9200), H).serve_forever()Results, with the tool on the left and what the server received on the right:
curl curl/8.7.1
Python requests python-requests/2.34.2
Python urllib Python-urllib/3.10
Node.js fetch node
Python http.client (no header at all)The last line is easy to miss. Python's low-level http.client sends no User-Agent header unless you add one, and a missing header is something bot rules can react to. Cloudflare's Browser Integrity Check, for example, challenges visitors that send no user agent. Cloudflare error 1010 covers a site rule of that kind.
How to set one
Each tool has a place for it. We sent the string price-checker/1.0 (+https://shop.example/bot) through each of the following and the server echoed it back unchanged:
curl -s -A "price-checker/1.0 (+https://shop.example/bot)" http://127.0.0.1:9200/
curl -s -H "User-Agent:" http://127.0.0.1:9200/The first command sets the header. The second one, with an empty value, removes it, and the server then reported null.
import requests, urllib.request
UA = "price-checker/1.0 (+https://shop.example/bot)"
print(requests.get("http://127.0.0.1:9200/", headers={"User-Agent": UA}).json())
request = urllib.request.Request("http://127.0.0.1:9200/", headers={"User-Agent": UA})
print(urllib.request.urlopen(request).read().decode())const response = await fetch("http://127.0.0.1:9200/", { headers: { "User-Agent": "price-checker/1.0 (+https://shop.example/bot)" } });
console.log(await response.json());The Python code printed the string twice, once for each library, and the Node code printed it once. Browser automation tools set it through their own options. Playwright's documentation shows browser.new_context(user_agent=...) in Python, and Chrome's DevTools can override the string with the network conditions panel, which is useful for testing how your own site reacts. We did not run those two, and they change only the header and what navigator.userAgent reports.
To see your own browser's string, type navigator.userAgent in the console, as MDN shows. To see what a server receives from a tool, use an echo server like the one above.
A user agent proves nothing
Anyone can send any string. A script can claim to be Chrome, and a person can claim to be a crawler. Real crawlers therefore have to be verified another way. Google's documentation for verifying Googlebot says to run a reverse DNS lookup on the address in your logs, check that the name ends in googlebot.com, google.com or googleusercontent.com, and then run a forward lookup on that name to confirm that it points back to the same address. We tried it on the address from Google's own example:
$ dig +short -x 66.249.66.1
crawl-66-249-66-1.googlebot.com.
$ dig +short crawl-66-249-66-1.googlebot.com
66.249.66.1The name ends in googlebot.com and resolves back to the address we started with, so the request is genuine. A request from any other address that merely says "Googlebot" in its user agent fails this test. The same reasoning applies to everything else the header claims.
For the same reason sites do not rely on the string alone. They compare it with other signals, such as the other headers, the way the connection is set up and how the client behaves. A string that does not match the rest of the request can be a stronger signal than a plain, honest one. Why websites block IPs and proxies lists these signals.
Which one should your script send?
- Name your tool and its version, and point to a page that says who runs it and how to reach you. That is what
price-checker/1.0 (+https://shop.example/bot)does. It lets a site owner allow you by name, or write to you if you cause trouble. - Keep it the same for the whole job, and make sure the rest of the request agrees with it.
- Do not claim to be a search engine's crawler or a particular browser in order to get past a rule. That is a way to turn a technical limit into a dispute, and it is the step this blog does not describe.
- If a site refuses non-browser clients, ask for access or an API key. How to scrape a website lists the legitimate routes, and the guide to avoiding blocks responsibly turns them into a checklist.
- Changing the string for testing your own site is fine. Responsive layouts, mobile redirects and bot rules are all worth checking with a few different strings.
A user agent switcher is not a proxy
Browser extensions called user agent switchers change the header, and often navigator.userAgent too. They do not change your IP address, your location or any other signal, so the site still sees your own connection. To change the address a site sees you need a proxy, which what is a proxy server explains, and the guide to Python Requests shows how to send both the proxy and the header from a script.
Try it yourself
Create an account, add funds from US$1 and order a proxy in the country you need.
Keep reading
25 Nov 2026 · Tutorials
Python HTTP clients compared: requests vs httpx vs aiohttp
A tested comparison of requests, httpx and aiohttp, including a benchmark where the run-to-run noise turned out to be larger than the gap people argue about.
25 Nov 2026 · Tutorials
How to find your proxy server address and port
Find the proxy your machine is already configured to use on Windows, macOS, Linux and in browsers, or find the host and port of a proxy you bought.