← All articles

How to change the user agent in Chrome (without an extension)

Change the user agent in Chrome without an extension: DevTools Network conditions, device mode, client hints, a launch flag and Playwright.

To change the user agent in Chrome without installing anything, open DevTools, open the Network conditions tool (three-dot menu > More tools > Network conditions), untick Use browser default next to User agent, and choose a preset or paste a custom string. The change applies to the current tab while DevTools stays open. Reload the page so the site receives the new user agent from the first request.

Method 1: DevTools Network conditions

  1. Open DevTools with F12, Ctrl + Shift + I (Windows, Linux) or Cmd + Option + I (Mac).
  2. Click the three-dot menu in the top-right corner of DevTools, then More tools > Network conditions. You can also open the Command Menu (Ctrl + Shift + P or Cmd + Shift + P) and type “network conditions”.
  3. In the User agent section, untick Use browser default.
  4. Pick a preset from the dropdown (Chrome on Android, Safari on iPhone, Firefox, Edge, bots such as Googlebot), or choose Custom and paste any string.
  5. Reload the page.

Below the user agent field, an expandable User agent client hints section lets you set the brand, platform, model and the mobile flag. Fill it in when you emulate a phone, so the Sec-CH-UA-Mobile header agrees with the user agent string. Why that matters is explained in what a user agent switcher does.

The override lasts until you close DevTools or the tab.

Method 2: device mode sets it for you

If your goal is to see a site as a phone, use device mode instead of changing the user agent alone. Toggle the device toolbar (Ctrl + Shift + M or Cmd + Shift + M), choose a phone, and Chrome sets the user agent, viewport, pixel ratio and touch emulation together. A changed user agent with a desktop-width viewport usually shows a broken mix of mobile HTML and desktop layout.

Device mode is covered in the Chrome mobile emulator guide. For frequent checks without DevTools, a mobile view extension such as Mobile View Extension applies a device user agent, client hints and screen size from a toolbar button and keeps them while you browse.

Method 3: start Chrome with a custom user agent

To use a user agent for a whole browser session, start Chrome with the --user-agent flag. Use a separate profile directory so your normal profile is not affected:

# macOS
open -na "Google Chrome" --args --user-data-dir=/tmp/ua-test --user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"
:: Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=%TEMP%\ua-test --user-agent="..."

This changes the User-Agent header and navigator.userAgent, but not client hints, the viewport or touch support.

Method 4: automation with Playwright or Puppeteer

For repeatable tests, set the user agent in code. In Playwright, device descriptors set the user agent along with the viewport, pixel ratio and touch:

import { chromium, devices } from 'playwright';

const browser = await chromium.launch();
const context = await browser.newContext({ ...devices['Pixel 7'] });
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'pixel7.png' });

To set only the string, pass userAgent: '...' to newContext. In Puppeteer, use await page.setUserAgent('...').

Changing the user agent in other browsers

Browser How
Microsoft Edge Same as Chrome: DevTools > More tools > Network conditions
Firefox Responsive Design Mode (Ctrl + Shift + M / Cmd + Option + M) has a user agent field; for a permanent change, set general.useragent.override in about:config
Safari (Mac) Enable Show features for web developers in Settings > Advanced, then use Develop > User Agent
Chrome on Android No custom string; the Desktop site option in the menu switches to a desktop user agent
Safari on iPhone No custom string; Request Desktop Website in the page menu switches to a desktop user agent

Common problems

  • Nothing changed. You did not reload, or the site cached its decision in a cookie. Reload, or test in a private window.
  • The site looks broken. You changed the user agent but not the viewport. Use device mode for mobile testing.
  • The site still detects your real browser. It is reading client hints or using feature detection. Set client hints too, or accept that feature detection is the site doing the right thing.
  • A login or payment page blocks you. Some security systems treat mismatched user agents as suspicious. Use your normal browser for real accounts.

Frequently asked questions

Can I change the user agent in Chrome permanently?

Not through settings. Use the --user-agent command-line flag with a separate profile, or an extension that applies rules per site.

How do I change the user agent to mobile in Chrome?

Open DevTools and toggle device mode with Ctrl + Shift + M (Cmd + Shift + M on a Mac), then choose a phone. That sets a mobile user agent and a phone-sized viewport together.

Does changing the user agent hide my identity?

Not meaningfully. Sites can still identify your browser through other signals, and an unusual user agent can make you stand out more.

View your next website as mobile.

Add the mobile view Chrome extension and open device previews for the tab you are already working in.