All Tools

IP Address Converter: IPv4 and IPv6 to Binary and Hex

Convert IPv4 and IPv6 addresses to binary, hex and decimal and back in your browser, one per line. RFC 5952 canonical IPv6 output and a clear reason for every bad line. Nothing is uploaded.

Convert to

Dotted octets for IPv4 and 16-bit groups for IPv6. Off gives one unbroken string.

0 characters, 0 bytes

0 characters, 0 bytes


About the IP Address Converter

The IP Address Converter turns IPv4 and IPv6 addresses into binary, hexadecimal and decimal, and turns those numbers back into addresses. Paste one value per line and pick what to convert to: Address, Binary, Hex or Decimal. Each line is read on its own, so a list of a hundred addresses converts at once, and a line that cannot be read is listed with its line number and the reason. Everything runs in your browser; the addresses you paste are never uploaded.

How to use it

Steps

  1. Type or paste addresses or numbers, one per line. Mixed IPv4 and IPv6 is fine.
  2. Choose Convert to. Address prints the standard text form, Binary the bits, Hex the hexadecimal digits and Decimal the address as one integer.
  3. For Binary and Hex, Group the digits splits IPv4 into dotted octets and IPv6 into 16-bit groups. Turn it off for one unbroken string.
  4. Copy the output. Lines that failed stay empty so the output still lines up with the input, and the reasons are listed underneath.

Privacy

The conversion is plain arithmetic done in your browser. Nothing is uploaded, nothing is looked up, and nothing is kept once you close the tab.

What the tool reads

IPv4

Dotted decimal such as 192.168.0.1, with four octets from 0 to 255. Octets with a leading zero, such as 192.168.01.1, are rejected, because some systems read them as octal and others as decimal. Binary input is 32 digits, either as one run or as four dotted groups of eight. Hex input is 0xC0A80001, the dotted 0xC0.0xA8.0x00.0x01, or bare digits that contain at least one letter, such as c0a80001. A plain integer up to 4,294,967,295 is read as an IPv4 address.

IPv6

Every text form in RFC 4291: the full eight groups, the :: shorthand for a run of zero groups, and a dotted IPv4 tail such as ::ffff:192.0.2.1. Binary input is 128 digits, as one run or in groups of 8 or 16. Hex input of 9 to 32 digits, and integers from 4,294,967,296 upwards, are read as IPv6. Zone IDs such as %eth0 are not addresses and are rejected.

Canonical output

IPv6 output follows RFC 5952: lower-case hex, no leading zeros in a group, and the longest run of two or more zero groups written as :: (the first one when two runs tie). A single zero group is never shortened. IPv4-mapped addresses keep their dotted tail, so ::FFFF:129.144.52.38 prints as ::ffff:129.144.52.38. Converting an address to Address is therefore a quick way to normalise a list.

Where these forms are used

Binary addresses are the clearest way to see how a subnet mask splits network and host bits. Hex is how addresses appear in packet captures, kernel tables and some log formats, and the decimal integer form turns up in databases and geolocation files that store an address as one number. If you need the address of the device you are using, What is my IP shows it. For general conversions between bases of any size, use the Number Base Converter, and to see the bits of plain text, try Text to Binary.

Open-source credits

  • The parser and formatter are written for this site and follow RFC 4291 section 2.2 (IPv6 text representation) and RFC 5952 (recommended canonical text). The tests assert the examples published in both documents.
  • The tool uses no third-party library; integers are the browser's built-in BigInt from the ECMAScript standard.

Frequently asked questions

How do I convert an IP address to binary?

Write each of the four octets as an 8-bit binary number and keep the dots: 192.168.0.1 becomes 11000000.10101000.00000000.00000001. Paste the address here, choose Binary, and turn grouping off if you want the 32 bits as one string.

Why is my IPv6 address shortened in the output?

RFC 5952 defines one canonical text form for every IPv6 address: lower-case hex, no leading zeros and the longest run of zero groups replaced by a double colon. Writing addresses that way makes them easy to compare and search, so 2001:0DB8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1.

Why is an octet such as 010 rejected?

Some software reads an octet with a leading zero as octal, so 010 means 8, while other software reads it as decimal 10. Because the same text can mean two different addresses, the tool asks you to remove the leading zero instead of guessing.

How does the tool decide between IPv4 and IPv6 for a number?

By size. A decimal integer below 4,294,967,296, hex of up to 8 digits and binary of 32 digits are IPv4. Larger integers, hex of 9 to 32 digits and binary of 128 digits are IPv6. Text containing a colon is always IPv6.

Is a list of my addresses sent anywhere?

No. Parsing and conversion happen in your browser with plain arithmetic. Nothing is uploaded or looked up, and nothing is stored after you close the tab.

Other related tools