IP to Hex Converter
Convert a dotted-decimal IPv4 address to an 8-digit hex string, and back.
C0A80101How IP to Hex conversion works
An IPv4 address is four decimal octets (0–255) separated by dots, such as 192.168.1.1. Each octet fits in a single byte, so it can be written as exactly two hex digits (00–FF). Converting an IP to hex means converting each octet to its two-digit hex form and concatenating them in order — no separators — to produce an 8-digit hex string that represents the full 32-bit address, e.g. 192.168.1.1 becomes C0A80101.
This format is used in DHCP client identifiers, router and firewall logs, some URL-encoding tricks, and low-level network debugging where addresses are represented as raw 32-bit hex values. This tool also converts in the opposite direction — paste an 8-digit hex string to recover the dotted-decimal IPv4 address. All conversion happens entirely in your browser; nothing is sent anywhere.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Producing the hex form of an address for a config file or a low-level field.
- Decoding a hex-encoded address from a log or a packet capture.
- Comparing an address against a hex mask in one representation.
- Checking your own conversion code against a known value.
- Reading an address embedded in a hex dump.
Frequently Asked Questions
- How does a dotted address become hex?
- Each octet is a byte, so each becomes two hex digits: 192.168.1.1 is C0.A8.01.01, written as C0A80101. It is the same 32-bit value in a different notation, which is why the hex form is exactly eight digits for any IPv4 address.
- Where does hex notation for an address turn up?
- In packet captures, router configuration, kernel structures and `/proc/net` output on Linux, and in some log formats. It is compact and byte-aligned, which makes it easier to read against a hex dump than dotted decimal is.
- Why does the parser reject a leading zero?
- Because `010` is octal 8 to `inet_aton` and decimal 10 to most modern parsers, so the same string names different hosts to different software. That ambiguity is the mechanism behind a long line of SSRF filter bypasses, and refusing the input is the only unambiguous reading.
- Is the byte order significant?
- Yes. This produces the address in network byte order — big-endian, first octet first — which is what the wire format uses. Some C code stores addresses in host order, so a little-endian machine reading a raw integer sees the octets reversed.
- How does IPv6 differ?
- It is already hexadecimal: eight groups of four hex digits, with `::` collapsing one run of zeros. There is no decimal form in normal use, which is a deliberate improvement — 128 bits in dotted decimal would be sixteen numbers and unreadable.
Common errors and gotchas
- Getting the byte order wrong, which produces a valid-looking hex value for a different address.
- Dropping a leading zero on an octet below 16, which shifts the whole string.
- Assuming eight hex digits always means IPv4, when it could be any 32-bit value.
- Treating leading zeros in the dotted form as decimal, when some parsers read them as octal.
- Confusing an address with a mask, which look identical in hex and mean different things.