DevKits

Request negotiation · Request header

User-Agent

The client software identifying itself.

What is User-Agent?

The User-Agent string names the browser, engine, OS, and often the device. It is famously convoluted for historical reasons.

Typical usage

Set automatically by browsers and HTTP libraries. Read for analytics and rare compatibility branching.

Examples

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Common gotchas

User-Agent can be trivially spoofed and is being reduced by modern browsers. Do not use it as a security control.

Frequently asked questions

What is the User-Agent HTTP header?

The User-Agent string names the browser, engine, OS, and often the device. It is famously convoluted for historical reasons.

Is User-Agent a request or response header?

User-Agent is a request header — the client sends it to the server. Set automatically by browsers and HTTP libraries. Read for analytics and rare compatibility branching.

What does a User-Agent header look like?

A typical User-Agent header looks like: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36.

What are common mistakes with User-Agent?

User-Agent can be trivially spoofed and is being reduced by modern browsers. Do not use it as a security control.

Related headers

Work with this header