IP to Hex Converter

Type 192.168.0.1, get C0A80001. The same bytes also come out the way tcpdump, PXELINUX, C code, Snort rules, and the macOS netmask field expect them. Add /24 to see the mask in hex.

Results update as you type. Mapped forms like ::ffff:192.168.0.1 work too.

Enter an address or press Load sample. You get the hex value, the division behind each byte, and the same bytes in the forms tcpdump, PXELINUX, and C code expect.

Convert a list of addresses

Working 172.16.254.1 out by hand

Hex is base 16. One digit covers 0 to 15, with A to F standing for 10 to 15. Two digits cover 0 to 255, the full range of one octet. So every IPv4 octet turns into exactly two hex digits, and the whole address into eight.

Divide each octet by 16. The quotient is the first digit, the remainder the second.

Octet÷ 16First digitSecond digitHex
17210 remainder 1210 → A12 → CAC
161 remainder 01010
25415 remainder 1415 → F14 → EFE
10 remainder 10101

Join the pairs and you get AC10FE01. Keep the zero in 01. Drop it and the value has seven digits. Any parser pads a short value on the left, so AC10FE1 reads back as 10.193.15.225, a different host on a different network.

10 = A11 = B12 = C13 = D14 = E15 = F

Which format does the destination want?

The eight digits never change. The wrapping around them depends on the program reading them. The converter prints every form below from one input, so this list is about picking the right card.

PXELINUX boot configs

PXELINUX looks for a config file named after the client address in uppercase hex, pxelinux.cfg/C0A8010A for 192.168.1.10. With no such file, the loader drops the last digit and retries: C0A8010, C0A801, down to C, then default. One file named C0A801 therefore covers every client in 192.168.1.0/24.

tcpdump byte offsets

tcpdump 'ip[12:4] = 0xc0a8010a' matches packets from 192.168.1.10. Offset 12 in the IPv4 header holds the source address, offset 16 the destination. For a single host, src host 192.168.1.10 is shorter. The byte form pays off with a mask, such as ip[12:4] & 0xffffff00 = 0xc0a80100 for a whole /24.

Snort and Suricata rules

content:"|C0 A8 01 0A|"; matches the four bytes anywhere in the payload. Use this when an address sits inside application data, such as a SOCKS4 connect request or a hardcoded beacon address, instead of the IP header.

Wireshark

frame contains c0:a8:01:0a finds the bytes at any layer of the capture. For the header fields alone, ip.addr == 192.168.1.10 is the cleaner filter.

C and firmware

uint8_t ip[4] = { 0xC0, 0xA8, 0x01, 0x0A }; stores bytes in the order you wrote them. A uint32_t set to 0xC0A8010A holds the right number, but on a little-endian chip the bytes sit in memory as 0A 01 A8 C0. Pass the integer through htonl() before it goes into a sockaddr_in.

Browser address bar

http://0xC0A8010A/ opens 192.168.1.10. The WHATWG URL standard parses hex, octal, and single-number IPv4 hosts. Allowlists matching the string "192.168." miss this form, which is why SSRF test lists include it.

Netmasks in hex, the way macOS prints them

Run ifconfig en0 on macOS or FreeBSD and the mask shows as netmask 0xffffff00, not 255.255.255.0. Type an address with a prefix, such as 10.20.30.40/22, and the converter returns the mask, the network address, and the last address in hex.

Read a hex mask one digit at a time. Each F is four network bits. FFFFFC00 has five Fs, 20 bits, plus C, which is 1100 in binary, two more. That makes /22.

PrefixDotted maskHex maskAddresses
/8255.0.0.0FF00000016,777,216
/16255.255.0.0FFFF000065,536
/20255.255.240.0FFFFF0004,096
/22255.255.252.0FFFFFC001,024
/24255.255.255.0FFFFFF00256
/26255.255.255.192FFFFFFC064
/28255.255.255.240FFFFFFF016
/30255.255.255.252FFFFFFFC4
/32255.255.255.255FFFFFFFF1

IPv6 is hex already. What changes?

An IPv6 address is 32 hex digits with runs of zeros trimmed for reading. 2001:db8::1 hides 23 zeros. The converter puts them back and gives 20010DB8000000000000000000000001, the form MySQL returns from HEX(INET6_ATON('2001:db8::1')) and the form a packet capture shows.

Reverse DNS wants the same digits backwards, one per label. The PTR record for 2001:db8::1 lives at:

1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.

Count the labels before you paste a name like this into a zone file. One missing zero shifts every digit after it, and the record answers for a different address. The ip6.arpa card prints all 32 labels for you.

IPv4-mapped addresses such as ::ffff:192.168.0.1 come out as 00000000000000000000FFFFC0A80001. The last eight digits are the IPv4 address in hex, and the converter shows them on a separate card.

The same conversion in code

Every line below returns network byte order, the order the converter shows first.

# Python
import ipaddress
ipaddress.ip_address('192.168.1.10').packed.hex()     # 'c0a8010a'

// PHP
bin2hex(inet_pton('192.168.1.10'));                    // c0a8010a

-- MySQL
SELECT HEX(INET_ATON('192.168.1.10'));                 -- C0A8010A

// JavaScript
'192.168.1.10'.split('.').map(n => (+n).toString(16).padStart(2, '0')).join('')

# Bash
printf '%02X' 192 168 1 10; echo                       # C0A8010A

None of these accept a /prefix. Strip the prefix first, or let the converter handle the mask.

Where this page stops

  • Dotted IPv4 only. A bare integer such as 3232235786 gets refused. Decode one with Decimal to IP first.
  • No leading zeros. 192.168.010.1 means 192.168.8.1 to inet_aton() and 192.168.10.1 to most other parsers. Type the address without the zero so there is one answer.
  • No hostnames. Resolve toolexe.com with Website to IP, then convert the address.
  • One direction. To turn C0A8010A or a reversed /proc/net/tcp value back into an address, use Hex to IP.
  • One prefix, no subnet planning. Mask, network, and last address come out. Host counts per split and VLSM layouts belong in a subnet calculator.

IP to hex questions

Common addresses in hex, letter case, and inputs the converter refuses.

What is 192.168.1.1 in hex?

C0A80101. 192 is C0, 168 is A8, and each 1 becomes 01. Written as a number literal for C or Python, the value is 0xC0A80101.

What is 127.0.0.1 in hex?

7F000001. Linux prints the same address as 0100007F in /proc/net/tcp, since the kernel writes host byte order and x86 and ARM store the low byte first. The Host byte order card shows the reversed form.

What is 255.255.255.0 in hex?

FFFFFF00. Each 255 is FF and the final 0 is 00. macOS and FreeBSD print this mask as netmask 0xffffff00 in ifconfig output. Type any address with /24 and the converter returns the mask next to the network address.

Should hex IP values be uppercase or lowercase?

The value is the same either way. Match the destination. PXELINUX file names need uppercase on case-sensitive TFTP servers. Python, tcpdump, and Linux tools print lowercase. The ABC and abc switch changes every card at once, except the PXELINUX card, which stays uppercase.

Why does the converter refuse 192.168.01.1?

A leading zero makes the octet ambiguous. inet_aton() in C reads 010 as octal 8, while Python and most validators read 10 or reject the address outright. Remove the zero and the converter accepts the address.

Does the page send my addresses anywhere?

No. Parsing and every format on the page run in your browser. Nothing goes to Toolexe, so internal addresses from a firewall config stay on your machine.