Detect Mobile Browsers from User-Agent

Learn how to detect mobile browsers from User-Agent strings. Covers Chrome Android, Safari iOS, Samsung Internet, and other mobile UA patterns.

Mobile

Detailed Explanation

Detecting Mobile Browsers from User-Agent

Mobile browser detection is one of the most common uses of User-Agent parsing. The presence of specific tokens like Mobile, Android, iPhone, or iPad indicates a mobile device.

Chrome on Android

Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.144 Mobile Safari/537.36

Key indicators:

  • Android XX — The Android version
  • Device model (Pixel 8) — appears before Build/ or )
  • Mobile — appears before Safari, distinguishing it from tablet Chrome

Safari on iPhone

Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1

Key indicators:

  • iPhone — explicitly identifies the device
  • CPU iPhone OS 17_2 — iOS version with underscores
  • Mobile/15E148 — Mobile build number
  • Version/17.2 — Safari version (matches iOS version)

Samsung Internet

Mozilla/5.0 (Linux; Android 13; SM-S918B) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/23.0 Chrome/115.0.0.0 Mobile Safari/537.36

Samsung Internet is the second most popular mobile browser. It includes both SamsungBrowser/ and Chrome/ tokens because it is Chromium-based.

Tablet vs. Mobile Distinction

On Android, the absence of the Mobile token indicates a tablet:

Phone: ...Chrome/120.0.0.0 Mobile Safari/537.36 Tablet: ...Chrome/120.0.0.0 Safari/537.36 (no "Mobile")

On iOS, iPads are identified by the iPad token instead of iPhone.

Server-Side Mobile Detection

While responsive design with CSS media queries is preferred for layout, UA-based mobile detection is still used for:

  • Serving different image formats or resolutions
  • Redirecting to mobile-specific domains (m.example.com)
  • Adjusting API response payloads for mobile bandwidth
  • Analytics segmentation by device type

Use Case

Web developers and DevOps engineers use mobile UA detection to implement device-specific logic such as adaptive serving, A/B testing by device type, and mobile-specific analytics dashboards. It is also critical for QA teams testing responsive designs across multiple mobile browsers.

Try It — User-Agent Parser & Analyzer

Open full tool