Convert IP to Hex
Convert IPv4 to hexadecimal with 4 formats, class detection, CIDR support. Free, offline, client-side, instant.
Convert IPv4 addresses to hexadecimal - 0xC0A80101, C0A80101, C0.A8.01.01, or C0:A8:01:01. Supports CIDR notation, shows the 32-bit decimal integer, tags IP class (A/B/C/D/E) and special-purpose ranges.
How to Use Convert IP to Hex
- Paste IPv4 addresses - one per line, in dotted-decimal notation (
192.168.1.1). Add a CIDR suffix (/24) for subnet computation. - Pick an output format -
0xcompact is the C-style literal default. Compact gives 8 raw hex chars. Dotted preserves the octet visual. Colon mimics MAC address format. - Toggle uppercase - uppercase (default) matches most documentation; lowercase suits Python/scientific contexts and some packet captures.
- Hit Convert - or just type; the 200 ms debounce keeps it responsive. Ctrl+Enter (⌘+Enter on Mac) forces a recompute.
- Read the breakdown - each line shows: input → hex output, the 32-bit decimal integer, color-coded class tag (A/B/C/D/E), and any special-purpose label (private, loopback, multicast, CGNAT).
- For CIDR entries - prefix, subnet mask (decimal + hex), network address, broadcast address, and usable host count, all in your chosen hex format.
- Copy or download - Copy puts the hex output on your clipboard. Download saves
ip-to-hex.txt. Invalid lines are flagged red in the breakdown but valid ones still convert.
Frequently Asked Questions
What’s the difference between the four hex formats?
0x compact (0xC0A80101) – the C-style integer literal, ready to paste into source code. Compact (C0A80101) – bare 8-char string, good for URLs and configuration. Dotted (C0.A8.01.01) – preserves the four-octet visual structure. Colon (C0:A8:01:01) – mimics MAC address formatting, useful when stuffing IPv4 into MAC-like fields.
Why does the tool also show the decimal value?
Because the 32-bit unsigned integer (3232235777 for 192.168.1.1) is what computers actually compare for routing, sorting IPs, and serializing addresses to fixed-width formats. Many APIs (PostgreSQL inet, Redis sorted sets) want the integer form, not dotted-decimal.
How does CIDR computation work?
A /N prefix produces a mask with N leading 1s, (32-N) trailing 0s. For /24: 0xFFFFFF00 = 255.255.255.0. The network is ip & mask; broadcast is network | ~mask. Usable host count is 2^(32-N) − 2. We compute all four (mask, network, broadcast, host count) in your chosen hex format.
What are IPv4 address classes?
RFC 791’s classful scheme by leading bits: A (0 prefix, 0-127), B (10, 128-191), C (110, 192-223), D (1110, multicast 224-239), E (1111, reserved 240-255). Classful routing is obsolete (CIDR replaced it in 1993) but the classifications still appear on networking exams and in legacy docs.
How do you detect “special-purpose” IPs?
Per IANA’s IPv4 Special-Purpose Registry: 10/8, 172.16/12, 192.168/16 RFC 1918 private; 127/8 loopback; 169.254/16 link-local APIPA; 100.64/10 CGNAT (RFC 6598); 224/4 multicast; 255.255.255.255 limited broadcast. We pack the IP to a uint32 and range-check.
Does it handle IPv6?
No – IPv4 only. IPv6 addresses are 128 bits in 8 hex groups (e.g., 2001:0db8::1) and already use hex natively; no conversion needed. A separate IPv6 tool would handle abbreviation, expansion, and CIDR-128 math.
Why uppercase vs lowercase hex?
Convention. Uppercase is traditional in documentation, packet headers, and Wireshark. Lowercase is preferred in Python, Go, and most modern config files. Both parse identically. Pick whichever your downstream consumer expects.
Can I batch many IPs at once?
Yes – one per line, in the textarea. The tool processes thousands in under 50 ms. Invalid lines (bad octet, wrong format) get flagged in red but the batch continues – valid lines still convert.
Is the math accurate for the full 32-bit range?
Yes. We use unsigned 32-bit semantics (>>> 0) to keep the integer in 0..4,294,967,295. The class detection and special-purpose ranges use unsigned comparison. 255.255.255.255 correctly comes out as decimal 4294967295 = 0xFFFFFFFF.
Is my data uploaded?
No. All math runs in your browser. Open DevTools → Network and watch zero requests fire. Safe for internal IP audits, security work, or anything that shouldn’t leak.