Sometimes you may need to know your public IPv4 address. If you have an open browser window you may go to or to However, I prefer the latter for two reasons:

  1. It has a cleaner and simpler interface: it just shows your IP address.
  2. Has a script friendly version: which just prints your IP in text/plain.

So to get your public IP address from a shell:

$ IP=$(curl -s


$ IP=$(wget -qO -

Unfortunately, neither of the above mentioned sites work for IPv6 addresses.