A Mac has two kinds of IP address, just like every other computer: a local IP that identifies it inside your home or office network, and a public IP that websites see. macOS lets you find the local one in System Settings or in Terminal, and the public one with any browser. This guide covers both on current and older macOS versions, explains the Terminal commands, and fixes the common problems — a 169.254 address, an IP that keeps changing, or a public address that does not look like yours.
Local IP vs public IP
| Local IP | Public IP | |
|---|---|---|
| Example | 192.168.1.12 | 203.0.113.42 |
| Visible to | Your own network only | The whole internet |
| Given by | Your router | Your internet provider |
| Found with | System Settings or Terminal | A website such as Show-IP.ir |
They are different on purpose: the router translates between them, as described in Private vs Public IP.
Find your public IP
Open the Show-IP.ir homepage in Safari, Chrome or any other browser. It shows the public IP, country, city, ISP and a security check for the connection you are using right now. In Terminal the same site returns only the address:
curl show-ip.ir
Find your local IP in System Settings
macOS Ventura (13) and newer
- Open the Apple menu → System Settings → Wi-Fi (or Ethernet).
- Click Details… next to the network you are connected to.
- Open the TCP/IP tab. IP address is your local IP, and Router is your gateway.
macOS Monterey (12) and older
- Apple menu → System Preferences → Network.
- Select Wi-Fi or Ethernet on the left; the IP address is shown on the right.
- For the router address and subnet mask, click Advanced… → TCP/IP.
A shortcut on many versions: hold Option and click the Wi-Fi icon in the menu bar — it lists the IP address and router.
Find your local IP in Terminal
Open Terminal (Spotlight → "Terminal") and use one of these:
ipconfig getifaddr en0 # local IP of en0 (Wi-Fi on most MacBooks)
networksetup -getinfo Wi-Fi # IP, subnet mask, router and MAC for Wi-Fi
ifconfig | grep "inet " # every IPv4 address on the Mac
route -n get default # gateway and the interface that uses it
The interface name matters. On most MacBooks Wi-Fi is en0, but on a Mac mini or iMac the wired port is often en0 and Wi-Fi is en1. If ipconfig getifaddr en0 prints nothing, try en1, or list every port with networksetup -listallhardwareports (look for "Hardware Port: Wi-Fi" and its "Device:" line).
Output of ifconfig | What it is |
|---|---|
lo0 — 127.0.0.1 | Loopback, not your network address |
en0 / en1 | Wi-Fi and Ethernet |
utun… | VPN and system tunnels |
bridge…, awdl0 | Virtual bridges and AirDrop; ignore them |
Troubleshooting
The IP starts with 169.254
That is a self-assigned address: the Mac asked the router for an address and got no reply, so it works only locally and has no internet. Turn Wi-Fi off and on, restart the router, then in Details… → TCP/IP click Renew DHCP Lease. Still stuck? Check that the router's DHCP server is on (router login guide).
The IP keeps changing
On recent macOS versions each Wi-Fi network has a Private Wi-Fi address setting (Fixed, Rotating or Off). When the hardware address changes, the router sees a new device and may hand out a new local IP. Setting it to Fixed for your home network, or giving the Mac a DHCP reservation in the router, keeps the address stable. More on the link between the two in IP vs MAC address. If it is the public IP that changes, see static vs dynamic IP.
The public IP in Safari looks wrong
If you have iCloud+ with Private Relay turned on, Safari sends its traffic through Apple's relay, so websites — including Show-IP.ir — see a relay address and a rough location instead of your real ones. Chrome or Terminal may show a different address for the same reason. A VPN has the same effect (how a VPN changes your IP).
Frequently asked
Why is my Mac's IP different from the one Show-IP.ir shows?
Because one is private to your network and the other is the single public address your router shares among all devices. That is expected.
Can I find my IP without Wi-Fi?
A local IP exists as soon as you have any network link (Ethernet, a hotspot). Without a connection there is no usable IP and no public address at all.
Do I need Terminal at all?
No. System Settings and the browser cover everyday needs. Terminal is useful for scripts, remote sessions and quick checks.
Key takeaways
- Public IP: open Show-IP.ir or run
curl show-ip.ir. - Local IP: System Settings → Wi-Fi/Ethernet → Details… → TCP/IP, or
ipconfig getifaddr en0. - If
en0prints nothing, tryen1or runnetworksetup -listallhardwareports. - 169.254.x.x means no DHCP reply: renew the lease or restart the router.
- Private Relay or a VPN can make the public IP differ from your real connection.