How to Find Your IP Address Using CMD (Command Prompt)

Whether you're troubleshooting a network issue, configuring a router, or setting up remote access, knowing how to find your IP address from the command line is a genuinely useful skill. CMD — Windows Command Prompt — gives you fast, reliable access to this information without digging through menus or settings panels.

What Is an IP Address, and Why Does It Matter?

An IP address (Internet Protocol address) is a numerical label assigned to every device on a network. It's how devices identify and communicate with each other. There are two types you'll commonly encounter:

  • Private IP address — the address assigned to your device within your local network (home, office, school). Your router manages these.
  • Public IP address — the address your entire network uses to communicate with the outside internet. This is assigned by your ISP.

CMD can quickly surface both, but through different methods.

How to Open Command Prompt

Before running any commands, you need to open CMD:

  1. Press Windows + R to open the Run dialog
  2. Type cmd and press Enter

Alternatively, search for "Command Prompt" in the Start menu. You don't need to run it as Administrator for basic IP lookups.

🖥️ Finding Your Private (Local) IP Address with ipconfig

The most commonly used command for this is ipconfig. Here's how to use it:

  1. Open Command Prompt
  2. Type ipconfig and press Enter

You'll see a list of network adapters — Wi-Fi, Ethernet, virtual adapters, etc. Look for the adapter you're currently using and find the IPv4 Address line.

Example output:

Wireless LAN adapter Wi-Fi: IPv4 Address. . . . . . . . . . . : 192.168.1.45 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 

Your IPv4 Address (e.g., 192.168.1.45) is your local IP. The Default Gateway is typically your router's IP address on the network.

Using ipconfig /all for Full Details

For more complete network information, use:

ipconfig /all 

This expanded output includes:

FieldWhat It Shows
Physical AddressYour device's MAC address
DHCP EnabledWhether IP is assigned automatically
IPv4 AddressYour local network IP
IPv6 AddressIPv6 format of your local address
DNS ServersWhich DNS servers your device queries
Lease Obtained/ExpiresHow long your DHCP-assigned IP is valid

This level of detail is especially useful when diagnosing connection issues, verifying DNS settings, or setting up static IP configurations.

Finding Your Public IP Address from CMD

CMD doesn't natively display your public IP, but you can pull it using a curl command — available by default on Windows 10 and 11:

curl ifconfig.me 

or

curl ipinfo.io/ip 

These commands query an external web service and return your public-facing IP address — the one websites and online services see when you connect.

⚠️ Note: If you're behind a VPN, proxy, or shared corporate network, the public IP returned will reflect that exit point — not your physical location or personal ISP address.

Using nslookup and ping for Network Context

While not direct IP-lookup tools, a couple of other CMD commands give useful context:

  • ping [hostname] — Resolves a domain name to its IP and tests connectivity. For example, ping google.com shows Google's server IP alongside latency data.
  • nslookup [domain] — Queries DNS to return the IP address(es) associated with a domain name. Useful for verifying DNS resolution or troubleshooting DNS-related issues.

These aren't for finding your IP — they're for finding the IP of remote hosts and testing how your machine resolves DNS.

Variables That Affect What You See

The results from ipconfig aren't the same for every user or every situation. A few factors shape what you'll find:

  • Connection type — Wi-Fi, Ethernet, and mobile hotspot connections each appear as separate adapters. If you're connected via multiple interfaces, you'll see multiple IP entries.
  • DHCP vs. static configuration — Most home users get a dynamically assigned IP from their router (DHCP). Businesses or server setups may use static IPs that don't change.
  • VPNs and virtual adapters — VPN software adds virtual network adapters, which appear in ipconfig output alongside real ones. This can make the list longer and harder to parse if you're not expecting it.
  • IPv4 vs. IPv6 — Modern networks often assign both. IPv4 addresses follow the familiar 192.168.x.x format; IPv6 addresses are longer and use hexadecimal notation. Some environments rely more heavily on one than the other.
  • Windows versioncurl support in CMD became standard with Windows 10 build 1803. Older systems may require PowerShell alternatives or third-party tools to retrieve a public IP from the command line.

🔍 What the Output Tells You — and What It Doesn't

A private IP like 192.168.1.45 only means something within your local network. It's not reachable from the internet, and it may change the next time your router reassigns addresses (unless you've set a DHCP reservation or static IP).

Your public IP, on the other hand, is what external servers log when you visit a website or connect to a remote service. It's shared by every device on your network unless each device has its own direct internet connection.

Understanding which of these two addresses you actually need — and why — depends entirely on the task in front of you. Configuring a local file share requires the private IP. Setting up remote access from outside your home requires the public one. Security auditing, port forwarding, and VPN setup each pull from different parts of this picture, and the right command to run follows from knowing what you're actually trying to accomplish.