What is a user agent?
A user agent is the software that makes a web request on behalf of a person, such as a browser, an app or a search engine crawler, and it identifies itself to servers in the User-Agent header.
A User-Agent header sent by a browser, and by a crawler:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 Mobile/15E148 Safari/604.1 Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Uses
What servers do with it.
Analytics
Show which browsers, systems and device types visitors use.
Responsive delivery
Serve a mobile or desktop version.
Crawler rules
Robots.txt groups rules by user-agent name.
Bot detection
Spot automated traffic by its agent string.
Caveats
It can be wrong.
The header is self-reported, so any client can claim to be a browser or a crawler. Browsers also include old names, such as Mozilla, for historical compatibility. Treat it as a hint, not proof of identity.
FAQ
Common questions
Why does every browser say Mozilla? +
Early browsers copied Netscape's name to receive its pages, and the habit stuck.
How do analytics tools read browser and device? +
By parsing the User-Agent string into browser, operating system and device type, which is how link statistics break clicks down.
How do I block a crawler? +
Add a robots.txt group for its user-agent name. Well-behaved crawlers follow it.
Can the User-Agent be changed? +
Yes. Browsers' developer tools, extensions and scripts can set any value.