How to Show Your IP Address in Command Prompt
Finding your IP address through Command Prompt is one of the most practical networking skills you can pick up — and it takes about ten seconds once you know the right command. But depending on what you're actually trying to accomplish, the command you use and the output you're looking for can vary quite a bit.
What Is an IP Address, and Why Does It Matter?
Your IP address (Internet Protocol address) is a numerical label assigned to your device on a network. It's how devices identify and communicate with each other — whether that's your laptop talking to your router, or your router connecting to the broader internet.
There are two types you'll regularly encounter:
- Private IP address — the address your device has on your local network (assigned by your router). This is what most people are looking for when they check via Command Prompt.
- Public IP address — the address your network presents to the outside internet. This is assigned by your ISP and is shared across all devices on your home or office network.
Command Prompt gives you fast access to both, depending on which command you run.
The Primary Command: ipconfig
On any Windows machine, the go-to command is ipconfig. Here's how to use it:
- Press Windows + R, type
cmd, and hit Enter (or search "Command Prompt" in the Start menu) - In the Command Prompt window, type:
ipconfig - Press Enter
The output will list your network adapters — Wi-Fi, Ethernet, virtual adapters, and more. Under each adapter, look for:
- IPv4 Address — your device's private IP on the local network (e.g.,
192.168.1.45) - IPv6 Address — the newer address format, increasingly common on modern networks
- Default Gateway — usually your router's IP address
Getting More Detail with ipconfig /all
If ipconfig gives you the overview, ipconfig /all gives you everything:
ipconfig /all This version surfaces additional information including your MAC address (physical hardware address), DNS servers, DHCP lease details, and whether your IP is dynamically assigned or static. This level of detail is particularly useful for troubleshooting network issues or configuring devices manually.
🖥️ Finding Your Public IP via Command Prompt
ipconfig only shows your private (local) IP. To find your public IP address from the command line, you'll need to query an external service. One reliable method uses PowerShell syntax but can be run in a Command Prompt window on modern Windows systems:
curl ifconfig.me Or if curl isn't available on your system:
nslookup myip.opendns.com resolver1.opendns.com The nslookup method queries OpenDNS's resolver, which returns your public-facing IP address. This works without installing any additional software.
On macOS and Linux: The Equivalent Commands
If you're working outside of Windows, the commands differ:
| Operating System | Private IP Command | Notes |
|---|---|---|
| Windows | ipconfig | Lists all adapters |
| macOS | ifconfig or ipconfig getifaddr en0 | en0 = Wi-Fi; en1 = Ethernet |
| Linux | ip addr or ifconfig | ifconfig may require net-tools package |
On Linux, ip addr show is the modern standard. The older ifconfig command is still widely used but isn't installed by default on some distributions.
🔍 Reading the Output: What to Look For
Command Prompt output can look cluttered at first. A few pointers:
- 192.168.x.x or 10.x.x.x addresses are private. You're on a local network and these don't appear to the outside internet.
- 169.254.x.x means your device couldn't get a DHCP address from the router — typically a sign of a connectivity problem.
- 127.0.0.1 is your loopback address — it refers to the device itself, not a network connection.
- Multiple adapters showing up (VPN adapters, virtual machine interfaces, Bluetooth) is normal on modern machines, especially developer setups.
When the Command Alone Isn't Enough
The command is simple. What gets more complex is knowing which IP address matters for your specific situation.
A home user troubleshooting a printer connection cares about the private IPv4 address. Someone configuring remote access needs the public IP. A developer running virtual machines might need to distinguish between real adapters and virtual ones. Someone setting up a static IP needs the subnet mask and gateway from ipconfig /all as well.
Network configuration also shifts the picture. Devices on dynamic (DHCP) networks get different IP addresses over time, which matters for tasks like port forwarding or remote desktop setup. Devices with static IPs stay consistent, but that requires manual configuration in your network settings.
The command itself is constant. What you do with the output — and which part of it answers your question — depends entirely on what you're trying to solve, the network environment you're in, and the device you're working with. 🌐