MobileCheck

What is a user agent string?

Glossary · Updated October 23, 2026 · Also called: user agent string, User-Agent header, UA string

Definition A user agent is the software that acts for the user, usually the browser, and the user agent string is the text it sends in every HTTP request's User-Agent header (and exposes as navigator.userAgent) to identify itself: browser, version, rendering engine and operating system. Servers use it for statistics and sometimes to serve mobile pages, but it is unreliable for detection, and browsers now reduce the detail it contains.

What does a user agent string look like?

Chrome on an Android phone sends something like:

Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/141.0.0.0 Mobile Safari/537.36

Safari on iPhone:

Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15
(KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1

The strings are full of history: "Mozilla/5.0", "KHTML, like Gecko" and "Safari" appear in almost every browser's string because sites once sniffed for them. The useful parts are the platform (iPhone, Android), the word Mobile and the browser token. Chrome on iPhone adds CriOS, Firefox on iPhone FxiOS.

Why user agent detection is unreliable

For layout, use media queries and responsive design; for features, use @supports or feature detection in JavaScript. Chromium browsers also offer User-Agent Client Hints (Sec-CH-UA-Mobile, navigator.userAgentData), a structured replacement that Safari and Firefox don't support.

Example

// Prefer capabilities over UA strings
const touch = matchMedia('(pointer: coarse)').matches;
const narrow = matchMedia('(max-width: 600px)').matches;

On iPhone vs Android

Both platforms have a "Request Desktop Website" (Safari) or "Desktop site" (Chrome) option. It sends a desktop user agent and, in Chrome on Android, lays the page out in a wide desktop viewport too, so a visitor may see your desktop version on a phone. On iPhone, every browser's string still contains AppleWebKit and Mobile/, so CriOS is the only sign that a visitor is using Chrome rather than Safari.

User agents in MobileCheck

MobileCheck loads each device with its real user agent string together with its viewport, pixel ratio and touch support, so sites that serve different HTML to phones show their real mobile version in the report.

Guides and tools

Sources

  1. MDN: User-Agent header
  2. MDN: Browser detection using the user agent string

All 27 glossary terms, A to Z