Parse Mozilla Firefox User-Agent String
Parse a Firefox User-Agent string to extract the browser version, Gecko engine version, and operating system. Covers Firefox on Windows, macOS, and Linux.
Detailed Explanation
Understanding the Firefox User-Agent String
Firefox has a distinctly different UA string format compared to Chromium-based browsers:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Token Breakdown
- Mozilla/5.0 — The universal compatibility prefix.
- (Windows NT 10.0; Win64; x64; rv:121.0) — Platform info plus the Gecko revision number (
rv:121.0). The rv value typically matches the Firefox version. - Gecko/20100101 — The rendering engine. Unlike Chrome which uses Blink (reported as WebKit), Firefox uses Mozilla's Gecko engine. The date
20100101is frozen and no longer changes. - Firefox/121.0 — The actual Firefox version number.
Key Differences from Chrome UA
- Firefox includes rv:VERSION inside the platform parentheses
- Firefox reports Gecko as its engine, not AppleWebKit
- Firefox does not include Safari or Chrome tokens
- The UA format is significantly shorter and less cluttered
Firefox on macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0
Note that macOS versions use dots (10.15) in Firefox but underscores (10_15_7) in Chrome and Safari UA strings.
Firefox ESR (Extended Support Release)
Firefox ESR versions used by enterprises have the same UA format but with a different version number cycle. Detecting ESR vs. regular Firefox from the UA alone is not possible — the version number is the only indicator.
Privacy Considerations
Mozilla has been gradually reducing the information in Firefox's UA string as part of its privacy initiatives. Future versions may further freeze certain tokens to reduce fingerprinting surface area.
Use Case
QA teams parse Firefox UA strings to verify cross-browser compatibility, particularly for features that behave differently in Gecko versus WebKit/Blink engines. Analytics platforms use Firefox version detection to measure adoption of new web standards like CSS Container Queries or the Popover API.