How to change your user agent

Every major browser can send a different user agent, without extensions. Here is how, per browser, plus what changing it does and does not achieve.

Why you would want to. Testing how your site responds to different devices, reproducing a bug reported only on one browser, checking what a crawler sees, or getting past a site that blocks a browser it does not recognise. Grab a realistic string from the database rather than inventing one — sites do reject malformed strings.

Google Chrome

Per-tab, for the current session:

  1. Open DevTools — F12, or Ctrl+Shift+I (++I on Mac).
  2. Press Ctrl+Shift+M to toggle the device toolbar, then pick a device from the dropdown. Chrome sends that device's user agent and emulates its viewport.
  3. For an arbitrary string: open the three-dot menu in DevTools → More toolsNetwork conditions, uncheck Use browser default, and enter it.

Browser-wide, from the command line:

chrome --user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Mobile/15E148 Safari/604.1"

Mozilla Firefox

Permanently, via configuration:

  1. Navigate to about:config and accept the warning.
  2. Search for general.useragent.override. If it does not exist, select String and click + to create it.
  3. Set the value to the string you want. It applies immediately, to every tab.
  4. To revert, delete the preference using the bin icon — clearing it to an empty string is not the same thing.

Per-session: open the Responsive Design Mode with Ctrl+Shift+M and choose a device preset.

Safari

  1. Open SettingsAdvanced and tick Show features for web developers.
  2. The Develop menu appears in the menu bar.
  3. Choose DevelopUser Agent and pick a preset, or Other to type your own.

The change applies to the frontmost tab and resets when it is closed.

Microsoft Edge

  1. Open DevTools with F12.
  2. Press Ctrl+Shift+M for device emulation, or open Network conditions from the DevTools menu.
  3. Uncheck Use browser default and enter your string.

From the command line

# cURL
curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" https://example.com

# Wget
wget --user-agent="Googlebot/2.1 (+http://www.google.com/bot.html)" https://example.com

# Python requests
requests.get(url, headers={"User-Agent": "AcmeBot/1.0 (+https://acme.example/bot)"})

What changing it does not do

It is not a privacy measure. Your screen dimensions, GPU renderer, installed fonts, time zone, touch capability and the results of hundreds of feature tests all still describe your real device. An unusual user agent paired with an obviously contradictory environment — an iPhone string on a 2560×1440 screen with no touch support — makes you more identifiable, not less.

On Chromium browsers there is a further wrinkle: overriding the string does not automatically update the Client Hints headers, which continue reporting your real platform. Chrome's Network conditions panel keeps them in sync; a command-line flag or a naive extension usually does not, so a site reading hints sees straight through the override.

Frequently asked questions

Is changing your user agent legal?

Yes. It is a client-controlled header, browsers ship the feature deliberately, and web developers use it daily. Using it to circumvent access controls or terms of service is a separate question governed by those terms, not by the header itself.

Will it stop websites from tracking me?

No. Tracking overwhelmingly relies on cookies, IP addresses and fingerprinting signals that are unaffected by the string. Changing it in isolation can make you easier to single out, because the mismatch between what you claim and what your browser demonstrably is becomes its own signal.

Why does the site still detect my real browser?

Two likely reasons. Either it is using feature detection — checking for APIs only your real browser has — or it is reading Client Hints, which your override did not change. Chromium sends Sec-CH-UA headers independently of the user agent string.

Which user agent should I use for testing?

A real one, current for the device you are emulating. Pick from the database — invented strings often fail validation on sites that check structure, and outdated ones can trigger unrelated legacy code paths that confuse your results.