Parse Apple Safari User-Agent String
Parse a Safari User-Agent string on macOS to extract the browser version, WebKit engine version, and OS version. Understand Safari's unique UA format.
Detailed Explanation
Understanding the Safari User-Agent String
Safari's UA string on macOS looks like this:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15
Token Breakdown
- Mozilla/5.0 — Standard compatibility prefix.
- (Macintosh; Intel Mac OS X 10_15_7) — The OS identifier. macOS versions use underscores instead of dots in Safari UA strings. "Intel" appears even on Apple Silicon Macs running in Rosetta or compatibility mode.
- AppleWebKit/605.1.15 — Safari's rendering engine. Unlike Chrome (which uses Blink but reports WebKit/537.36), Safari uses the actual WebKit engine maintained by Apple.
- Version/17.2 — The Safari version. This is the key field for identifying Safari — it only appears in Safari, not in Chrome or other WebKit browsers.
- Safari/605.1.15 — The Safari build number, which corresponds to the WebKit version.
How to Distinguish Safari from Chrome
Both Chrome and Safari include AppleWebKit and Safari tokens. The critical difference:
- Safari includes
Version/X.Ybefore the Safari token - Chrome includes
Chrome/X.Y.Z.Wand does NOT includeVersion/
A correct parser must check for Version/ + Safari together to identify real Safari.
Safari Version vs. macOS Version
Safari versions are tied to macOS releases:
- Safari 17.x comes with macOS Sonoma (14.x)
- Safari 16.x comes with macOS Ventura (13.x)
- Safari 15.x comes with macOS Monterey (12.x)
This means the Safari version indirectly reveals the macOS version, even when the OS version in the UA string is frozen.
Use Case
Front-end developers parse Safari UA strings to detect WebKit-specific behavior differences, particularly around CSS features like backdrop-filter, PWA support, and Web Push notifications. Safari's unique rendering engine means certain features behave differently than in Chromium browsers.