Your address
Looking up your address
IPv4 address
Your browser asks commandguide.com which address your request came from, and if that's IPv6, it also asks Cloudflare's 1.1.1.1 for your IPv4 address. Both answers are shown here and not saved. On a VPN, through a proxy or with iCloud Private Relay, you'll see that service's address instead of your own.
From a terminal
These print your public address and nothing else, so they work in scripts too.
Linux and macOS
curl -s https://commandguide.com/cdn-cgi/trace | grep '^ip=' | cut -d= -f2
Only your IPv4 address
curl -4 -s https://commandguide.com/cdn-cgi/trace | grep '^ip=' | cut -d= -f2
Only your IPv6 address
curl -6 -s https://commandguide.com/cdn-cgi/trace | grep '^ip=' | cut -d= -f2
Windows PowerShell
((Invoke-RestMethod https://commandguide.com/cdn-cgi/trace) -split "`n" | Where-Object { $_ -like 'ip=*' }) -replace '^ip='
If your connection has both, the first command usually prints the IPv6 address, because computers prefer IPv6 when they can use it. In Windows PowerShell 5.1, curl is a different command, so type curl.exe to use the Linux-style commands. -4 and -6 only work if your connection has that kind of address.
Public and private addresses
At home or in an office, your devices usually have private addresses, such as 192.168.1.20, and share one public address through the router, using NAT. This page shows the public one. To see your device's own address, use the commands in Networking: Your connection.
If the address starts with 100.64 to 100.127, your provider is sharing it between customers (carrier-grade NAT), so it isn't really yours and you can't forward ports to it. Your public address can also change when your router restarts unless you pay for a static one.
To work out the network an address belongs to, try the subnet calculator.