If you are curious about how to trace a mobile number and retrieve basic details such as location and carrier, Python offers some great tools. In this updated 2025 guide, we’ll walk through a beginner-friendly method using popular Python libraries and a real-world example.
Table of Contents
What You’ll Learn
- How to use the
phonenumbers
library to parse and locate numbers - Carrier identification
- Adding
geopy
to enhance location data - How to validate numbers worldwide
Updated for 2025
With Python 3.12, some improvements in speed and syntax make this process even smoother. This tutorial is fully compatible with Python 3.10 and above.
Prerequisites
pip install phonenumbers geopy
import phonenumbers
from phonenumbers import geocoder, carrier, timezone
# Mobile number (include country code)
number = "+919999999999"
# Parse number
parsed_number = phonenumbers.parse(number)
# Get basic information
print("\n[+] Country:", geocoder.description_for_number(parsed_number, "en"))
print("[+] Carrier:", carrier.name_for_number(parsed_number, "en"))
print("[+] Timezone:", timezone.time_zones_for_number(parsed_number))
# Check validity
print("[+] Valid Number:", phonenumbers.is_valid_number(parsed_number))
print("[+] Possible Number:", phonenumbers.is_possible_number(parsed_number))
Output Example
[+] Country: India
[+] Carrier: Airtel
[+] Timezone: (‘Asia/Kolkata’,)
[+] Valid Number: True
[+] Possible Number: True
Bonus: Add Real Address Info (Optional)
You can use geopy
to convert the city name to coordinates:
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="mobile_locator")
location = geolocator.geocode("India")
print("[+] Latitude:", location.latitude)
print("[+] Longitude:", location.longitude)
Final Thoughts
This method provides a quick way to get basic mobile number details for educational or app development purposes. Never use such tools for unethical or unauthorized tracking.
**If you liked this guide, share it and explore more at **pythonslearning.com