Guides
Last Updated Feb 13, 2024

How to Trace an IP Address

Elizabeth (Lizzie) Shipton

Table of Contents:

Get your free
API
key now
4.8 from 1,863 votes
See why the best developers build on Abstract
START FOR FREE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required
Get your free
IP Geolocation API
key now
4.8 from 1,863 votes
See why the best developers build on Abstract
START FOR FREE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required

Knowing a user’s IP address is incredibly useful for improving the user experience, debugging network issues, gathering demographic data, and understanding your customers. In this article, we’ll talk about what an IP address is, why you might want to track it, and how to track an IP address via an email, using the command prompt, or from your website or app.

Let’s send your first free
API
IP Geolocation API
call
See why the best developers build on Abstract
Get your free api

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:


123.456.789.1

IPv6 addresses look like this:


2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b

For the purposes of this article, we’ll be using IPv4 addresses.

Reasons for Tracking IP Addresses

From a business perspective, tracking a user’s IP address is useful for tailoring marketing efforts, improving the user experience, improving cyber security, preventing fraud, and law enforcement.

Marketing

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.

User Experience

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:

Cyber Security

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.

Law Enforcement

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.)

  1. Open Command Prompt
  2. Press the Windows key and “R.” Type “cmd” into the text box that appears. Click “OK.”
  3. Ping a Website You Want to Track
  4. Type “ping” into the command line, followed by the URL of a website.

$ ping google.com
PING google.com (64.233.185.102): 56 data bytes
64 bytes from 64.233.185.102: icmp_seq=0 ttl=108 time=74.376 ms
  1. Run “tracert” on the IP Address
  2. Type “tracert” and paste the IP address into the command line

$ tracert 64.233.185.102

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.

  1. Open the Options Menu: This is the three vertical dots at the top left corner of the email
  2. Open the Raw Email Data: Click “show original.”
  3. 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.

Get Started

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:

View Results

The API returns a JSON object with geographical data about the IP address:


{
    "ip_address": "xxx.xxx.xxx",
    "city": "Los Angeles",
    "city_geoname_id": 5368361,
    "region": "California",
    "region_iso_code": "CA",
    "region_geoname_id": 5332921,
    "postal_code": "000000",
    "country": "United States",
    "country_code": "US",
    "country_geoname_id": 6252001,
    "country_is_eu": false,
    "continent": "North America",
    "continent_code": "NA",
    "continent_geoname_id": 6255149,
    "longitude": -000.00,
    "latitude": 00.000,
    "security": {
        "is_vpn": false
    },
    "timezone": {
        "name": "America/Los_Angeles",
        "abbreviation": "PST",
        "gmt_offset": -8,
        "current_time": "11:55:57",
        "is_dst": false
    },
    "flag": {
        "emoji": "🇺🇸",
        "unicode": "U+1F1FA U+1F1F8",
        "png": "https://static.abstractapi.com/country-flags/US_flag.png",
        "svg": "https://static.abstractapi.com/country-flags/US_flag.svg"
    },
    "currency": {
        "currency_name": "USD",
        "currency_code": "USD"
    },
    "connection": {
        "autonomous_system_number": 9009,
        "autonomous_system_organization": "M247 Europe SRL",
        "connection_type": "Cellular",
        "isp_name": "M247 Ltd",
        "organization_name": "M247 Ltd"
    }
}

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.

Obtain Consent

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.

Ensure Accuracy

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.

Security

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.

VPN

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.

Proxy Server

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.

TOR Browser

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.

Conclusion

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.

FAQs

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.

4.9/5 stars (10 votes)

Elizabeth (Lizzie) Shipton
Lizzie Shipton is an adept Full Stack Developer, skilled in JavaScript, React, Node.js, and GraphQL, with a talent for creating scalable, seamless web applications. Her expertise spans both frontend and backend development, ensuring innovative and efficient solutions.
Get your free
IP Geolocation API
API
key now
Unlock the power of precise geolocation with Abstract's IP Geolocation API. Start enhancing your digital solutions today by signing up for a free trial and experience how easy it is to integrate and use!
get started for free

Related Articles

Get your free
API
IP Geolocation API
key now
4.8 from 1,863 votes
See why the best developers build on Abstract
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required