User-Agent
A User-Agent is a string in a request by which a browser or program tells the site what it is.
Updated · Prokso editorial team
Every request has a User-Agent header: the browser name and version, the operating system, the device type. The site uses it to decide which version of the page to show.
Programs and code libraries have their own User-Agent, and it gives away an automated request right away. Many sites answer it with a refusal, the 403 code.
The User-Agent is only one of the traits by which a site recognizes a visitor. Together with the others they make up a browser fingerprint.
A proxy changes the IP address but not the User-Agent: your program sets it. It is important that they do not contradict each other, for example a mobile address and a desktop browser header.
What a User-Agent string is made of
A typical Chrome string on Windows looks like this: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36. The word Mozilla/5.0 is a leftover from the past and appears in every browser. The brackets hold the system and its architecture, followed by the engine and the browser name with its version.
Libraries describe themselves briefly: python-requests/2.32 or curl/8.5.0. These are exactly the strings that sites filter out first. You can see your current User-Agent on the My IP page, along with the IP, the browser language and the time zone.
What has to match the User-Agent
Besides this string, modern Chrome sends Sec-CH-UA headers with the same name and version, and the page reads navigator.userAgent through JavaScript. If you replace only the header with an extension, these three sources disagree, and the site notices it.
Compare two more things on the My IP page. The time zone by IP and by browser should match, and the browser language should fit the country of the address. A mobile carrier address combined with a desktop Windows string also looks odd.
Typical mistakes and what to do
- An outdated browser version in the string that hardly anyone uses anymore.
- A new User-Agent on every request within one session that keeps the same cookies.
- A mobile phone string with the window size of a desktop monitor.
It is more reliable to set the User-Agent in an antidetect browser profile, where it is consistent with the rest of the browser fingerprint. For scripts, take the string of a current browser and do not change it in the middle of a session.
FAQ
Do I need to change the User-Agent in a script?
A library's default header gives away an automated request right away. It is usually replaced with the header of a current browser.
Does a proxy change the User-Agent?
No. A proxy changes only the IP address; your program sends the headers.
Residential $1.59, mobile $2.50, datacenter $0.65 per GB
Sign up in a minute, get access right after payment.