myIpAddress()

Returns one IP address of the computer that runs the PAC file. Which one depends on the engine, the routes and the adapter settings, so it is not guaranteed to be the address your PAC logic expects.

myIpAddress()  →  string

Used in about 26% of the real PAC files in the PAC file statistics.

A computer usually has several addresses: one per network adapter, VPN adapters, virtual adapters and IPv6 addresses. myIpAddress() returns only one of them, and each engine chooses it by its own rule. Chrome, Edge and Firefox look at the route towards the internet. Windows’ own proxy engine looks at the interface metric, which is the order of the adapters in Windows. pactester looks at the computer’s name. The answer can also change while the computer runs: when a VPN connects, when Wi-Fi and cable are both in use, or when Windows stops using a gateway that does not answer.

The measured examples below come from one Windows 11 computer with several network adapters. They show that the same file can get a different address in each engine. Other setups can give other answers, so treat the examples as examples, not as rules.

A PAC file therefore should not decide where a computer is from myIpAddress(). Serve a separate PAC URL per location (by DHCP or group policy), or let the proxy decide by the client’s source address.

Example

// Shows which address this engine returns (Firefox: browser console; Chrome: net-export log).
alert("myIpAddress() = " + myIpAddress());

The same computer got a different address from each engine

Network setupChrome / EdgeFirefoxWindows (WinHTTP, WinINet)
Only A has an address and the route to the internet; the other adapters got no address from DHCP (169.254.x.x).AAA
B has the route to the internet. A comes first in Windows' adapter order.BB; for a URL whose host is an IP address in A’s network: AA
A has the route to the internet. C has the lowest interface metric but no route to the internet.AAC
B has the route to the internet. C has the lowest interface metric but no route to the internet.BBC
B and C both have a route to the internet with the same metric.the one Windows uses (B)the one Windows uses (B)A, the first adapter in Windows’ order
B has the route to the internet, but its gateway does not answer.B at first, then A once Windows moved to the next route (within seconds)B or A, different from one page load to the nextA
All adapters except A are switched off.AAA
A VPN (V) with full tunnelling takes the route to the internet; A has the physical connection.VV; for a URL whose host is the VPN server’s address: AV
The same VPN while B had the route to the internet before it connected.VV; for a URL whose host is an IP address in a local network: that network’s adapterV
A VPN (V) with split tunnelling; A keeps the route to the internet.AA; for a URL whose host is an IP address that the tunnel carries: VA
The same split-tunnel VPN while B has the route to the internet and A comes first in Windows' adapter order.BB; for a URL whose host is an IP address in a local network: that network’s adapterA

One Windows 11 25H2 computer with five network adapters; Edge 155, Firefox 157, WinHTTP and WinINet. A, B and C stand for three of its adapters, with the example addresses 192.0.2.10, 198.51.100.10 and 203.0.113.10; V is the adapter of a VPN made with Windows' built-in client (SSTP). Other setups and other VPN clients can give other answers. lab, verified 2026-10-14

Chrome, Edge and Firefox follow the route to the internet; Windows follows the adapter order

  • Chrome and Edge ask the system which local address it would use to reach 8.8.8.8 or 2001:4860:4860::8888. Nothing is sent. Only when neither address has a route do they look up the computer’s own name, and then routes towards the private ranges. They skip loopback addresses, use 169.254.x.x and fe80:: addresses only as a last resort, prefer IPv4, and return 127.0.0.1 when nothing is found. Adapter type and adapter order play no part. The destination of the request does not matter either.
  • Firefox does the same with 8.8.8.8, with one difference. When the URL’s host is an IP address, it uses the route towards that address, so two requests from the same page can get two different answers. With the global pacUseMultihomedDNS = true in the script, it first looks up the host name and uses the route towards the result. That costs a DNS lookup on every call.
  • Windows (WinHTTP, and WinINet, which gave the same answers) did not follow the route in any test. With several addresses it returned the address of the first adapter in Windows' order, which is the order of the interface metric. It did so also when that adapter had no route to the internet at all.
  • pactester (pacparser) returns the first IPv4 address of the computer’s own name, or the address set with pactester -c.

