Skip to main content

whatismyip

Fetch your public IP address from external sources with Python.

Install with pip install whatismyip

Example:

>>> import whatismyip
>>> whatismyip.amionline()
True
>>> whatismyip.whatismyip()
'69.89.31.226'
>>> whatismyip.whatismyipv4()
'69.89.31.226'
>>> whatismyip.whatismyipv6()
'2345:0425:2CA1:0000:0000:0567:5673:23b5'
>>> whatismyip.whatismylocalip()  # Returns local IPs of all network cards.
('192.168.189.1', '192.168.220.1', '192.168.56.1', '192.168.1.201')
>>> whatismyip.whatismyhostname()
'GIBSON'

On average these ip-finding functions take about half a second to run. Your results may vary.

Because whatismyip relies on online services, you always want to update to the latest version. This module uses calendar versioning, such as version 2024.2.20 for the version released on February 20, 2024.

How Does whatismyip Work?

There are several public STUN (Session Traversal Utilities for NAT) servers (listed in the whatismyip.STUN_SERVERS variable, in order of response speed) that return your IP address (as it appears to them). There are also several public websites that you can view in your browser (listed in whatismyip.IP4_WEBSITES, whatismyip.IP6_WEBSITES, and whatismyip.IP_WEBSITES):

The whatismyip module does not have any dependencies outside the Python standard library. It does not require Requests to be installed.

Support

If you find this project helpful and would like to support its development, consider donating to its creator on Patreon.

Release files for WhatIsMyIP 2026.5.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for WhatIsMyIP 2026.5.22
File Size Uploaded
whatismyip-2026.5.22.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for WhatIsMyIP 2026.5.22
File Interpreter ABI Platform
whatismyip-2026.5.22-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / whatismyip-2026.5.22.tar.gz

Download URL whatismyip-2026.5.22.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7e764fcc23afea4622f69992ac7015bed4e514773c7047ebd0afc1c421e79465
BLAKE2b-256 checksum
How to use checksums
3280a2885b9235029b8b5cfbe9457f8d365cd48d0f0b33307fbc5eb484813cbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / whatismyip-2026.5.22-py3-none-any.whl

Download URL whatismyip-2026.5.22-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
955563cfe03264c8f2bc361f592123443bbec0a3c4d2f18ae37830f0dc50d126
BLAKE2b-256 checksum
How to use checksums
93e0835571ca502ddb4a0c02d55d16fca999454a4686aee5c6f55adb55f788bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

2026.5.22 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page