Technology
Why Do Almost All Browser User Agents Start With Mozilla/5.0?
A historical and technical explanation of why modern browser user agents still begin with Mozilla/5.0, even when the browser is Chrome, Safari, Edge or something else entirely.
Quick summary
A historical and technical explanation of why modern browser user agents still begin with Mozilla/5.0, even when the browser is Chrome, Safari, Edge or something else entirely.
What Is a User Agent?
Open your browser’s developer tools, inspect a request, and look at the User-Agent header. There is a good chance it starts with something like this:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
At first glance, this looks absurd. Chrome is not Mozilla. Safari is not Mozilla. Edge is not Mozilla. And yet, almost every modern browser still begins its user agent string with Mozilla/5.0.
This is not a bug. It is a fossil: one of the best examples of how bad browser detection, historical compatibility hacks and web inertia shaped the modern internet.
The Purpose of the User-Agent Header
A user agent is the software acting on behalf of the user. In web browsing, that usually means the browser.
When a browser sends an HTTP request, it can include a User-Agent header. The original purpose was simple: tell the server what kind of client is making the request.
In theory, this could have been clean and straightforward:
User-Agent: Chrome/126
But the real web is not clean. Modern user agent strings often contain multiple browser names, rendering engines, compatibility claims, operating system details and historical leftovers.
The Beginning: Netscape and Mozilla
In the early web, Netscape Navigator was the dominant browser. Internally and historically, Netscape was strongly associated with the name “Mozilla”.
Netscape sent user agent strings that began with values such as:
Mozilla/2.0
Mozilla/3.0
Mozilla/4.0
At the time, many websites wanted to serve different content depending on browser capability. Some browsers supported frames, tables, JavaScript, cookies or newer HTML features better than others.
So developers started doing browser detection. Instead of checking whether a browser actually supported a feature, websites often checked the browser name.
if (userAgent.includes("Mozilla")) {
serveModernPage();
} else {
serveBasicPage();
}
This was understandable, but fragile. It meant that being recognized as “Mozilla” became a ticket to the better version of the web.
Internet Explorer Learns to Pretend
Then came Microsoft Internet Explorer.
Internet Explorer was not Netscape. But it wanted to receive the same rich pages that Netscape received. If websites only gave advanced pages to browsers whose user agent contained Mozilla, then Internet Explorer had a simple solution: pretend to be Mozilla-compatible.
That is why old Internet Explorer user agents looked like this:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
The important part is not that Internet Explorer was Mozilla. It was not. The important part is that it claimed compatibility.
This trick worked. Servers saw Mozilla, decided the browser was capable enough, and sent the advanced page.
Once that happened, the user agent string stopped being a clean identity field and became a negotiation tactic.
Everyone Pretends to Be Everyone Else
The problem did not stop with Internet Explorer.
As new browsers and rendering engines appeared, each one had to survive in a web already full of bad browser-sniffing code.
KHTML, WebKit, Safari, Chrome, Edge, Firefox and mobile browsers all inherited this mess.
A typical modern Chrome user agent says:
Mozilla/5.0 (...) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/... Safari/...
That string is basically a historical compatibility chain:
Mozilla/5.0means: treat me as a modern browser.AppleWebKitreflects Chrome’s historical relationship with WebKit.KHTML, like Geckoexists because WebKit originally descended from KHTML and wanted sites to treat it like Gecko-compatible.Chromeidentifies the actual browser.Safariappears because Chrome needed compatibility with sites expecting Safari/WebKit tokens.
So the user agent is not a clean label. It is more like a diplomatic passport full of stamps from previous browser wars.
Why Mozilla/5.0 Specifically?
The 5.0 part is also historical.
Older user agents used Mozilla/4.0 during the Netscape 4 and Internet Explorer era. Later, Mozilla/5.0 became the general marker used by modern browsers to say: “I am compatible with the modern browser family.”
Today, Mozilla/5.0 does not mean the browser is Mozilla Firefox. It does not even necessarily mean the browser uses Mozilla technology.
It mostly means:
Dear old server-side browser detection code, please do not give me the broken fallback page.
That is why removing it would be dangerous.
A browser vendor could theoretically send a cleaner user agent string. But millions of websites, scripts, analytics tools, anti-bot systems, CMS plugins, old enterprise applications, ad platforms and CDN rules might misbehave.
The web rewards compatibility more than elegance.
Browser Detection vs Feature Detection
The deeper lesson is that browser detection was the wrong abstraction.
A website usually does not need to know whether the browser is Chrome, Firefox, Safari or Edge. It needs to know whether the browser supports a specific feature.
Bad approach:
if (navigator.userAgent.includes("Chrome")) {
enableFeature();
}
Better approach:
if ("querySelector" in document) {
enableFeature();
}
Or, for CSS:
@supports (display: grid) {
.layout {
display: grid;
}
}
Feature detection asks the right question: can this browser do the thing I need?
Browser detection asks a much weaker question: does this browser claim to be something I recognize?
The second approach is exactly how the user agent string became polluted.
Why User Agents Are Also a Privacy Problem
User agent strings do not only create compatibility problems. They also create privacy problems.
A detailed user agent can reveal browser family, browser version, operating system, device type, CPU architecture, mobile or desktop status and rendering engine.
Combined with other signals, this can contribute to browser fingerprinting.
That is one reason browser vendors have been trying to reduce the amount of information exposed by the traditional user agent string.
Chrome, for example, introduced User-Agent Client Hints as a more structured alternative. Instead of sending one messy string with everything inside it, the browser can disclose certain pieces of information in a more controlled way.
In practice, however, the old user agent string still exists because the web depends on it.
Why Hasn’t This Been Fixed?
Because compatibility debt is extremely hard to remove.
The user agent string is read by websites, JavaScript libraries, analytics systems, CDNs, bot filters, fraud detection systems, advertising platforms, mobile redirect scripts, legacy enterprise applications and server-side rendering logic.
Even if modern best practice says “do not parse the user agent unless you really must”, plenty of code still does.
And some of that code is old, unmaintained, invisible or business-critical.
A browser that suddenly removed Mozilla/5.0 would probably break real websites. Users would blame the browser, not the websites.
So browsers keep lying for compatibility.
The Modern User Agent Is a Historical Document
A browser user agent string is not just technical metadata. It is a compressed history of the browser wars.
It tells the story of Netscape’s early dominance, Internet Explorer pretending to be Netscape-compatible, WebKit inheriting KHTML compatibility, Chrome pretending to be Safari-compatible and servers making bad assumptions.
That is why a modern browser can say, with a straight face:
Mozilla/5.0 ... AppleWebKit ... KHTML, like Gecko ... Chrome ... Safari
It is not an identity card. It is a survival strategy.
Conclusion
Almost every browser starts its user agent with Mozilla/5.0 because the web trained browsers to lie.
In the early days, websites served better pages to browsers that looked like Netscape Mozilla. Internet Explorer copied the token to get those pages. Later browsers copied even more tokens to remain compatible with sites that were already sniffing for specific names.
The result is one of the strangest artifacts of web history: a field that was supposed to identify software became a pile of compatibility claims.
Mozilla/5.0 remains there not because it is meaningful in the modern sense, but because removing it would risk breaking old assumptions still buried across the web.
The user agent string is messy, misleading and historically ridiculous. But it is also a reminder of one of the web’s oldest laws: compatibility beats cleanliness.