Binary / Decimal / Hex Converter

Convert numbers between binary (base-2), decimal (base-10), hexadecimal (base-16), and octal (base-8) in real time. Essential for network engineers working with IP addresses, subnet masks, MAC addresses, and low-level protocol analysis.

Binary / Decimal / Hex Converter
Figure 1 — Binary / Decimal / Hex Converter

Understanding Number Systems

Computers process everything in binary (1s and 0s), but humans prefer decimal (0-9). Hexadecimal provides a compact way to represent binary data, with each hex digit mapping to exactly 4 binary bits. Networking relies heavily on all four systems: IP addresses use decimal, subnet masks use binary logic, MAC addresses use hexadecimal, and Unix file permissions use octal.

BaseNameDigits UsedNetworking Use
2Binary0, 1Subnet mask operations, bitwise AND/OR
8Octal0-7Unix file permissions (chmod 755)
10Decimal0-9IP addresses (192.168.1.1), port numbers
16Hexadecimal0-9, A-FMAC addresses, IPv6, color codes

How Binary-to-Decimal Conversion Works

Each position in a binary number represents a power of 2, starting from the rightmost bit (2^0 = 1). To convert binary to decimal, multiply each bit by its positional value and sum the results.

For example, converting 11000000 (the first octet of 192.168.x.x):

Position:  7    6    5    4    3    2    1    0
Power:     128  64   32   16   8    4    2    1
Bit:       1    1    0    0    0    0    0    0
Value:     128 + 64 + 0  + 0  + 0  + 0  + 0  + 0 = 192

Hexadecimal and MAC Addresses

MAC addresses are written as six pairs of hexadecimal digits separated by colons or hyphens, such as AA:BB:CC:DD:EE:FF. Each hex pair represents one byte (8 bits), and the full MAC address is 48 bits long. The first three bytes identify the manufacturer (OUI), and the last three are the device-specific identifier.

Use our MAC Address Lookup tool to identify the manufacturer from a MAC address, or the IP to Binary converter to see how IP octets map to binary.

DecimalBinaryHexOctalNetworking Context
00000000000000Network address (host portion)
10000010100A012First octet of 10.x.x.x private range
1281000000080200Subnet mask boundary (/25)
19211000000C0300First octet of 192.168.x.x
25511111111FF377Broadcast / full subnet mask octet
655351111111111111111FFFF177777Maximum port number, max 16-bit value
Pro Tip: When subnetting, memorize the "magic number" pattern for the last interesting octet: 128, 192, 224, 240, 248, 252, 254, 255. Each value corresponds to one additional network bit. Knowing these in binary (10000000, 11000000, etc.) makes subnet math instant.

Hexadecimal in IPv6

IPv6 addresses are written entirely in hexadecimal: eight groups of four hex digits separated by colons, like 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Each group represents 16 bits, and the full address is 128 bits. Leading zeros in each group can be omitted, and consecutive all-zero groups can be replaced with :: once per address.

Understanding hex-to-binary conversion is critical for IPv6 subnetting. Each hex digit maps to exactly 4 bits, so a /48 prefix covers the first three groups (12 hex digits = 48 bits). See our IPv6 Converter for more IPv6 tools.

Binary Math for Subnet Calculations

Subnetting relies on the bitwise AND operation between an IP address and a subnet mask. When you AND two binary numbers, the result has a 1 only where both inputs have a 1:

IP Address:    11000000.10101000.00000001.01100100  (192.168.1.100)
Subnet Mask:   11111111.11111111.11111111.00000000  (255.255.255.0)
AND Result:    11000000.10101000.00000001.00000000  (192.168.1.0 = Network)

Use our Subnet Calculator to perform these operations automatically, or the Network Prefix Calculator for direct AND operations.

Conversion Methods on the Command Line

Linux / Mac

# Decimal to hex
printf '%X\n' 255
# Output: FF

# Hex to decimal
echo $((16#FF))
# Output: 255

# Decimal to binary
echo "obase=2;192" | bc
# Output: 11000000

# Binary to decimal
echo "ibase=2;11000000" | bc
# Output: 192

Windows PowerShell

# Decimal to hex
'{0:X}' -f 255
# Output: FF

# Hex to decimal
[Convert]::ToInt32('FF', 16)
# Output: 255

# Decimal to binary
[Convert]::ToString(192, 2)
# Output: 11000000

Video Tutorial

Key Takeaways

  • Binary (base-2) is the language computers use — every network operation is binary at its core
  • Hexadecimal is a shorthand for binary — each hex digit equals exactly 4 bits
  • MAC addresses use hex pairs, IPv4 uses decimal octets, IPv6 uses hex groups
  • The subnet mask values to memorize: 128, 192, 224, 240, 248, 252, 254, 255
  • Octal is mainly used for Unix file permissions (chmod 644, 755, etc.)
  • Understanding binary AND operations is fundamental to subnetting

Related Tools & Guides

Frequently Asked Questions

Why do computers use binary?

Computers use binary because digital circuits have two stable states: on (1) and off (0), represented by high and low voltage levels. This two-state system is the most reliable way to store and process information electronically. All data — text, images, network packets — is ultimately stored as sequences of 1s and 0s.

Why is hexadecimal used in networking?

Hexadecimal is used because it provides a compact, human-readable representation of binary data. One hex digit represents exactly 4 bits, so a byte (8 bits) needs only 2 hex digits instead of 8 binary digits. This makes MAC addresses (AA:BB:CC:DD:EE:FF) and IPv6 addresses much easier to read and type than their binary equivalents.

How do I convert binary to decimal in my head?

Memorize the powers of 2 for each bit position: 128, 64, 32, 16, 8, 4, 2, 1. For each 1-bit, add the corresponding value. For example, 11001010 = 128 + 64 + 8 + 2 = 202. With practice, you can do common networking values (192 = 128+64, 224 = 128+64+32) instantly.

What is the largest number a byte can represent?

A byte (8 bits) can represent values from 0 to 255 in decimal, 00 to FF in hexadecimal, or 00000000 to 11111111 in binary. This is why each octet in an IPv4 address ranges from 0 to 255. For unsigned values, the formula is 2^n - 1, where n is the number of bits.

How are MAC addresses structured in hexadecimal?

A MAC address is 48 bits (6 bytes) written as six hex pairs: AA:BB:CC:DD:EE:FF. The first three bytes (AA:BB:CC) form the Organizationally Unique Identifier (OUI) assigned to the manufacturer by IEEE. The last three bytes are the device-specific serial number assigned by the manufacturer.

What is octal used for in computing?

Octal (base-8) is primarily used for Unix/Linux file permissions. Each permission set (read=4, write=2, execute=1) maps to one octal digit. So chmod 755 means owner has full access (7=rwx), group has read+execute (5=r-x), and others have read+execute (5=r-x). Octal was also historically used in older computing systems.

About Tommy N.

Tommy is the founder of RouterHax and a network engineer with 10+ years of experience in home and enterprise networking. He specializes in router configuration, WiFi optimization, and network security. When not writing guides, he's testing the latest mesh WiFi systems and helping readers troubleshoot their home networks.

Promotion for FREE Gifts. Moreover, Free Items here. Disable Ad Blocker to get them all.

Once done, hit any button as below