IP Addresses Explained: IPv4 vs IPv6 and What Developers Need to Know
Every device that connects to the internet — your laptop, your phone, a cloud server, even a smart thermostat — needs a unique identifier to send and receive data. That identifier is called an IP address (Internet Protocol address). Despite being one of the most fundamental building blocks of networking, many developers only have a surface-level understanding of how IP addresses work, why we are running out of them, and what IPv6 actually changes.
In this guide, we will break down everything you need to know about IP addresses — from the basics of IPv4 and IPv6 to private ranges, special addresses, and practical considerations for development. Whether you are configuring a server, debugging network issues, or designing a microservices architecture, a solid understanding of IP addressing is essential. Along the way, you can use the IP Address Lookup tool to explore real-world IP data.
What is an IP Address?
An IP address is a numerical label assigned to every device participating in a computer network that uses the Internet Protocol for communication. Think of it as a postal address for the digital world — without it, data packets would have no way of knowing where to go or where they came from.
The Internet Protocol defines how data is broken into packets, addressed, transmitted, routed, and received. IP addresses serve two primary functions:
- Network identification: They identify which network a device belongs to, enabling routers to forward packets toward the correct destination network.
- Host identification: Within a network, they pinpoint the specific device (host) that should receive the data.
IP addresses are managed globally by the Internet Assigned Numbers Authority (IANA), which delegates blocks to five Regional Internet Registries (RIRs) around the world. These registries then allocate addresses to ISPs, enterprises, and other organizations. There are two versions of the Internet Protocol in active use today: IPv4 and IPv6.
IPv4 Explained
IPv4 (Internet Protocol version 4) was introduced in 1981 as part of RFC 791 and has been the workhorse of the internet for over four decades. It uses a 32-bit address space, meaning each address is a sequence of 32 binary digits (ones and zeros).
IPv4 addresses are written in dotted-decimal notation — four decimal numbers (called octets) separated by dots. Each octet represents 8 bits and ranges from 0 to 255:
# IPv4 주소 형식
192.168.1.1
# 2진수 표현
11000000.10101000.00000001.00000001
# 각 옥텟은 8비트, 총 32비트
[192].[168].[1].[1]
[8bit].[8bit].[8bit].[8bit] = 32bitWith 32 bits, IPv4 can produce a maximum of 2^32 = 4,294,967,296 unique addresses — roughly 4.3 billion. That may sound like a lot, but considering there are over 8 billion people on Earth and each person may own multiple connected devices, the math does not work out. This limitation is known as IPv4 address exhaustion.
IANA officially exhausted its pool of unallocated IPv4 address blocks in February 2011. Since then, the five RIRs have progressively run out of their remaining allocations. Today, new IPv4 addresses are extremely scarce and are often acquired through secondary markets at significant cost. Technologies like NAT (Network Address Translation) and CGNAT (Carrier-Grade NAT) have extended the life of IPv4, but they introduce complexity and limitations that IPv6 was designed to solve.
IPv6 Explained
IPv6 (Internet Protocol version 6) was developed in the 1990s as the long-term successor to IPv4. Defined in RFC 8200, it uses a 128-bit address space — four times the bit length of IPv4. This exponential increase means the total number of possible addresses is 2^128 ≈ 3.4 × 10^38 — a number so large it could assign a unique address to every atom on the surface of the Earth and still have addresses left over.
IPv6 addresses are written as eight groups of four hexadecimal digits, separated by colons:
# IPv6 전체 표기법
2001:0db8:85a3:0000:0000:8a2e:0370:7334
# 선행 0 생략 가능
2001:db8:85a3:0:0:8a2e:370:7334
# 연속된 0 그룹은 ::로 축약 (한 번만 사용 가능)
2001:db8:85a3::8a2e:370:7334
# 루프백 주소 축약
0000:0000:0000:0000:0000:0000:0000:0001
→ ::1The abbreviation rules make IPv6 addresses more manageable. You can omit leading zeros within each group, and a single contiguous sequence of all-zero groups can be replaced with ::. However, the :: shorthand can only appear once in an address to avoid ambiguity.
Beyond the massive address space, IPv6 brings several architectural improvements:
- No NAT required: Every device can have a globally unique address, simplifying end-to-end connectivity and eliminating NAT traversal headaches.
- Built-in IPsec: IPv6 was designed with mandatory security support, although in practice IPsec remains optional in most implementations.
- Simplified header: The IPv6 header is fixed at 40 bytes with a streamlined structure, making router processing more efficient.
- Stateless address autoconfiguration (SLAAC): Devices can automatically configure their own IPv6 addresses without a DHCP server.
IPv4 vs IPv6 Comparison
The following table summarizes the key differences between the two protocol versions:
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Size | 32 bits | 128 bits |
| Notation | Dotted decimal (192.168.1.1) | Colon hexadecimal (2001:db8::1) |
| Total Addresses | ~4.3 billion | ~3.4 × 10^38 |
| Header Size | 20–60 bytes (variable) | 40 bytes (fixed) |
| NAT Required | Yes (commonly used) | No (end-to-end connectivity) |
| Security | IPsec optional | IPsec built-in support |
| Auto-configuration | DHCP required | SLAAC + optional DHCPv6 |
| Fragmentation | By sender and routers | By sender only |
| Broadcast | Supported | Replaced by multicast |
Despite IPv6 being technically superior, the transition has been gradual. As of 2026, roughly 45% of global internet traffic uses IPv6, with adoption varying widely by country and provider. Most modern operating systems and cloud platforms support dual-stack configurations, running IPv4 and IPv6 simultaneously.
IP Address Classes
Before CIDR (Classless Inter-Domain Routing) was introduced in 1993, IPv4 addresses were organized into five fixed classes. While classful addressing is largely historical, it is still referenced in certification exams, documentation, and legacy systems. Understanding classes helps you appreciate why modern CIDR notation exists.
| Class | First Octet Range | Default Subnet | Networks | Hosts per Network | Purpose |
|---|---|---|---|---|---|
| A | 1–126 | 255.0.0.0 (/8) | 128 | 16,777,214 | Large organizations |
| B | 128–191 | 255.255.0.0 (/16) | 16,384 | 65,534 | Medium organizations |
| C | 192–223 | 255.255.255.0 (/24) | 2,097,152 | 254 | Small organizations |
| D | 224–239 | N/A | N/A | N/A | Multicast |
| E | 240–255 | N/A | N/A | N/A | Experimental / Reserved |
The classful system was inherently wasteful. A Class B network provided over 65,000 host addresses — far more than most organizations needed — while a Class C network with only 254 hosts was often too small. This inefficiency was a major driver behind the development of CIDR and variable-length subnet masking (VLSM), which allow arbitrary prefix lengths. Use the Subnet Calculator to experiment with different CIDR blocks and see exactly how many hosts each prefix provides.
Private vs Public IP Ranges
Not all IP addresses are routable on the public internet. RFC 1918 defines three blocks of IPv4 addresses reserved for private use — meaning they can be freely used within local networks but are not forwarded by internet routers:
| Range | CIDR | Class | Total Addresses |
|---|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | A | 16,777,216 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | B | 1,048,576 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | C | 65,536 |
These private ranges are used everywhere — in your home Wi-Fi, corporate intranets, cloud VPCs, Docker networks, and Kubernetes clusters. When devices on a private network need to access the public internet, a router performs NAT (Network Address Translation), mapping private addresses to a shared public IP address.
Public IP addresses, on the other hand, are globally unique and routable across the internet. Your ISP assigns a public IP to your router, and web servers have public IPs so that anyone can reach them. You can check your current public IP address using the IP Address Lookup tool, which also shows geolocation, ISP, and AS number information.
Tip:NAT is the reason multiple devices on your home network can share a single public IP. Your router keeps a translation table that maps each internal device's private IP and port to the shared public IP. While effective, NAT can complicate peer-to-peer connections, VoIP, and certain gaming protocols — problems that IPv6 eliminates entirely.
Special IP Addresses
Several IP addresses have special meanings defined by various RFCs. As a developer, you will encounter these regularly:
127.0.0.1 — Localhost (IPv4)
The entire 127.0.0.0/8 block (127.0.0.0 – 127.255.255.255) is reserved for loopback. Traffic sent to any address in this range never leaves the host machine — it is routed back internally. The most commonly used address is 127.0.0.1, universally known as localhost. Developers use it daily to access local web servers, databases, and services during development.
0.0.0.0 — Unspecified Address
The address 0.0.0.0 has different meanings depending on context. When a server binds to 0.0.0.0, it listens on all available network interfaces — not just localhost. This is important when running services inside Docker containers, as binding to 127.0.0.1 would make the service unreachable from outside the container. In routing tables, 0.0.0.0/0 represents the default route — the catch-all destination for packets that do not match any more specific route.
255.255.255.255 — Limited Broadcast
This is the limited broadcast address. Packets sent to 255.255.255.255 are delivered to all devices on the local network segment. Unlike directed broadcasts (which target a specific subnet), limited broadcasts are never forwarded by routers. This address is used by protocols like DHCP during the initial discovery phase, when a client does not yet have an IP address and needs to find a server.
::1 — Localhost (IPv6)
The IPv6 equivalent of 127.0.0.1 is ::1 (fully written as 0000:0000:0000:0000:0000:0000:0000:0001). It functions identically — traffic to ::1 never leaves the host. Similarly, :: (all zeros) is the IPv6 unspecified address, analogous to 0.0.0.0 in IPv4.
# 주요 특수 IP 주소 요약
127.0.0.1 # IPv4 루프백 (localhost)
0.0.0.0 # 모든 인터페이스 바인딩 / 기본 라우트
255.255.255.255 # 제한 브로드캐스트
::1 # IPv6 루프백 (localhost)
:: # IPv6 미지정 주소
fe80::/10 # IPv6 링크-로컬 주소 (자동 설정)
fc00::/7 # IPv6 고유 로컬 주소 (사설 IP와 유사)IP Addresses in Development
Understanding IP addresses is not just an academic exercise — it directly impacts how you build, deploy, and debug applications. Here are the most common scenarios where IP knowledge matters.
Server Binding
When starting a web server, you choose which address to bind to. Binding to 127.0.0.1 restricts access to the local machine only — ideal for development. Binding to 0.0.0.0 accepts connections from any network interface — necessary for production servers and containerized applications.
# Node.js — 로컬 전용 (개발용)
app.listen(3000, '127.0.0.1');
# Node.js — 모든 인터페이스 (프로덕션/Docker용)
app.listen(3000, '0.0.0.0');
# Python Flask
flask run --host=0.0.0.0 --port=5000CORS and Origin Checking
Browsers enforce Cross-Origin Resource Sharing (CORS) based on the origin, which includes the protocol, hostname, and port. During local development, http://localhost:3000 and http://127.0.0.1:3000 are considered different origins, even though they resolve to the same address. This subtle distinction can cause unexpected CORS errors if your API whitelist includes one but not the other.
Reverse Proxies and X-Forwarded-For
In production, applications typically sit behind load balancers or reverse proxies (Nginx, AWS ALB, Cloudflare). The proxy terminates the client connection, so your application sees the proxy's IP as the source address — not the actual client IP. The real client IP is passed via the X-Forwarded-For HTTP header. Correctly parsing this header is critical for rate limiting, geolocation, access logging, and fraud detection.
# X-Forwarded-For 헤더 형식
X-Forwarded-For: <클라이언트>, <프록시1>, <프록시2>
# 실제 예시 — 왼쪽이 원본 클라이언트 IP
X-Forwarded-For: 203.0.113.50, 70.41.3.18, 150.172.238.178Use the HTTP Header Parser to inspect and analyze HTTP headers including X-Forwarded-For, X-Real-IP, and other proxy-related headers.
DNS Resolution and /etc/hosts
Domain names are human-friendly aliases for IP addresses. When your application makes a network request, the operating system resolves the hostname to an IP address via DNS. You can override this resolution locally using the /etc/hosts file (or C:\Windows\System32\drivers\etc\hosts on Windows). This is commonly used to:
- Test against a staging server by pointing a production domain to a staging IP
- Block unwanted domains by routing them to 127.0.0.1
- Set up custom local domains for development (e.g., myapp.local → 127.0.0.1)
# /etc/hosts 예시
127.0.0.1 localhost
127.0.0.1 myapp.local
192.168.1.50 staging.example.com
::1 localhostCheck Your IP with BeautiCode
Now that you understand the theory behind IP addresses, put your knowledge to work with BeautiCode's networking tools — all free and processed entirely in your browser.
- IP Address Lookup — Enter any IPv4 or IPv6 address to get geolocation, ISP, AS number, timezone, and more. You can also check your own public IP address instantly.
- Subnet Calculator — Input a CIDR block and get the network address, broadcast address, usable host range, subnet mask, and wildcard mask. Perfect for planning VPC subnets or debugging network configurations.
- HTTP Header Parser — Paste raw HTTP headers to parse and analyze them. Useful for inspecting X-Forwarded-For, Content-Type, caching directives, and security headers.
All tools run client-side, so your data never leaves your device. No sign-up required, no data stored on our servers.
Frequently Asked Questions
What is the main difference between IPv4 and IPv6?
The most fundamental difference is the address size. IPv4 uses 32-bit addresses, providing about 4.3 billion unique addresses — not enough for today's connected world. IPv6 uses 128-bit addresses, offering approximately 3.4 × 10^38 addresses, which is effectively unlimited. Beyond the address space, IPv6 also introduces a simplified header structure, built-in IPsec support, stateless address autoconfiguration (SLAAC), and eliminates the need for NAT.
How do I find my public IP address?
The simplest way is to use an online tool like the BeautiCode IP Address Lookup. You can also use command-line methods: curl ifconfig.me or curl api.ipify.org will return your public IP. On Windows, you can run nslookup myip.opendns.com resolver1.opendns.com. Note that your public IP is assigned by your ISP and may change periodically unless you have a static IP.
Can a device have both an IPv4 and IPv6 address?
Yes. This is called a dual-stack configuration and is the most common transition strategy. When dual-stack is enabled, a device has both an IPv4 address and one or more IPv6 addresses simultaneously. The operating system and applications choose which protocol to use based on DNS responses and configured preferences. Most modern operating systems (Windows, macOS, Linux) support dual-stack out of the box.
Why does my Docker container not respond when bound to 127.0.0.1?
When a server inside a Docker container binds to 127.0.0.1, it only accepts connections from within the container itself — the container's loopback interface is isolated from the host. To make the service accessible from outside the container, bind to 0.0.0.0 instead, which listens on all network interfaces including the Docker bridge network. Then use Docker's -p flag to map the container port to a host port.
Are IPv4 addresses really running out?
Yes. IANA exhausted its free pool of IPv4 address blocks in 2011, and all five Regional Internet Registries have since exhausted their primary pools. New IPv4 addresses are now obtained primarily through secondary markets, where organizations buy unused blocks from others. Prices have risen steadily, with individual IPv4 addresses trading for $30–$60 or more. Technologies like NAT and CGNAT extend the usability of existing IPv4 addresses, but they add complexity, latency, and limitations. The long-term solution is IPv6 adoption, which continues to grow steadily — major cloud providers, mobile networks, and content delivery networks already support it natively.
Related Articles
How to Generate Secure Passwords in 2026: A Complete Guide
Learn why strong passwords matter and how to generate secure passwords using entropy, length, and complexity. Includes practical tips and free tools.
2026-03-23 · 8 min readData FormatsJSON vs YAML: When to Use What — A Developer's Guide
Compare JSON and YAML formats with syntax examples, pros and cons, and use case recommendations for APIs, configs, and CI/CD pipelines.
2026-03-23 · 10 min read