ShareYourGroupShareYourGroupIP and Internet

IP address converter: decimal, binary and hex

Type an IPv4 address, a whole number or a hex value. Every other way of writing the same address appears below.

One address, many spellings

An IPv4 address is really one 32-bit number. The familiar form with dots, such as 192.168.1.1, is only a way of writing it that people find easier: the 32 bits are cut into four groups of 8, and each group is written as a decimal number from 0 to 255. The same 32 bits can also be written:

The converter accepts the dotted form, the whole number or the hex form, and shows all of them.

How the conversion is done

Dotted to whole number. Multiply each part by its place value and add:

192 × 16,777,216 + 168 × 65,536 + 1 × 256 + 1 = 3,232,235,777

The place values are 256 cubed, 256 squared, 256 and 1, because each part is one base-256 digit.

Whole number to dotted. Divide by 256 again and again, keeping the remainders: they are the four parts from right to left.

Dotted to binary. Convert each part to 8 bits. For 192: 128 + 64 = 192, so the bits for 128 and 64 are 1 and the rest 0: 11000000. For 168: 128 + 32 + 8, giving 10101000.

Binary to hex. Each group of 4 bits is one hex digit: 1100 is C, 0000 is 0, so 192 is C0.

A table for the eight bit positions

Bit position1st2nd3rd4th5th6th7th8th
Worth1286432168421

To convert a number from 0 to 255 by hand, walk along the row: if the worth fits into what is left, write 1 and subtract it, otherwise write 0.

Where the other forms turn up

One curiosity: many browsers will open a site if you type its address as a single whole number. That trick is sometimes used to disguise links in scam messages, so treat a link made only of digits with suspicion.

What is the largest IPv4 address as a number?

255.255.255.255 is 4,294,967,295, which is 2 to the power 32, less 1.

Does the converter handle IPv6?

No. IPv6 addresses are 128 bits and are already written in hex. Use the IPv6 expand and shorten tool for those.

Why does my calculator give a negative number for some addresses?

Some programs store the 32 bits as a signed number, so addresses from 128.0.0.0 upward appear negative. Add 4,294,967,296 to get the unsigned value shown here.