IP Address Formats: Decimal, Binary, Hex, and How to Convert
Understand every IP address format, learn step-by-step conversions, and see why each representation matters in real networking.
TL;DR — Key Takeaways
- Dotted-decimal is the human-friendly IP address format everyone knows (like
192.168.1.1), but it is just one of several ways to represent the same 32-bit number. - In binary, each octet becomes 8 bits. Understanding IP address binary is essential for subnetting, because subnet masks work through bitwise AND operations.
- The hexadecimal IP address format condenses each octet into two hex digits, which is why you see it in packet captures, IPv6, and low-level network debugging.
- The integer format stores an IP as a single 32-bit number—databases use this for efficient storage and fast range queries.
- You can convert between IP formats instantly with a tool, but knowing the math builds real networking fluency.
Introduction
When most people think of an IP address, they picture four numbers separated by dots: 192.168.1.1. That is the dotted-decimal IP address format, and it is designed to be easy for humans to read. But your computer does not think in decimal. It thinks in binary—ones and zeros.
The same address can also be written in hexadecimal, as a single large integer, or even in octal. Each IP address format exists because different contexts demand different representations. Network engineers converting IP to binary to calculate subnets. Developers storing IPs as integers for database efficiency. Security analysts reading hex in packet dumps. Same address, different lens.
This guide walks through every major IP address format, shows you exactly how to convert between them with real math, and explains when and why each one matters. IP addresses are just one type of network identifier; devices also use MAC addresses at the hardware level, and these formats interact at different layers of the OSI model. Whether you are studying for a certification, writing network code, or just curious about what happens under the hood, you will leave here able to look at any IP address format and understand it.
The Dotted-Decimal Format
Dotted-decimal notation is the standard IP address format for IPv4. It looks like this:
192.168.1.1
The address is made up of four groups called octets, separated by dots. Each octet represents 8 bits of the underlying 32-bit address. The term “octet” literally means a group of eight, referring to the 8 binary digits that make up each section.
Because each octet is 8 bits wide, the smallest value is 0 (all eight bits set to 0) and the largest is 255 (all eight bits set to 1). That gives each octet a range of 0 to 255. If you ever see a number outside this range in an IP address, something is wrong.
192 . 168 . 1 . 1
| | | |
Octet 1 Octet 2 Octet 3 Octet 4
Each octet: 8 bits = values 0 through 255
Total: 4 octets x 8 bits = 32 bits
This format was chosen because humans are terrible at reading long strings of binary. Breaking the 32-bit address into four decimal numbers makes it manageable. You can quickly tell someone to ping 192.168.1.1, but try telling them to ping 11000000101010000000000100000001 over the phone.
Dotted-decimal is what you will see in router configurations, DNS records, firewall rules, and virtually every networking interface. When you check your public IP, the result comes back in this format.
Binary Format
Binary is the native IP address format as far as your computer is concerned. Every IP address is fundamentally a 32-bit binary number. The dotted-decimal notation is just a convenience layer on top of it.
To convert an IP address to binary, you convert each octet independently using positional values. Each bit position in an octet has a fixed value:
| Bit Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Place Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
The technique is straightforward. Start with the leftmost place value (128). If the octet value is greater than or equal to 128, write a 1 and subtract 128 from your remaining value. If not, write a 0. Move to the next place value (64) and repeat until you have filled all 8 bits.
Octet 1: 192
192 ≥ 128? Yes → 1, remainder = 64
64 ≥ 64? Yes → 1, remainder = 0
0 ≥ 32? No → 0
0 ≥ 16? No → 0
0 ≥ 8? No → 0
0 ≥ 4? No → 0
0 ≥ 2? No → 0
0 ≥ 1? No → 0
Result: 11000000
Octet 2: 168
168 ≥ 128? Yes → 1, remainder = 40
40 ≥ 64? No → 0
40 ≥ 32? Yes → 1, remainder = 8
8 ≥ 16? No → 0
8 ≥ 8? Yes → 1, remainder = 0
0 ≥ 4? No → 0
0 ≥ 2? No → 0
0 ≥ 1? No → 0
Result: 10101000
Octet 3: 1
Result: 00000001
Octet 4: 1
Result: 00000001
Full IP address in binary:
11000000.10101000.00000001.00000001
Why Binary Matters for Subnetting
The real reason every networking student needs to understand IP address binary is subnetting. When your computer determines whether a destination IP is on the local network or needs to be routed, it performs a bitwise AND operation between the IP address and the subnet mask.
IP Address: 11000000.10101000.00000001.00000001 (192.168.1.1)
Subnet Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)
─────────────────────────────────────
AND Result: 11000000.10101000.00000001.00000000 (192.168.1.0)
The result is the network address. Any device that produces
the same network address after the AND operation is on the
same local subnet.
This is entirely a binary operation. You cannot do it in decimal without first converting. That is why understanding IP to binary conversion is not optional—it is the foundation of every subnetting calculation. Our subnet calculator automates this, but knowing the mechanics yourself is what separates someone who configures networks from someone who actually understands them.
Hexadecimal Format
Hexadecimal (base-16) provides a compact way to represent binary data. Each hex digit represents exactly 4 bits, which means each 8-bit octet can be written as exactly 2 hex digits. This makes the hexadecimal IP address format a natural middle ground—shorter than binary, closer to the actual bit patterns than decimal.
The hex digits are: 0 1 2 3 4 5 6 7 8 9 A B C D E F, where A=10, B=11, C=12, D=13, E=14, and F=15.
Converting Decimal to Hex
To convert an octet to hex, divide by 16. The quotient is the first hex digit; the remainder is the second.
Octet 1: 192 ÷ 16 = 12 remainder 0 → C0
Octet 2: 168 ÷ 16 = 10 remainder 8 → A8
Octet 3: 1 ÷ 16 = 0 remainder 1 → 01
Octet 4: 1 ÷ 16 = 0 remainder 1 → 01
Hexadecimal IP address: C0.A8.01.01
With 0x prefix: 0xC0A80101
The 0x prefix is a convention from programming languages like C and Python that signals “this number is in hexadecimal.” You will see both dotted hex (C0.A8.01.01) and the flat prefix notation (0xC0A80101) depending on the context.
Where Hex Shows Up
- Packet captures: Tools like Wireshark display raw packet data in hexadecimal. If you are analyzing network traffic, you are reading hex.
- IPv6 addresses: The entire IPv6 address format is hexadecimal (e.g.,
2001:0db8:85a3::8a2e:0370:7334). Understanding hex in IPv4 gives you a head start. Our IPv4 vs. IPv6 comparison covers the differences between both protocols. - MAC addresses: Written in hex (e.g.,
00:1A:2B:3C:4D:5E), so if you work with both MAC and IP data, hex is a common language. - Low-level programming: Embedded systems, firmware, and network stack code frequently represent IP addresses in hexadecimal format.
Integer (32-bit) Format
Every IPv4 address can be expressed as a single unsigned 32-bit integer. This IP address integer format treats the entire 32-bit binary number as one value instead of splitting it into four octets.
The formula is:
Integer = (Octet1 × 2^24) + (Octet2 × 2^16) + (Octet3 × 2^8) + Octet4
Which equals:
Integer = (Octet1 × 16,777,216) + (Octet2 × 65,536) + (Octet3 × 256) + Octet4
192 × 16,777,216 = 3,221,225,472
168 × 65,536 = 11,010,048
1 × 256 = 256
1 × 1 = 1
─────────────
Total: 3,232,235,777
So 192.168.1.1 = 3232235777 as a 32-bit integer.
Why Store IPs as Integers?
Databases and software often store IP addresses in integer format for two practical reasons:
- Storage efficiency: A 32-bit integer takes exactly 4 bytes. Storing the dotted-decimal string
"192.168.1.1"takes 11 to 15 bytes depending on the address. When you have millions of log entries, that difference adds up. - Range queries: Finding all IPs between
192.168.1.0and192.168.1.255is a simple integer comparison (WHERE ip_int BETWEEN 3232235776 AND 3232236031). With string-based storage, you need complex parsing or padding to get accurate results.
To convert an integer back to dotted-decimal, you reverse the process: divide repeatedly by 256 and take the remainders.
3232235777 ÷ 256 = 12625921 remainder 1 → Octet 4 = 1
12625921 ÷ 256 = 49319 remainder 1 → Octet 3 = 1
49319 ÷ 256 = 192 remainder 168 → Octet 2 = 168
Octet 1 = 192
Result: 192.168.1.1 (reading octets 1 through 4)
IP Address Classes
In the early days of the internet, IPv4 addresses were divided into five classes based on the leading bits of the first octet. This system, called classful networking, determined how many bits belonged to the network portion and how many to the host portion.
| Class | First Octet Range | Leading Bits | Default Mask | Networks | Hosts per Network |
|---|---|---|---|---|---|
| A | 1 – 126 | 0xxxxxxx |
255.0.0.0 |
126 | 16,777,214 |
| B | 128 – 191 | 10xxxxxx |
255.255.0.0 |
16,384 | 65,534 |
| C | 192 – 223 | 110xxxxx |
255.255.255.0 |
2,097,152 | 254 |
| D | 224 – 239 | 1110xxxx |
N/A | Reserved for multicast | |
| E | 240 – 255 | 1111xxxx |
N/A | Reserved for experimental use | |
Classful networking was replaced by CIDR (Classless Inter-Domain Routing) in 1993 because the fixed class sizes were wildly inefficient. A company needing 300 addresses would get an entire Class B with 65,534 host slots—wasting tens of thousands of addresses. CIDR allows subnet masks of any length, so you can allocate exactly what you need. Our subnetting guide walks through CIDR notation and subnet calculations step by step.
Despite being technically obsolete, IP address classes still matter because certification exams test them, private address ranges are defined by class, and networking professionals reference classes as shorthand every day.
Private Address Ranges
RFC 1918 reserved specific blocks within Classes A, B, and C for private (non-routable) use. These are the addresses used on internal networks behind routers and firewalls:
| Class | Private Range | CIDR Notation | Total Addresses |
|---|---|---|---|
| A | 10.0.0.0 – 10.255.255.255 |
10.0.0.0/8 |
16,777,216 |
| B | 172.16.0.0 – 172.31.255.255 |
172.16.0.0/12 |
1,048,576 |
| C | 192.168.0.0 – 192.168.255.255 |
192.168.0.0/16 |
65,536 |
If you have ever connected to a home Wi-Fi network and seen an IP starting with 192.168, you were using a Class C private address. Enterprise networks tend to use the 10.x.x.x range because it offers far more addresses for large-scale internal use. For more on how private and public addresses interact, see our guide on public vs. private IP addresses.
Special and Reserved Addresses
Not every IP address format value is available for regular use. Several blocks are reserved for specific functions defined by various RFCs. Knowing these is essential for troubleshooting and certification exams alike.
| Address / Range | Name | Purpose |
|---|---|---|
127.0.0.1 |
Loopback | Points back to the local machine. Used for testing the TCP/IP stack without network access. The entire 127.0.0.0/8 block is reserved for loopback. |
255.255.255.255 |
Limited Broadcast | Sends a packet to every device on the local network segment. Routers do not forward this. |
0.0.0.0 |
Default / Unspecified | Represents “no specific address.” Used in routing tables as the default route and by DHCP clients before they receive an address. |
169.254.0.0/16 |
APIPA (Link-Local) | Automatically assigned when a device cannot reach a DHCP server. If you see a 169.254.x.x address, it usually means DHCP failed. |
224.0.0.0 – 239.255.255.255 |
Multicast | Used for one-to-many communication. Protocols like OSPF (224.0.0.5) and streaming media use multicast addresses. |
192.0.2.0/24 |
TEST-NET-1 | Reserved for documentation and examples (RFC 5737). Safe to use in tutorials without conflicting with real networks. |
198.51.100.0/24 |
TEST-NET-2 | Another documentation-only block defined in RFC 5737. |
203.0.113.0/24 |
TEST-NET-3 | Third documentation block from RFC 5737. Used in examples and training materials. |
Understanding these reserved addresses prevents common mistakes. For example, if a server is configured to listen on 0.0.0.0, that does not mean it has no IP—it means it is listening on all available interfaces. And if a user reports their IP is 169.254.x.x, you know immediately that DHCP is the problem, not DNS or routing. You can verify addresses quickly with a reverse DNS lookup to see if they resolve to anything meaningful.
Converting Between Formats
Here is a quick-reference walkthrough for converting the IP address format in each direction. We will use 10.0.75.200 as our example throughout.
Decimal to Binary
For each octet, use the subtraction method with place values 128, 64, 32, 16, 8, 4, 2, 1:
10 = 0 + 0 + 0 + 0 + 8 + 0 + 2 + 0 = 00001010
0 = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 00000000
75 = 0 + 64 + 0 + 0 + 8 + 0 + 2 + 1 = 01001011
200 = 128 + 64 + 0 + 0 + 8 + 0 + 0 + 0 = 11001000
Binary: 00001010.00000000.01001011.11001000
Binary to Decimal
For each 8-bit group, add up the place values where the bit is 1:
00001010 = 8 + 2 = 10
00000000 = 0 = 0
01001011 = 64 + 8 + 2 + 1 = 75
11001000 = 128 + 64 + 8 = 200
Decimal: 10.0.75.200
Decimal to Hexadecimal
Divide each octet by 16. The quotient is the first hex digit, the remainder is the second:
10 ÷ 16 = 0 remainder 10 → 0A
0 ÷ 16 = 0 remainder 0 → 00
75 ÷ 16 = 4 remainder 11 → 4B
200 ÷ 16 = 12 remainder 8 → C8
Hex: 0A.00.4B.C8 (or 0x0A004BC8)
Decimal to Integer
10 × 16,777,216 = 167,772,160
0 × 65,536 = 0
75 × 256 = 19,200
200 × 1 = 200
─────────────
Total: 167,791,560
So 10.0.75.200 = 167791560 as a 32-bit integer.
All Formats at a Glance
| Format | 192.168.1.1 | 10.0.75.200 |
|---|---|---|
| Dotted-Decimal | 192.168.1.1 |
10.0.75.200 |
| Binary | 11000000.10101000.00000001.00000001 |
00001010.00000000.01001011.11001000 |
| Hexadecimal | C0.A8.01.01 |
0A.00.4B.C8 |
| Integer | 3232235777 |
167791560 |
If you want to verify your work or convert a batch of addresses quickly, use our IP address converter to check results in all formats at once.
Frequently Asked Questions
Why do IP addresses use dotted-decimal notation?
Dotted-decimal notation exists purely for human readability. The underlying IP address format is a 32-bit binary number, which is nearly impossible for people to read, remember, or communicate accurately. By splitting the 32 bits into four 8-bit octets and representing each as a decimal number (0–255), the format becomes something you can speak aloud, type into a configuration file, or jot down on a sticky note. The dots serve as visual separators between octets, making it easy to identify each section at a glance.
How do I convert an IP address to binary by hand?
Take each octet separately and use the subtraction method. Write out the place values: 128, 64, 32, 16, 8, 4, 2, 1. Starting from 128, if the octet value is greater than or equal to the place value, write a 1 and subtract it. If not, write a 0. Continue through all 8 positions. For example, 200 starts at 128 (write 1, remainder 72), then 64 (write 1, remainder 8), then 32 (write 0), 16 (write 0), 8 (write 1, remainder 0), then three 0s. Result: 11001000. Repeat for each octet and join them with dots.
What is the hexadecimal format used for?
Hexadecimal IP address representation appears most often in packet analysis tools like Wireshark, where raw network data is displayed in hex. It is also foundational to IPv6 addressing, which uses hex notation exclusively. Programmers working with network sockets, embedded systems, or low-level protocol implementations frequently encounter hex. The format is useful because each hex digit maps directly to 4 bits, making it easy to mentally convert between hex and binary without the lossy abstraction of decimal.
Why would I store an IP address as an integer?
Integer storage offers two main advantages: space efficiency and query performance. A 32-bit integer occupies exactly 4 bytes, while the string "255.255.255.255" takes 15 bytes. More importantly, integer representation allows you to use simple mathematical comparisons for range queries. Finding all IPs in a subnet becomes a BETWEEN query on a single indexed integer column, which is orders of magnitude faster than parsing and comparing dotted-decimal strings. Most IP geolocation databases and large-scale logging systems use integer storage for exactly this reason.
What is the difference between Class A, B, and C networks?
The classes differ in how they divide the 32-bit address between network and host portions. Class A uses 8 bits for the network (first octet 1–126), leaving 24 bits for hosts—giving each network over 16 million addresses. Class B uses 16 bits for the network (first octet 128–191), with 65,534 hosts per network. Class C uses 24 bits for the network (first octet 192–223), leaving only 254 usable hosts. While CIDR has replaced classful addressing for allocation purposes, the class designations remain useful as shorthand and are still tested on certifications like the CCNA and CompTIA Network+.
What is the 127.0.0.1 loopback address?
The address 127.0.0.1 is the IPv4 loopback address, which always points back to the local machine. When you ping 127.0.0.1, the traffic never leaves your computer—it goes down through the TCP/IP stack and comes right back up. This is useful for testing whether networking software is functioning correctly without needing a physical network connection. The entire 127.0.0.0/8 block (over 16 million addresses) is reserved for loopback, though 127.0.0.1 is by far the most commonly used. It is often referred to by its hostname alias, localhost.
References
- RFC 791 — Internet Protocol. tools.ietf.org/html/rfc791
- RFC 1918 — Address Allocation for Private Internets. tools.ietf.org/html/rfc1918
- RFC 5737 — IPv4 Address Blocks Reserved for Documentation. tools.ietf.org/html/rfc5737
- Cisco Networking Academy. netacad.com
- Cloudflare Learning Center. cloudflare.com/learning/