Convert binary or hexadecimal format to IPv4 address
Enter 32 bits (dots/colons optional)
Format Guidelines:
Binary to IP converter transforms 32-bit binary strings into dotted-decimal IPv4 addresses. Each IP address octet (0-255) is represented by 8 binary bits. Essential for understanding networking, subnet masks, and low-level IP operations.
Take 32 binary digits, split into four 8-bit groups (octets), convert each octet from binary to decimal (0-255), and join with dots. Example: 11000000.10101000.00000001.00000001 = 192.168.1.1.
IPv4 addresses are 32 bits total. Each octet is 8 bits (0-255 decimal). Network byte order is big-endian (most significant octet first). Input can include dots for readability or be continuous 32 bits.
Convert binary packet dumps to readable addresses.
Visualize how /24 = 11111111.11111111.11111111.00000000 = 255.255.255.0
Binary representation clarifies wildcard masks.
Learn how IP addresses map to binary representation.
function binaryToIP(binary) {
// Remove dots and spaces, validate
const clean = binary.replace(/[.\s]/g, '');
if (!/^[01]{32}$/.test(clean)) {
throw new Error('Invalid: need exactly 32 binary digits');
}
// Split into octets and convert
const octets = [];
for (let i = 0; i < 32; i += 8) {
octets.push(parseInt(clean.slice(i, i + 8), 2));
}
return octets.join('.');
}
// Examples
binaryToIP('11000000101010000000000100000001');
// "192.168.1.1"
binaryToIP('11000000.10101000.00000001.00000001');
// "192.168.1.1"
// CIDR to subnet mask
function cidrToMask(cidr) {
const binary = '1'.repeat(cidr) + '0'.repeat(32 - cidr);
return binaryToIP(binary);
}
cidrToMask(24); // "255.255.255.0"Split 32 bits into 4 octets, convert each to decimal (0-255), join with dots.
Use binary to IP converter when working with raw network data, learning subnetting, debugging packet captures, or understanding binary IP representation.
/24 means 24 bits for network, 8 for hosts. In binary: 24 ones followed by 8 zeros = 11111111.11111111.11111111.00000000 = 255.255.255.0. /16 = 255.255.0.0, /8 = 255.0.0.0.