IP to Hex Converter

Convert IPv4 dotted-decimal addresses into 8-character hexadecimal values.

Result

About this tool

IP to Hex converts IPv4 dotted-decimal addresses into their 8-character hexadecimal representation. Networking protocols, system code, and security tooling frequently express IP addresses as hex values - this is the standard format in packet headers, C preprocessor macros, and many firewall and router debug outputs. This tool handles the conversion instantly so you can match addresses across formats without manual arithmetic.

Real example

Input: 192.168.1.1

Each decimal octet is converted to a 2-digit hex byte:
192 -> C0
168 -> A8
1 -> 01
1 -> 01
Result: C0A80101

In C or C++ code this would typically be written as 0xC0A80101. The 0x prefix is not included in the output - add it manually if your context requires it.

Common use cases

  • Network protocol debugging: Raw Ethernet frames and IP headers encode addresses as 4-byte hex sequences. When reading a hex dump from Wireshark, tcpdump, or a custom parser, convert addresses here to confirm you are reading the correct bytes.
  • Embedded and systems programming: Hardcoded IP addresses in firmware, drivers, and network stack code are often expressed as hex constants. Use this to prepare values before committing them to source code.
  • SIEM and log normalization: Cross-checking whether a SIEM's hex-encoded IP field matches a known address is a common incident response task. Paste the source IP and verify the hex instantly.
  • Packet crafting tools: Tools like Scapy, libpcap, and custom socket code sometimes require IP fields as hex integers. This converter prepares those values.

How it works

The IPv4 address is split into four decimal octets. Each octet is converted to a 2-digit hexadecimal string using n.toString(16).padStart(2, '0'). The leading zero padding is critical - without it, 01 becomes 1 and the final hex string is the wrong length. The four 2-digit bytes are concatenated and returned in uppercase.

Common mistakes

  • Forgetting the leading zero on small octets: Octet values 0-15 produce a single hex digit without padding. Always use 2-character pairs: 0A not A. This tool handles padding automatically.
  • Expecting the 0x prefix in output: The output is plain hex. If your tool or codebase requires 0x, prepend it manually: 0x + C0A80101.
  • Byte order issues: This tool uses network byte order (big-endian). Some x86 systems store IP values in little-endian byte order, which reverses the bytes. If your tool expects little-endian, reverse the byte pairs manually.

FAQ

Is the output uppercase or lowercase
Uppercase by default (C0A80101). Some tools and languages prefer lowercase hex - you can convert in your editor or terminal with a quick tr '[:upper:]' '[:lower:]'.

How do I convert hex back to an IP
Use the Hex to IP tool - paste the 8-character hex and it reconstructs the dotted-decimal address.

What is the hex for 8.8.8.8 (Google DNS)
8.8.8.8 -> 08080808. The leading zeros matter - each pair must be exactly 2 characters.

Can I convert multiple IPs at once
This tool handles one address at a time. For batch conversion, a quick Python one-liner works: socket.inet_aton("192.168.1.1").hex().

Learn more

The IP Addressing & Networking Guide covers all four representations of an IPv4 address - dotted-decimal, binary, hexadecimal, and unsigned integer - in one place, with the math behind each conversion. For hands-on subnet planning, the CIDR Subnetting Explained article walks through real-world network design examples.

Where hex IP addresses appear and why

Hexadecimal is the format of choice when working close to the hardware or kernel — where binary would be too verbose and decimal loses the octet-boundary visibility that hex preserves naturally. Each hex digit represents exactly 4 bits, so two hex digits represent one 8-bit octet. An entire 32-bit IPv4 address fits in exactly 8 hex characters, making length-checking trivial and octet extraction a matter of slicing two characters at a time.

Packet captures: In Wireshark's hex pane or a raw tcpdump dump, IP header bytes 12-15 are source IP and bytes 16-19 are destination IP. Reading them as hex pairs and converting gives you the addresses without the protocol decoder. For example, 08 08 08 08 is immediately recognizable as 8.8.8.8 in hex.

Linux kernel interfaces: /proc/net/tcp and /proc/net/arp expose IP addresses in hex. Note that /proc/net/tcp uses little-endian byte order — the hex digits are byte-reversed compared to what this tool produces. 0101A8C0 in little-endian is 192.168.1.1 in dotted notation. When parsing these files programmatically, reverse the byte pairs before converting.

Firewall rules and ACLs: Some Cisco IOS and older firewall configurations express address ranges and masks in hex. Network engineers working with these platforms regularly convert between dotted notation and hex when writing or reading ACL entries.

Hex conversion: the math

Each octet is an 8-bit value between 0 and 255. Converting to hex is a base-10 to base-16 conversion: divide by 16, the quotient is the high nibble, the remainder is the low nibble. Map each to its hex digit (0-9 or A-F). For 192: 192 ÷ 16 = 12 remainder 0, so C0. For 168: 168 ÷ 16 = 10 remainder 8, so A8. Concatenate all four: C0A80101.

In code: ip.split('.').map(o => parseInt(o).toString(16).padStart(2,'0')).join('') — one line of JavaScript that produces the same 8-character result this tool shows. The padStart(2,'0') is critical: octet 8 must produce 08, not 8, to keep the total at exactly 8 characters.

For the reverse, use Hex to IP. For binary form of the same address, see IP to Binary. For integer form, see IP to Decimal.

Related tools

  • Hex to IP — reverse — convert 8-character hex back to dotted notation
  • IP to Binary — convert the same IPv4 address to 32-bit binary
  • IP to Decimal — convert to unsigned 32-bit decimal integer
  • CIDR / IP Converter — verify subnet membership after the conversion