Last updated
What Is a User Agent String?
A user agent string is an HTTP header that browsers send with every request to identify themselves to web servers. It contains the browser name and version, rendering engine, and operating system. The User Agent Generator creates accurate user agent strings for testing, device simulation, and automation.
Chrome User Agent Examples
Chrome 120 on Windows 11:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on macOS Sonoma:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on Ubuntu Linux:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Firefox User Agent Examples
Firefox 121 on Windows 11:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Firefox 121 on macOS:
Mozilla/5.0 (Macintosh; Intel Mac OS X 14.2; rv:121.0) Gecko/20100101 Firefox/121.0
Firefox 121 on Linux:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0
Safari User Agent Examples
Safari 17 on macOS Sonoma:
Mozilla/5.0 (Macintosh; Intel Mac OS X 14_2_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15
Safari on iPhone 15 (iOS 17):
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
Safari on iPad (iPadOS 17):
Mozilla/5.0 (iPad; CPU OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1
Mobile Device User Agents
Samsung Galaxy S23 (Android 14, Chrome):
Mozilla/5.0 (Linux; Android 14; SM-S911B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.144 Mobile Safari/537.36
Google Pixel 8 (Android 14, Chrome):
Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.144 Mobile Safari/537.36
iPhone 15 Pro (iOS 17, Chrome):
Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/120.0.6099.119 Mobile/15E148 Safari/604.1
Edge User Agent Examples
Microsoft Edge 120 on Windows 11:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Microsoft Edge on macOS:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Edge 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 EdgA/120.0.0.0
Bot and Crawler User Agents
Googlebot (web crawler):
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Googlebot Smartphone:
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.109 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Bingbot:
Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
DuckDuckBot:
DuckDuckBot/1.0; (+http://duckduckgo.com/duckduckbot.html)
Setting User Agent in HTTP Requests
// JavaScript (fetch API)
const response = await fetch('https://api.example.com/data', {
headers: {
'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'
}
});
// Python (requests)
import requests
headers = {
'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'
}
response = requests.get('https://example.com', headers=headers)
// cURL
curl -H "User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://example.com
Testing Mobile Detection Server-Side
// Test your server-side mobile detection logic
// by sending mobile user agents in requests
// iPhone user agent → should trigger mobile layout
const mobileUA = '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';
// Desktop user agent → should trigger desktop layout
const desktopUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
// Googlebot → should serve crawler-friendly content
const botUA = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
User Agent History: Why They're So Complex
The "Mozilla/5.0" prefix appears in almost every browser's UA string.
Here's why:
1993: NCSA Mosaic — first graphical browser
1994: Netscape Navigator — sent "Mozilla/1.0"
1995: IE 1.0 — websites blocked non-Mozilla browsers
IE started sending "Mozilla/1.22 (compatible; MSIE 1.0)"
1996: IE 3.0 — added "MSIE" token for IE-specific features
2003: Safari — based on KHTML, sent "AppleWebKit" token
2008: Chrome — based on WebKit, included both "Chrome" and "Safari" tokens
2015: Edge — based on Blink, included "Chrome", "Safari", and "Edg" tokens
Result: Every modern browser claims to be Mozilla, WebKit, and Safari
for backward compatibility with old browser-detection code.
Common Use Cases
- Testing server-side mobile detection and adaptive content delivery
- Simulating Googlebot to test robots.txt and crawler behavior
- Bypassing user agent restrictions during development
- Web scraping with realistic browser user agents
- Testing browser-specific CSS and JavaScript code paths
- Verifying that your site serves correct content to different devices