Parse Microsoft Edge User-Agent String
Parse a Microsoft Edge User-Agent string to distinguish it from Chrome. Learn how Edge's Edg/ token identifies it among Chromium-based browsers.
Detailed Explanation
Understanding the Edge User-Agent String
Microsoft Edge switched to the Chromium engine in 2020. Its UA string is nearly identical to Chrome, with one key addition:
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
The Critical Difference: Edg/ Token
The Edg/ token at the end is what distinguishes Edge from Chrome. Note the abbreviation — it is Edg, not Edge. This was a deliberate choice by Microsoft to avoid triggering legacy Edge detection code that checked for the Edge/ token used by the old EdgeHTML-based Edge browser.
Parsing Order Matters
When parsing a UA string, you must check for Edg/ before checking for Chrome/, because Edge includes both tokens:
- Check for
Edg/orEdgA/(Android) orEdgiOS/(iOS) → Microsoft Edge - Check for
Chrome/→ Google Chrome
If you check for Chrome first, you will incorrectly identify Edge as Chrome.
Edge on Different Platforms
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.0.0 Mobile Safari/537.36 EdgA/120.0.0.0
Edge on iOS:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 EdgiOS/120.0.0.0 Mobile/15E148 Safari/604.1
Legacy Edge (EdgeHTML)
The old Edge browser used a completely different UA format:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041
Note Edge/ (with the full word) vs. modern Edg/ (abbreviated).
Use Case
Analytics teams need to distinguish Edge from Chrome in traffic reports since Edge has its own feature set (Collections, Vertical Tabs, Built-in VPN) that may affect user behavior. Web developers also check for Edge to handle Microsoft-specific enterprise features and IE Mode compatibility.