What is an IP Address?
An IP address (Internet Protocol Address) is a unique string of characters assigned by your ISP (Internet Service Provider) used to identify network requests. Every device connected to the internet has an IP address - in fact, it has several IP addresses that serve different purposes.
A public IP address functions like a home address for a device. This IP address is where other devices connected to the internet send information like web pages or file transfers. A device also has a private IP address used to identify it to a local network like a LAN or WiFi router.
IPv6 vs IPv4
There are two types of IP address: IPv4 and IPv6. Both serve the same purpose (identifying devices to the network) but their structure is slightly different. IPv6 addresses are more modern and able to handle a greater number of devices.
IPv4 addresses are 32bits, while IPv6 are 128 bits. This means that IPv6 addresses can account for 1028 times more devices than IPv4 addresses.
While devices these days have both IPv6 and IPv4 addresses, IPv4 addresses are more commonly referenced than IPv6 addresses because they are shorter and easier to work with. IPv4 addresses look like this:
IPv6 addresses look like this:
For the purposes of this article, we’ll be using IPv4 addresses.
Reasons for Tracking IP Addresses
IP geolocation allows you to run tailored marketing and ad campaigns that target users in different regions. For example, you might have a brick and mortar store in Oklahoma City that is currently having a sale. It wouldn’t make sense to send an email about this to your customers in New York.
Knowing where your users are in the world means you can serve them localized content when they visit your app or website. This can include language translations, currency conversions, culturally-aware imagery, and more.
For example, Slack serves the following localized content to users in the US versus users in Germany:
E-commerce sites, banks, and other financial institutions can use IP address tracking to prevent fraudulent transactions in specific geographic regions, or to verify that transactions are coming from expected locales.
For example, if you live in California and your credit card is charged for an Amazon purchase with an IP address that originated in Brazil, Amazon can quickly flag this transaction as potentially fraudulent and alert you.
Its’ not just online security that can be improved with IP tracking. Emergency services in the real world can use IP address geolocation to improve their response times by quickly identifying the region from which an emergency call originated.
How to Trace an IP Address Using Command Prompt
Get started with IP address tracking using the command prompt or command line. These steps will show you how to identify the IP address from which an incoming network request to your machine was sent. (Note, this is for Windows, not Mac.)
- Open Command Prompt
- Press the Windows key and “R.” Type “cmd” into the text box that appears. Click “OK.”
- Ping a Website You Want to Track
- Type “ping” into the command line, followed by the URL of a website.
- Run “tracert” on the IP Address
- Type “tracert” and paste the IP address into the command line
Tracing an IP Address from Email Header
Sometimes it’s useful to see where emails are coming from - particularly if you run an email list. Follow these steps to find the IP address from an incoming email in Gmail.
- Open the Options Menu: This is the three vertical dots at the top left corner of the email
- Open the Raw Email Data: Click “show original.”
- Find the IP Address: In the raw email data, there will be several IP addresses. You are looking for the “Received: from” address
Once you’ve tracked an IP address using either of these methods, you can use an IP lookup tool like AbstractAPI’s Free Geolocation API to get geographical information about the IP address.
Can You Track a Phone’s IP Address?
A mobile device has an IP address just like a computer. It doesn’t matter what type of device sent the request, the IP address will still appear in the request headers. If you’d like to figure out what your own phone’s IP address is, check out this article.
Enhancing IP Tracking with IP Geolocation API
To find the actual geographic location of an IP address, you need to use a geolocation service like an API. A geolocation API compares the IP address against a geolocation database to determine the region the address belongs to.
Let’s look at an example of this using AbstractAPI’s Free Geolocation API.
Navigate to the API homepage and click “Get Started.”
You’ll need to log in or sign up for a free account using your email address and a password. You’ll be taken to a dashboard where you’ll see a testing sandbox and links to documentation and pricing.
Send a Test Request
Inside the testing sandbox, you’ll see a CURL command to send a test request to the API. The command already includes the IP address of your device. To geolocate another IP address, delete the existing IP address and paste the new address in its place:
The API returns a JSON object with geographical data about the IP address:
The Legality of IP Address Tracking
Tracing an IP address is perfectly legal as long as you are not using the location of the IP address for criminal activities. An IP address can’t give you an exact location for a user: it only gives you a radius. You can get location data as specific as a country, state, and zip code, but you cannot look up a user’s name, telephone number, or home address.
That being said, there are a few best practices to consider if you are using user’s IP addresses to do targeted marketing or serve localized content.
Users must opt-in to sharing their location data before their IP address information can be used. Respect user privacy and ensure you are abiding by all data privacy laws. Do not share sensitive user data with third parties without user consent.
Make sure the IP to geolocation service you use is up to date and returning accurate information. Outdated or incorrect data can cause a confusing user experience or even lead to data leaks and hacks.
Protect your users’ sensitive data. Implement and maintain robust cyber security measures to protect both your users and your system from breaches.
How to Hide Your IP Address
As a user, hiding your IP address can be a good way to ensure your online privacy or gain access to content or services that may not be available in your geographic region. There are three primary ways to do this: a VPN (Virtual Private Network), proxy server, or TOR browser.
Using a VPN to hide your IP is the quickest and easiest way to do it. Simply download the VPN app (some good options are ExpressVPN, NordVPN, Windscribe, and CyberGhost) and install it on your device.
Editor's note: You can use Abstract to detect if someone's IP addres is using an VPN
Any time you want to hide your IP, simply turn on the VPN. You’ll be given a choice of what server you want to use to hide your address - if you are using the VPN to gain access to geofenced content, choose a server within the region you are trying to access.
A proxy server is very similar to a VPN in that it re-routes your internet traffic through a remote server, obscuring your real IP address. The difference between a VPN and a proxy server is that a VPN encrypts your internet connection as well as masking your IP, while a proxy server only masks your IP.
The TOR browser is a freely downloadable internet browser that you can use instead of Chrome, Safari, or Edge. It automatically hides your IP address anytime you go online. The one drawback to this method is that the browser is quite slow.
An IP address is a string of unique characters used to identify a computer or mobile device to the internet. Tracing an IP address is the process of figuring out what the IP address of a network request was.
Once you’ve determined the IP address from which a request was sent, you can use an API or enter the address into an IP lookup tool to get geographical location data for the device.
This location data can be used to serve localized content, run targeted marketing campaigns, improve emergency service response times, and bolster online security.
As a user, if you’d like to maintain your online privacy by obscuring your IP address, you can do this by using a VPN, proxy server, or the TOR browser.
Can tracking an IP address reveal personal information about an individual?
IP addresses can provide generalized location data, such as the city or region, but they do not directly reveal personal information like names or exact addresses. Privacy laws and ISP policies protect users' personal data, making it inaccessible through IP tracking alone.
How often do IP addresses change, and what causes these changes?
IP addresses can change for a few reasons, such as restarting your router, moving to a different location, or changes made by your ISP. The frequency of change depends on whether the IP is dynamic, often changing, or static, which remains the same unless manually altered.
Are IP addresses unique to each device, and can two devices share an IP address?
On a home network, each device has a unique private IP address, but all devices share a single public IP address when accessing the internet. In larger networks, like corporate environments, IP management strategies may vary to accommodate more devices.