A command-line utility that reports your internet-facing public IP address. Queries multiple well-known free services with automatic fallback so you always get an answer even if a provider is down.
pip install publicipOr with uv:
uv tool install publicippublicip # print your public IP
publicip --verbose # include which provider responded
publicip --format json # JSON output
publicip --format json --verbose # JSON with provider field
publicip --provider ipify # force a specific provider
publicip --all # query all providers
| Name | Service |
|---|---|
ipify |
api.ipify.org |
icanhazip |
icanhazip.com |
identme |
4.ident.me |
seeip |
ipv4.seeip.org |
The default order is ipify → icanhazip → identme → seeip. The first successful response wins.
$ publicip
203.0.113.42
$ publicip --verbose
203.0.113.42 (via ipify)
$ publicip --format json --verbose
{"ip": "203.0.113.42", "provider": "ipify"}
$ publicip --all
203.0.113.42 (via ipify)
203.0.113.42 (via icanhazip)
203.0.113.42 (via ident.me)
203.0.113.42 (via seeip)Currently, publicip only returns your public IPv4 address. IPv6 is not supported. All configured providers are queried via their IPv4 endpoints.
IPv6 support is a planned future enhancement.
See CONTRIBUTING.md.
To report a vulnerability privately, see SECURITY.md.
MIT © Andre Van Klaveren