Find my IP address: public and local, on every platform
There are two answers to "what is my IP". The one your router presents to the internet, and the one your device has on the local network. Websites, including this one, can only see the first. Your operating system's commands only show the second.
From the command line
This site serves a plain-text endpoint for scripts, in the same spirit as ifconfig.me and icanhazip.com. It returns only the address, with a trailing newline, and does not log or store anything beyond ordinary web-server access logs.
curl ipconfig.co.uk/ip
curl -4 ipconfig.co.uk/ip # force IPv4
curl -6 ipconfig.co.uk/ip # force IPv6
curl ipconfig.co.uk/ip/json # {"ip": "...", "family": "IPv4", ...}
wget -qO- ipconfig.co.uk/ip
# without curl: ask a DNS server which address it sees you from
dig +short myip.opendns.com @resolver1.opendns.com
dig +short txt ch whoami.cloudflare @1.1.1.1curl ipconfig.co.uk/ip
curl -4 ipconfig.co.uk/ip
nslookup myip.opendns.com resolver1.opendns.com(Invoke-WebRequest -UseBasicParsing https://ipconfig.co.uk/ip).Content.Trim()
Invoke-RestMethod https://ipconfig.co.uk/ip/json
# alias: irm
irm ipconfig.co.uk/iphttps://ipconfig.co.uk/ip # plain text, IPv4 or IPv6 depending on how you connect
https://ipconfig.co.uk/ip/json # JSON with family, port and user agent
https://ipconfig.co.uk/ip/all # plain text with the same fieldsOther services doing the same job: ifconfig.me, icanhazip.com, ifconfig.co, api.ipify.org, checkip.amazonaws.com, ipinfo.io/ip. Use whichever you trust; the answers should agree.
Public vs local: why they differ
Almost every home and office network sits behind NAT (network address translation). Your router has one public address from your ISP. Every device inside has a private address (192.168.x.x, 10.x.x.x or 172.16–31.x.x) that the router rewrites on the way out. So ipconfig shows 192.168.1.42 while the internet sees 81.x.x.x. With IPv6 there is usually no NAT: the global address shown by ipconfig or ip -6 addr is the same one the internet sees, which is why the box above may match your local IPv6 address exactly.
Some ISPs put a second layer of NAT in their own network (carrier-grade NAT). The tell-tale sign is a router WAN address in 100.64.0.0/10 or in a private range, while the box above shows something else. In that case you cannot accept inbound connections (port forwarding, self-hosting) without asking the ISP for a real public address or using a tunnel.
Find your local IP address
ipconfig
ipconfig | findstr /i "IPv4"(Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.InterfaceAlias -notmatch 'Loopback' -and $_.PrefixOrigin -ne 'WellKnown' }).IPAddress
Get-NetIPConfiguration | Where-Object IPv4DefaultGateway | Select-Object -ExpandProperty IPv4AddressGraphically: Settings › Network & internet › Wi-Fi or Ethernet › the network › Properties, scroll to IPv4 address. Or click the network icon in the tray › Properties. Full ipconfig reference →
ipconfig getifaddr en0 # Wi-Fi on most Macs
ipconfig getifaddr en1
ifconfig | grep 'inet ' | grep -v 127.0.0.1
networksetup -getinfo "Wi-Fi"Graphically: System Settings › Wi-Fi › Details… next to the network, or System Settings › Network › the service. Holding Option while clicking the Wi-Fi menu-bar icon also shows it. Full macOS reference →
hostname -I # all addresses, space separated
ip -br addr
ip -4 -o addr show scope global | awk '{print $2, $4}'
ip route get 1.1.1.1 | awk '{print $7; exit}' # the source address used to reach the internet
nmcli -g ip4.address device show enp3s0GNOME: Settings › Network or Wi-Fi › gear icon. KDE: the network applet › Details. Full ip reference →
iPhone / iPad: Settings › Wi-Fi › (i) next to the network › IP Address. Mobile data addresses are not shown; use the box at the top of this page.
Android: Settings › Network & internet › Internet › gear icon next to the network › scroll to IP address. Or Settings › About phone › Status › IP address. Varies by manufacturer.
Log in to the router at its gateway address (the Default Gateway from ipconfig or ip route). The status page shows the WAN/Internet address, which is your public IP unless the ISP uses carrier-grade NAT, and the list of connected devices with their local addresses. Common router addresses →
Find another device's IP address on your network
arp -a # devices you have talked to recently, with MAC addresses
ping -a 192.168.1.10 # reverse-resolve a name
nslookup printer # if the router registers DHCP names
for /L %i in (1,1,254) do @ping -n 1 -w 100 192.168.1.%i | find "TTL=" # crude sweepip neigh # Linux
arp -an # macOS
sudo nmap -sn 192.168.1.0/24 # list live hosts with vendor from MAC
avahi-browse -art # Linux: mDNS services (.local names)
dns-sd -B _services._dns-sd._udp # macOS: Bonjour browse
ping mydevice.localThe router's DHCP client list is usually the fastest source, and it shows hostnames. Devices on Wi-Fi with "client isolation" enabled will not appear in ARP scans.
Find your MAC address
ipconfig /all # Windows: Physical Address
getmac /v # Windows
ip link # Linux: link/ether
cat /sys/class/net/enp3s0/address # Linux
ifconfig en0 | grep ether # macOS
networksetup -getmacaddress en0 # macOSPhones and macOS 15+ randomise the Wi-Fi MAC per network by default, so the address the router sees may differ from the hardware address printed in Settings › About.
Find your DNS servers
ipconfig /all | findstr /c:"DNS Servers" # Windows
Get-DnsClientServerAddress # PowerShell
resolvectl status # Linux (systemd-resolved)
cat /etc/resolv.conf # Linux (other)
scutil --dns | grep nameserver # macOSTo see which resolver actually answers your queries after all the layers (browser DoH, VPN, router forwarder), query a name that reports the resolver: dig +short whoami.akamai.net, or visit a DNS leak test site.