How to change the User-Agent header in Chrome
To change the User-Agent header that Chrome or Edge sends, add a request header named User-Agent in HeaderDial with the operation set and the string you want. Every matching request then carries your value instead of the browser's. This changes the HTTP header only. JavaScript running in the page still sees the real browser through navigator.userAgent, which matters if the site detects devices on the client side.
When you need this
- Testing server-side device detection, for example a server that redirects phones to a mobile site or serves different HTML.
- Checking how your server, CDN rules or bot filtering treat a particular client, such as a crawler or a monitoring agent.
- Reproducing a bug report that came with a specific User-Agent string from your logs.
- Making requests identifiable in server logs during a test session, for example by appending a marker.
Steps
- Click the HeaderDial icon to open the popup. If you see the site-access banner, choose Allow on all sites or Only <current host>.
- Click + Request header. Start typing
User-Agentand pick it from the suggestions. - Paste the new string into the value field. For example, a typical iPhone Safari string looks like this:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1 - Choose the operation. set replaces the browser's string. append adds your text to it, which is handy for tagging test traffic (for example
qa-run-42) while keeping the real string. User-Agent is one of the request headers browsers allow appending to. - Open Where it applies, click + Only on <current host> or + Only on…, and enter the domain under test.
- Reload the page. If the server already sent a cached, device-specific page, do a hard reload (Ctrl+Shift+R).
What changes and what doesn't
| Where the user agent shows up | Changed by a header rule? |
|---|---|
User-Agent request header seen by servers | Yes, on matching requests |
navigator.userAgent in page JavaScript | No |
Client hints headers such as Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform | Not unless you add rows for them too |
navigator.userAgentData in JavaScript | No |
| CSS media queries, screen size, touch support | No |
A server that reads client hints may see a Windows Chrome in Sec-CH-UA-Platform and an iPhone in User-Agent. If your detection uses client hints, add rows for those headers as well and test what the server makes of the combination.
The DevTools and curl alternatives
Chrome DevTools can override the user agent too: open the Network conditions panel, untick "Use browser default" and pick or type a string. That changes both the header and navigator.userAgent, but only for the tab that has DevTools open and only while DevTools stays open. For whole-page emulation, including screen size and touch, use the device toolbar. A header rule fits best when you want the header changed in every tab without DevTools, or only for specific hosts.
curl -A "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1" -I https://www.example.com/
# same as: curl -H "User-Agent: ..."
Pitfalls
- Mixed signals. The page's JavaScript may undo a server-side decision, for example by redirecting back because
navigator.userAgentsays desktop. This is expected with a header-only change. - Caching. Responses that vary by User-Agent must send
Vary: User-Agent, or a cache may hand you the wrong version. That is worth checking while you are testing. - Confirm what was sent. Look at the request in the DevTools Network panel or in your server's access log. The footer line "Applied to N requests in this tab" tells you the rule matched.
Add to ChromeFirefox: coming soon