IPv4 address converter

What is an Ipv4 Address Converter?

An IPv4 address like 192.168.1.1 is just a human-friendly way of writing a 32-bit number. Databases, firewalls, log files and network code sometimes store or display it in other forms: a single decimal integer, binary, hexadecimal or an IPv6-mapped address. This converter shows all of them at once.

How to use it

  1. Enter an IPv4 address in dotted-decimal notation.
  2. Read the decimal, binary, hexadecimal and IPv6 representations.
  3. Copy the format you need.

Example: 192.168.1.1

  • Decimal integer: 192 × 256³ + 168 × 256² + 1 × 256 + 1 = 3232235777
  • Binary: 11000000.10101000.00000001.00000001
  • Hexadecimal: C0A80101
  • IPv4-mapped IPv6: ::ffff:192.168.1.1, also written ::ffff:c0a8:101

Why convert to an integer?

  • Range checks: an address is inside a range if its integer lies between the range's start and end integers.
  • Storage: an integer takes 4 bytes instead of up to 15 characters. MySQL offers INET_ATON() and INET_NTOA() for this; PostgreSQL has a native inet type.
  • Sorting: sorting addresses as text puts 10.0.0.10 before 10.0.0.9; sorting integers gives the right order.

Where the IPv6 form appears

Dual-stack servers that accept IPv4 connections on an IPv6 socket often log clients as ::ffff:203.0.113.5. Strip the prefix to get the plain IPv4 address.

Binary and subnets

The binary form makes subnet masks easy to understand: a /24 network means the first 24 bits are the network part and the last 8 bits identify hosts.

Frequently Asked Questions

How do I convert an IP address to a number?

Multiply the first octet by 16777216, the second by 65536, the third by 256 and add the fourth.

What is ::ffff: in front of an IPv4 address?

It is the IPv4-mapped IPv6 format, used when an IPv6 socket receives an IPv4 connection.

Why store IP addresses as integers?

Integers use less space, sort correctly and make range checks simple comparisons.

What is 192.168.1.1 in hexadecimal?

C0A80101, because 192 is C0, 168 is A8, and 1 is 01.