How to Check Your IP Address From Command Prompt
Knowing your IP address is one of those fundamental networking tasks that comes up more often than you'd expect — whether you're troubleshooting a connection, setting up a server, configuring a router, or just curious about how your machine appears on a network. The Command Prompt (and its equivalents on other operating systems) gives you a fast, reliable way to pull that information without opening a browser or digging through settings menus.
Here's what you actually need to know.
What Is an IP Address, and Why Does It Matter?
An IP address (Internet Protocol address) is a numerical label assigned to every device connected to a network. It serves two core functions: identifying the device and providing its location within the network so data can be routed correctly.
There are two types you'll encounter regularly:
- Private IP address — the address your device holds within your local network (home Wi-Fi, office LAN, etc.). This is what your router assigns.
- Public IP address — the address your network presents to the internet. Every device on the same home network typically shares one public IP.
Command Prompt commands primarily return your private/local IP address. Your public IP requires a different approach, covered below.
How to Check Your IP Address on Windows Using Command Prompt 💻
This is the most common use case. Open Command Prompt by pressing Windows + R, typing cmd, and hitting Enter. Then run one of the following commands:
The ipconfig Command (Standard Method)
ipconfig This returns a summary of all active network adapters on your machine. You'll see output grouped by adapter — typically Ethernet adapter and Wireless LAN adapter (Wi-Fi).
Look for:
- IPv4 Address — your local IP on the current network (e.g.,
192.168.1.105) - Subnet Mask — defines the size of your local network
- Default Gateway — usually your router's IP address
The ipconfig /all Command (Detailed Method)
ipconfig /all This expands the output to include additional information per adapter:
- Physical Address (MAC address) — unique hardware identifier for your network card
- DHCP Enabled — whether your IP is assigned automatically or set manually
- DNS Servers — the servers your machine uses for domain name resolution
- Lease information — when your DHCP-assigned IP was obtained and when it expires
If you're troubleshooting network issues or configuring software that needs precise network details, /all is the version to use.
Filtering Output With findstr
If you only want the IPv4 line and nothing else:
ipconfig | findstr "IPv4" This pipes the output through findstr and returns only lines containing "IPv4" — useful when you need a clean result fast.
IP Address Formats You'll Encounter
| Format | Example | What It Means |
|---|---|---|
| IPv4 | 192.168.1.105 | Standard 32-bit address, most common on local networks |
| IPv6 | fe80::a1b2:c3d4:e5f6:7890 | 128-bit address, increasingly common alongside IPv4 |
| Loopback | 127.0.0.1 | Points back to your own machine (not a network address) |
| APIPA | 169.254.x.x | Self-assigned when DHCP fails — signals a connection problem |
If you see a 169.254.x.x address where you expected a proper local IP, that's a diagnostic flag: your machine couldn't reach the DHCP server (usually your router) to get an assigned address.
Checking IP Address on macOS and Linux via Terminal 🖥️
ipconfig is Windows-specific. On macOS and Linux, the Terminal is your equivalent tool.
macOS:
ifconfig Look for the en0 (Wi-Fi) or en1 (Ethernet) section. Your IPv4 address follows the inet label.
A more targeted command on macOS:
ipconfig getifaddr en0 Linux:
ip addr show Or on older distributions:
ifconfig Your IP appears after inet within the relevant interface block (commonly eth0 for Ethernet, wlan0 for Wi-Fi).
How to Find Your Public IP From Command Line
Your local IP and public IP are different things. To find your public-facing IP from the command line:
Windows (PowerShell):
Invoke-WebRequest -Uri "https://api.ipify.org" | Select-Object -ExpandProperty Content macOS/Linux:
curl ifconfig.me These commands query an external service and return the IP address your traffic appears to originate from on the internet — which is your router's public IP, not your device's local address.
Variables That Affect What You See
The IP address returned by these commands isn't always the same across users, sessions, or setups. Several factors shape the output:
- DHCP vs. static configuration — If your IP is dynamically assigned, it may change when you reconnect to a network. Static IPs are manually set and don't change.
- VPN usage — An active VPN changes both your effective public IP and, depending on the VPN, may alter which adapter shows as primary.
- Multiple network adapters — Laptops, desktops with both Wi-Fi and Ethernet, and virtual machines (which create virtual adapters) all produce multiple entries in
ipconfigoutput. - IPv4 vs. IPv6 — Some networks assign both; others prioritize one. Which one your applications actually use depends on your OS settings and network configuration.
- Network environment — Corporate networks, home networks, mobile hotspots, and public Wi-Fi all assign addresses from different ranges and under different rules.
Reading the Output Correctly
A common point of confusion: ipconfig lists every network adapter, including disabled ones, virtual adapters from software like VirtualBox or VMware, and Bluetooth connections. If you're looking for your active connection specifically, match the adapter name to what you know is in use — for example, Wi-Fi if you're on wireless, or Ethernet if you're plugged in directly.
The presence of multiple IPs doesn't mean something is wrong. It means your machine has multiple interfaces, each with its own address on its respective network segment.
Your specific setup — operating system, network type, whether you're behind a VPN, and what you actually need the IP address for — determines which piece of this output is the relevant one for your situation.