Set a proxy for Google Chrome browser

To set a proxy for Google Chrome browser with command line, you can use the following steps:

  1. Open the Command Prompt (CMD) or Terminal on your operating system.

  2. Navigate to the directory where Google Chrome is installed on your computer. For example, on Windows, the default installation directory is "C:\Program Files (x86)\Google\Chrome\Application".

  3. Use the following command to launch Google Chrome with the proxy settings:

    1
    chrome.exe --proxy-server=<proxy_server_address>:<proxy_port>

    Replace <proxy_server_address> and <proxy_port> with the actual address and port number of your proxy server.

  4. Press Enter to execute the command and launch Google Chrome with the specified proxy settings.

For example, if your proxy server is located at IP address 192.168.1.100 and port 8080, the command would look like this:

1
chrome.exe --proxy-server=192.168.1.100:8080

You can also specify additional options such as the user credentials for the proxy server, as shown in the following example:

1
chrome.exe --proxy-server=192.168.1.100:8080 --proxy-user=username --proxy-password=password

If you are using socks5 proxy, the format is:

1
chrome.exe --proxy-server=socks5://192.168.1.100:8080 --proxy-user=username --proxy-password=password

Replace username and password with your actual login credentials for the proxy server.
5. In case you need to exclude some domains from using proxy, you can add an extra flag --host-resolver-rules.

For example, if you want to visit the IP 127.0.0.1 directly, the command would look like this:

1
chrome.exe --host-resolver-rules="EXCLUDE 127.0.0.1"

You can also exclude multiple domains or IPs, append more EXCLUDE to the command line:

1
chrome.exe --host-resolver-rules="EXCLUDE 127.0.0.1, EXCLUDE localhost"