LightAtom

How to Find Your IP Address on a Mac

Find your Mac's local IP (on your home network) and your public IP (what websites see), from System Settings or Terminal.

ipconfig getifaddr en0

Print the local IPv4 address of en0 (Wi-Fi on most Macs).

beginner2 min

When to use it

You need your local IP to connect other devices to your Mac (file sharing, a dev server, printers) or to set up port forwarding. You need your public IP for remote access, allow-lists and support requests.

Steps

  1. Local IP in System Settings

    Open System Settings › Network, click Wi-Fi (or your Ethernet adapter), then Details › TCP/IP. The IP Address field is your local address; Router is your gateway.
  2. Local IP in Terminal

    en0 is Wi-Fi on most Macs; Ethernet adapters are en1, en2 and so on. Nothing printed means that interface has no address.
    ipconfig getifaddr en0
  3. All addresses with ifconfig

    ifconfig lists every interface with its IPv4 (inet) and IPv6 (inet6) addresses.
    ifconfig en0 | grep inet
  4. Your public IP

    Websites see your router's public address, not your local one. Ask a service for it: curl -s https://api.ipify.org.
    dig +short txt ch whoami.cloudflare @1.1.1.1

Output explained

ipconfig getifaddr en0 prints just the address, such as 192.168.1.23.

ifconfig en0 shows more:

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether a6:c7:2b:7c:db:e4
	inet6 fe80::5f:daca:262:290f%en0 prefixlen 64 secured scopeid 0xe
	inet 192.168.1.23 netmask 0xffffff00 broadcast 192.168.1.255
	inet6 2001:db8:452b:8d00:dd9c:206e:79c:6f02 prefixlen 64 autoconf temporary
  • inet is the IPv4 address. netmask 0xffffff00 is 255.255.255.0 in hex, a /24.
  • inet6 fe80::… is the link-local IPv6 address every interface has.
  • inet6 … temporary is a privacy address macOS uses for outgoing IPv6 connections and rotates regularly.
  • ether is the MAC address; with Private Wi-Fi Address it's a random, locally administered one.

Options and variations

FlagMeaningExample
ipconfig getifaddr IFIPv4 address of one interfaceipconfig getifaddr en0
ipconfig getpacket IFDHCP details: address, router, DNS, lease timeipconfig getpacket en0
route -n get defaultWhich interface and gateway carry internet trafficroute -n get default
networksetup -getinfo SERVICEIP, subnet mask and router for a network servicenetworksetup -getinfo Wi-Fi

Common errors

ErrorCauseFix
ipconfig getifaddr en0 prints nothingen0 isn't your active interface, or it has no addressRun route -n get default to see the active interface, then use it.
Address starts with 169.254DHCP failed and macOS assigned itself a link-local addressRenew the DHCP lease or restart the router.

Do it in the app

LightAtom's Map starts every arc at your home location, taken from your time zone or set by you.

Frequently asked questions

How do I find my IP address on a Mac?

System Settings › Network › Wi-Fi › Details › TCP/IP shows your local IP. In Terminal, ipconfig getifaddr en0 prints it. For the public IP, run curl -s https://api.ipify.org.

What's the difference between my local and public IP?

The local IP (like 192.168.1.23) identifies your Mac on your home network. The public IP belongs to your router and is what websites see. Several devices share one public IP.

Is ipconfig the same as on Windows?

No. On a Mac, ipconfig is a different tool for DHCP and interface info (getifaddr, getpacket). The macOS equivalent of Windows ipconfig /all is ifconfig.

Which interface is Wi-Fi on my Mac?

Usually en0. Run networksetup -listallhardwareports to see each hardware port and its device name.

LightAtom team

The people who build LightAtom, a network monitor for macOS.