User agent spoofing means presenting a User-Agent value that does not describe the software actually making the request. The User-Agent header carries a client's reported application and platform information, typically including browser or library version tokens. It is self-reported, so clients with suitable control can change it, and browsers, extensions, developer tools and automation frameworks all provide ways to do so. People spoof it to view a mobile layout on a desktop, to get past a site that refuses unsupported browsers, to test how a server responds to different clients, or to blend a scripted client into ordinary traffic. What a spoofed browser string cannot do is change the rendering engine, the operating system, the hardware or the dozens of other signals a page can read, so user agent consistency with other signals matters more than the declared string alone.
Where User-Agent Values Can Be Overridden
The value appears in more than one place, and a change in one does not automatically change the others.
- Browser settings and extensions. User agent switching extensions rewrite the header on outgoing requests and may also patch the JavaScript property. Some browsers expose a developer preference to set a custom string.
- Developer tools. Chrome's device mode and network conditions panel let a developer pick a device preset or type a custom string; the user agent string is one of the optional fields of a custom device definition, alongside viewport, device pixel ratio and touch behaviour.
- Automation frameworks. Tools built on the DevTools Protocol or WebDriver can set a user agent override per session, and some headless implementations expose a distinct default token. That behaviour depends on the browser and version.
- HTTP libraries and proxies. An HTTP library can set a custom User-Agent, whereas scripts inside a browser remain subject to its request-header rules, and an intermediary can rewrite headers in transit for unencrypted traffic.
A user agent override applied only at the network layer leaves the browser's own reporting untouched, and a page that checks both will see the mismatch.
Headers, JavaScript and Client Hints
Three channels report what the client is, and spoofing has to address all three to be consistent.
| Channel | What it carries | How it is read |
|---|---|---|
| User-Agent header | The classic string, such as Mozilla/5.0 followed by platform and engine tokens | Server-side when the header is present |
| Navigator properties | navigator.userAgent, appVersion, platform, and related values | JavaScript on the page |
| User-Agent Client Hints | Sec-CH-UA, Sec-CH-UA-Mobile and Sec-CH-UA-Platform eligible to be sent by default; higher-entropy hints such as platform version, model and full version list on request via Accept-CH; navigator.userAgentData in script | Server-side headers and JavaScript, in Chromium-based browsers over HTTPS |
The classic string has been reduced in supporting browsers: MDN notes that Chrome reports its major version correctly but shows minor version numbers as zeros, and that related properties such as navigator.platform are reduced as well. Client hints are the replacement for detail. Supporting browsers may send low-entropy hints by default on eligible requests. More detailed hints are requested through HTTP or the JavaScript getHighEntropyValues method, subject to browser policy. Support is concentrated in Chromium-based browsers, with secure-context requirements and variation among implementations. A spoof that rewrites the User-Agent header to claim Safari on macOS while the browser keeps sending Sec-CH-UA brands naming Chromium and a Windows platform is immediately contradictory. Tools that take spoofing seriously therefore override the header, the navigator properties and the client hint brands together, or suppress the hints entirely, and even then the structure of the remaining headers and the JavaScript environment still reflects the real engine.
User-Agent Spoofing Compared With Device Emulation
Changing the string is often mistaken for emulating a device. Chrome's own documentation describes device mode as a first-order approximation of how a page looks and feels on a mobile device, states that the code does not actually run on a mobile device, and lists aspects such as CPU architecture that DevTools will never be able to simulate. Device emulation adjusts the viewport, pixel ratio, touch events, network and CPU throttling and the user agent string together; it is a richer spoof but still a desktop engine presenting a different surface. Full environment control, as practised by anti-detect and profile-based browsers, extends the same idea to fonts, screen metrics, WebGL renderer strings, time zone, language and other signals, aiming for a coherent set rather than a single changed field. None of these turns a desktop into a phone. The rendering engine remains what it is, hardware-dependent behaviour still depends on the host, even when selected API results are transformed, and behaviour such as touch versus mouse input remains observable.
Legitimate Uses
Developers switch user agents to check that a server sends the correct variant of a page to each browser and that no browser is wrongly refused, which MDN's guidance on browser detection warns against in the first place. Accessibility and compatibility testers reproduce complaints from users of older browsers. Researchers study how services treat different clients. Privacy-oriented browsers normalise the string so that users are less distinguishable, which is spoofing in the service of a larger crowd rather than a particular disguise. Scraping and automation operators set a common browser string so that their tooling is not rejected on sight, which may or may not be permitted by the target site's terms.
Limits and What Does Not Change
A changed string does not change cookies, local storage or any site data; the browser keeps sending the same session cookies with the new header, so a site that already recognises the visitor continues to. It does not change the IP address, the TLS fingerprint the connection produces, the fonts installed, the GPU's rendering output, the screen size or the time zone. Where the spoofed claim conflicts with those signals, the mismatch itself becomes a signal, and a detection system may use that inconsistency as evidence. Client hints provide additional declarations, not authenticated proof of hardware or identity. For compatibility decisions, feature detection is usually more robust than assuming capabilities from a browser name. User agent spoofing remains useful for testing; its privacy effect depends on whether it makes a client less distinctive or creates an unusual combination, and it is most honestly described as editing one line of a client's self-description while the rest of the description stays in place.