IP Converter

Convert IPv4 to decimal, binary, HEX, octal format.

Works both ways: enter a dotted IPv4 or a decimal, hex (0x…) or binary number to get every format.

IP Converter

Convert IPv4 both ways: from dotted notation to decimal, binary, hex and octal — and back from a decimal, hex or binary number to a regular IP address.

Decimal ↔ Binary ↔ HEX
Reverse conversion: decimal, hex or binary → IP
Integer IP representation

How to Use

  1. Enter an IPv4 address (e.g. 192.168.1.1) or a decimal, hex or binary number
  2. The tool converts IP to decimal, binary, HEX and octal formats
  3. Copy the desired IP address format from the results

FAQ

Different systems may require IPs in various formats. Conversion is also useful for learning and understanding IP address structure.

This is a single number obtained by combining all IP octets. For example, 192.168.1.1 in decimal format equals 3232235777.

IP to binary and hex converter: reading the output

The converter takes an IPv4 address in dotted-decimal form (8.8.8.8) and shows it four ways: as a single decimal integer, in binary by octet, in hexadecimal and in octal. Below that you get an octet table with each of the four bytes broken out into Dec, Bin and Hex, the address class, and whether it is a private address. Every value has a copy button.

For 8.8.8.8:

FormatValueWhere you see it
Decimal134744072INT UNSIGNED database columns, logs, GeoIP databases, APIs
Binary00001000.00001000.00001000.00001000Working out masks and subnets by hand
Hex0x08080808Packet dumps, Linux /proc/net, firmware, source code
Octal10.10.10.10Rare: exercises and URL obfuscation

Octal octets are printed without a leading zero. To feed them to something that parses addresses (ping, a browser, inet_aton), add the prefix: 010.010.010.010. Without it, 10.10.10.10 is simply read as a different decimal address.

An IPv4 address is one 32-bit number

Dotted notation is a convenience. Underneath, an IPv4 address is 32 bits split into four 8-bit octets, each 0–255. Every other format is the same number in another base, so every conversion comes down to packing octets into an integer or unpacking an integer into octets.

IP to decimal and decimal to IP address

Formula: A×16777216 + B×65536 + C×256 + D, where 16777216 = 256³ and 65536 = 256².

8×16777216 = 134217728
8×65536    =    524288
8×256      =      2048
8          =         8
------------------------
             134744072

To go back, use integer division with remainders:

3232235777 ÷ 16777216 = 192, remainder 11010305
  11010305 ÷ 65536    = 168, remainder 257
       257 ÷ 256      =   1, remainder 1
→ 192.168.1.1

The tool converts in the IP → number direction only; for decimal to IP, use the steps above or the one-liners further down.

IP to binary and binary to IP

Convert each octet on its own and pad it to eight digits with leading zeros. Bit weights are 128, 64, 32, 16, 8, 4, 2, 1.

203 = 128 + 64 + 8 + 2 + 1 → 11001011
  0                         → 00000000
113 = 64 + 32 + 16 + 1      → 01110001
 25 = 16 + 8 + 1            → 00011001
203.0.113.25 → 11001011.00000000.01110001.00011001

Binary to IP converter logic is the reverse: split the 32 bits into groups of eight (count from the left if there are no dots) and add up the weights of the 1-bits in each group. Never drop leading zeros when you join or split the string; one missing zero shifts every octet after it.

Binary is what makes subnet masks make sense: /26 means 26 ones and 6 zeros, 11111111.11111111.11111111.11000000, which is 255.255.255.192. For network, broadcast and host ranges use the subnet calculator; to split or summarize ranges use the CIDR calculator.

IP to hex and hex to IP

Each octet becomes two hex digits: 203 = CB, 0 = 00, 113 = 71, 25 = 19, giving CB007119 or 0xCB007119. For hex to IP, split the string into pairs and convert each pair to decimal (CB = 12×16 + 11 = 203). If there are fewer than eight digits, left-pad with zeros first: 0x8080808 → 08080808 → 8.8.8.8.

Watch the byte order

Linux's /proc/net/route and /proc/net/tcp print addresses in hex but in host byte order, which is little-endian on x86 and ARM. A gateway of 0101A8C0 is 192.168.1.1, not 1.1.168.192: read the pairs from the end. If a hex to decimal IP result looks absurd, try reversing the bytes.

Cheat sheet: common octet values

These values show up in addresses and masks all the time. 128, 192, 224, 240, 248, 252, 254 and 255 are the only valid octets in a subnet mask, because mask bits are contiguous ones from the left.

DecBinaryHex
00000000000
10000000101
10000010100A
127011111117F
1281000000080
16810101000A8
17210101100AC
19211000000C0
22411100000E0
24011110000F0
24811111000F8
25211111100FC
25511111111FF

In Excel or Google Sheets, convert an octet with =DEC2BIN(A1,8) and =DEC2HEX(A1,2), and back with =BIN2DEC() and =HEX2DEC(). Split a full address into octets first with Text to Columns, using the dot as the delimiter.

Converting in code and on the command line

# Python
import ipaddress
int(ipaddress.IPv4Address('8.8.8.8'))           # 134744072
str(ipaddress.IPv4Address(134744072))           # '8.8.8.8'
str(ipaddress.IPv4Address(0xCB007119))          # '203.0.113.25'
str(ipaddress.IPv4Address(int('11001011000000000111000100011001', 2)))  # '203.0.113.25'

# PHP
sprintf('%u', ip2long('203.0.113.25'));         // 3405803801
long2ip(134744072);                             // 8.8.8.8

# MySQL
SELECT INET_ATON('8.8.8.8'), INET_NTOA(134744072);

# Bash: IP to hex
printf '%02X' 203 0 113 25; echo                # CB007119

Store IPv4 in databases as INT UNSIGNED: four bytes instead of up to fifteen characters, and range lookups with BETWEEN become trivial. In PHP, print ip2long() with sprintf('%u'), because on 32-bit builds addresses from 128.0.0.0 up come out negative.

Numeric IP forms in URLs

Address parsers, and browsers under the WHATWG URL standard, accept more than dotted decimal: http://134744072/, http://0x08080808/ and http://010.010.010.010/ all reach 8.8.8.8. Phishing links use this to disguise a destination, and SSRF payloads use it to slip past naive "block 127.0.0.1" filters. If your code validates addresses, normalize them to the 32-bit integer before comparing against any blocklist.

Address class and private ranges

The class field follows the old classful scheme by first octet: A 0–127, B 128–191, C 192–223, D 224–239 (multicast), E 240–255 (reserved). Routing has been classless (CIDR) since 1993, so treat the class as historical context, not the real network size. The private flag marks the RFC 1918 ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, which are not routed on the public internet. To see your public address use What is my IP; to find a website's address use Domain to IP.

A note on IPv6

This converter handles IPv4 only. IPv6 addresses are 128 bits written as eight groups of four hex digits. Leading zeros in a group can be dropped and one run of all-zero groups collapses to ::, so 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1. Decimal and binary forms of IPv6 are rarely used in practice. An IPv4 address embedded in IPv6 is written ::ffff:8.8.8.8, or in pure hex ::ffff:808:808.

Cascade link promotion for your site $30 bonusBacklinks 5→50→5000 across 100+ platforms. From $30 to start, plus a $30 bonus for newcomers.