No engine returned a 169.254.x.x address or 127.0.0.1 while the computer had a working address. A file that compares myIpAddress() with address ranges should still expect 127.0.0.1, because Chrome, Edge and Firefox return it when they find nothing else.

A VPN changes the answer differently in each engine

A VPN adds an adapter and changes the routes, and the engines react to different parts of that change. In the test with Windows’ built-in VPN client, a full tunnel moved every engine to the VPN address: the browsers because the tunnel took the route to the internet, and Windows’ own engine because Windows raised the interface metric of all other adapters while the tunnel was connected. With split tunnelling, the browsers kept the address of whichever adapter had the route to the internet, while Windows’ own engine kept the first adapter in its order. The two were not always the same adapter, so one split-tunnel VPN gave two different answers on the same computer. Firefox also returned the VPN address for a URL whose host was an IP address inside the networks the tunnel carried. Windows by default sends the whole class A, B or C network of the VPN address into the tunnel, so that can be more than the routes the VPN set up. Other VPN clients set routes and metrics in their own way, so these results are examples, not a rule for every VPN.

Changing the interface metric changes the answer in Windows, not in the browsers

In the test, a lower interface metric for an adapter changed what WinHTTP and WinINet returned at once. Chrome, Edge and Firefox kept returning the address of the adapter with the route to the internet. Their answer changes only when the metric change also moves the route to the internet to another adapter. That happens when two adapters have a default gateway, because Windows adds the interface metric to the route metric.

Windows 10 and 11 set the adapter order with the interface metric

Older Windows versions had an “Adapters and Bindings” tab (in ncpa.cpl, press Alt, then Advanced, then Advanced Settings). Windows 10 and 11 no longer have it. The order now comes from the interface metric, where a lower number comes first:

  • Settings dialog: open the adapter’s properties, then “Internet Protocol Version 4 (TCP/IPv4)” (or Version 6), then Properties, Advanced. Clear “Automatic metric” and enter a number.
  • PowerShell: Get-NetIPInterface | Sort-Object InterfaceMetric shows the order, and Set-NetIPInterface -InterfaceAlias "Wi-Fi" -InterfaceMetric 5 changes it. Set-NetIPInterface -InterfaceAlias "Wi-Fi" -AutomaticMetric Enabled goes back to the automatic value.
  • Registry: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{adapter GUID}\InterfaceMetric. In the test, a value written there took effect only after the adapter was disabled and enabled again. A change with Set-NetIPInterface took effect at once.

The old binding order in HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\Bind (and Tcpip6\Linkage\Bind) changed nothing in any engine: not at once, not after the adapters were disabled and enabled again. After a restart of Windows, WinHTTP and WinINet still returned the same address and listed the addresses in myIpAddressEx() in the same order. The automatic metric depends on the link speed, so it can change when an adapter reconnects at another speed.

pactester takes myIpAddress from the test machine's name

pactester (pacparser) works out the address from the name of the machine it runs on, so in a test the answer depends on that machine’s own setup, not on a user’s laptop. Set the client address explicitly in tests (pactester -c 10.20.1.5), or enter it as the client IP in the PAC file tester and compare the engine profiles.

Check how your own file behaves with the PAC file tester: switch the engine profile between Chromium, Firefox, pacparser and Windows and compare the trace. All engine differences are collected in pactester vs Chrome and Firefox.

Engine notes

EngineBehaviourSource
chromiumAsks the system which local address it would use towards 8.8.8.8 and 2001:4860:4860::8888, without sending anything. Only without such a route does it look up the computer's own name, then routes towards 10.0.0.0, 172.16.0.0, 192.168.0.0 and fc00::. Skips loopback addresses, uses link-local addresses only as a last resort, prefers IPv4, and returns 127.0.0.1 when nothing is found. Adapter type and order play no part.code, verified 2026-10-14
services/network/proxy_auto_config_library.cc@155.0.8059.77 MyIpAddressImpl
chromiumEdge 155 returned the address of the adapter with the route to the internet in every setup, for every destination, also when another adapter had a lower interface metric. With a full-tunnel VPN that was the VPN address, with split tunnelling the physical adapter's.lab, verified 2026-10-14
Windows 11 25H2
chromiumThe browser's own DNS client plays no part: the lookup of the computer's own name always asks the operating system, whether the built-in DNS client is on or off.code, verified 2026-10-15
services/network/proxy_auto_config_library.cc@155.0.8059.77 DoTestResolvingHostname (HostResolverSystemTask::CreateForOwnHostname); net/dns/host_resolver_system_task.cc@155.0.8059.77 (GetHostName, SystemHostResolverCall)
firefoxFor a host that is an IP address, the local address of the route towards it; otherwise the route towards 8.8.8.8 (with pacUseMultihomedDNS = true, towards the resolved host). Without such a route: the computer's own name, then routes towards 192.168.0.1 and 10.0.0.1, then 127.0.0.1. Does not look at the adapter type.code, verified 2026-10-14
netwerk/base/ProxyAutoConfig.cpp@FIREFOX_157_0_RELEASE MyIPAddress()
firefoxFirefox 157 returned the address of the route to the internet for host names, and the address of the matching adapter for IP-address hosts in a local network.lab, verified 2026-10-14
Windows 11 25H2
pacparserThe value set with setmyip() (pactester -c), else the first IPv4 address of the computer's own name; 127.0.0.1 when the name does not resolve. Routes and adapters are not looked at.code, verified 2026-10-14
src/pacparser.c@v1.5.3 my_ip()
winhttpDid not follow the route. With several addresses it returned the address of the adapter with the lowest interface metric, also when that adapter had no route to the internet. Never returned 169.254.x.x while another address existed. The service and the in-process mode gave the same answers. With a full-tunnel VPN from Windows' built-in client it returned the VPN address, because Windows raised the other adapters' interface metric while the tunnel was up; with split tunnelling it kept the first physical adapter.lab, verified 2026-10-14
Windows 11 25H2
wininetSame answers as WinHTTP in every setup (InternetGetProxyForUrl with an automatic configuration URL).lab, verified 2026-10-14
Windows 11 25H2

Availability

Derived from each engine's vendored helper library plus its native bindings (see engines).
Functionchromium
<=51
chromium
>=52
firefox
all
pacparser
<=1.4.6
pacparser
>=1.5.1
winhttp
11-25H2
wininet
11-25H2
reference
all
myIpAddressyesyesyesyesyesyesyesyes

Related rules

Frequently asked questions

Which address does myIpAddress() return on a computer with several network adapters?

It depends on the engine. Chrome, Edge and Firefox returned the address of the adapter with the route to the internet. Windows' own proxy engine (WinHTTP, WinINet) returned the address of the adapter with the lowest interface metric, even when that adapter had no route to the internet. pactester returns the first address of the computer's name. Measured on Windows 11 in October 2026; other setups can give other answers, so do not base routing decisions on it.

Does myIpAddress() return the VPN address or the physical address?

It depends on the engine and on how the VPN sets routes and metrics. In a test with Windows' built-in VPN client, a full-tunnel VPN gave the VPN address in Chrome, Edge, Firefox and Windows' own engine. With split tunnelling the browsers returned the adapter with the route to the internet and Windows' own engine the first adapter in its order, which were not always the same. Do not base routing decisions on it.

Does changing the interface metric change myIpAddress()?

In WinHTTP and WinINet it did, at once when changed with Set-NetIPInterface. In Chrome, Edge and Firefox it changes the answer only if it also moves the route to the internet to another adapter.

Where is the network adapter binding order in Windows 10 and 11?

The "Adapters and Bindings" tab is gone. The order now comes from the interface metric, set in the adapter's IPv4 or IPv6 properties under Advanced (clear "Automatic metric"), with Set-NetIPInterface -InterfaceMetric, or in the registry under Tcpip\Parameters\Interfaces\{GUID}\InterfaceMetric. The old Tcpip\Linkage\Bind list had no effect on myIpAddress() in the test, also not after a restart.

Why does myIpAddress return a different address in pactester than in Chrome?

pactester derives the address from the name of the machine running the test, while Chrome, Edge and Firefox use the address of the connection towards the internet. Set the expected address in tests with pactester -c, or enter it as the client IP in the tester at findproxyforurl.net/check/.

Last updated: