logo
GeekFormat

IPv4 Converter

IPv4 Converter

Convert between IPv4 addresses and decimal, binary, or hexadecimal formats.

Conversion Result

IPv4
192.168.0.1
Decimal
3232235521
Binary
11000000.10101000.00000000.00000001
Hex
0xC0A80001

IPv4 addresses have multiple representations: human-readable dotted decimal (e.g., 192.168.1.1), 32-bit integers for computer storage, binary, and hexadecimal. When studying network protocols, analyzing logs, writing ACL rules, or processing low-level scripts, you frequently need to switch between different bases. This tool provides 4-way conversion capability — enter any format to instantly get the other three representations. All calculations run locally in your browser, no internet required, results appear instantly.

Related

Use Cases

  • When learning network protocols, convert dotted IPs to binary to observe subnet mask bitwise operations and understand the division principle between network and host addresses
  • When writing firewall ACL rules or routing tables, convert IPs to decimal integers for range matching, or to hexadecimal for packet analysis
  • When analyzing network logs, convert decimal or hexadecimal IPs in logs back to dotted format to quickly identify source addresses
  • When writing Python/Shell scripts to process IP data, use this tool first to verify conversion results before writing logic into code
  • During network operations troubleshooting, compare the same IP in different bases to help diagnose subnet boundary and address conflict issues

Features

  • 4-way conversion: Automatic conversion between dotted decimal, decimal integer, 32-bit binary, and 8-digit hexadecimal — enter once to see all four results simultaneously
  • Smart detection: Automatically identifies whether input is a dotted IP or decimal number, enabling bidirectional conversion without format switching
  • Range validation: Automatically validates IP legality and decimal integer range (0–4294967295), with instant prompts for invalid input
  • Pure client-side calculation: All conversions run locally in the browser with no data sent to any server — zero latency and zero privacy risk
  • One-click JSON copy: Copy conversion results in JSON format with one click, convenient for pasting into scripts, config files, or technical documentation

How to Use

  1. Enter an IPv4 address (dotted decimal format, e.g., 192.168.0.1) or decimal integer (0–4294967295) in the input box
  2. The tool automatically detects the input format and completes 4-way conversion in real time — no button click needed
  3. View the four result fields: IPv4 (dotted decimal), Decimal (integer), Binary (32-bit), and Hex (8-digit hexadecimal)
  4. Click the "Copy JSON Result" button to copy the complete conversion results to your clipboard for use in scripts or documentation

FAQ

Why convert IPv4 to different bases?

Different scenarios use different representations: dotted decimal for human reading, decimal integers for database storage and range comparison, binary for subnet mask bitwise operations, and hexadecimal for packet analysis and protocol debugging. Mastering base conversion helps you understand the underlying structure of IP addresses.

Does it auto-detect decimal number input?

Yes. The tool automatically determines whether input is in dotted IP format (e.g., 192.168.1.1) or pure numeric (e.g., 3232235777), enabling bidirectional conversion without mode switching. Numbers are validated to be within the range 0–4294967295.

Are conversion results uploaded to a server?

No. All conversion logic runs entirely locally in your browser via JavaScript. Neither input nor results are sent to any server — zero privacy risk, zero network latency.

Why is binary output shown as a continuous 32-bit string instead of four groups?

Binary results display the complete 32-bit continuous string (32 zeros or ones total) for convenient observation of the entire address bit pattern. You can split into octets by referencing each 8-bit boundary. The reference table shows four-group binary format for learning purposes.

Does hexadecimal output match what I see in Wireshark?

Yes. Hexadecimal results use 0x-prefixed 8-digit hex representation (e.g., 0xC0A80101), consistent with network byte order as shown in packet capture tools like Wireshark, and can be directly used for protocol analysis.

Does it support IPv6 address conversion?

The current tool only supports IPv4. For IPv6-related tools, you can use the site's IPv6 Toolbox. IPv4 is 32-bit while IPv6 is 128-bit, and their base conversion logic differs significantly.

How do I convert IP to integer in code?

Most languages have built-in functions: Python uses the ipaddress module (int(ipaddress.IPv4Address('192.168.1.1'))), PHP uses ip2long(), MySQL uses INET_ATON(), and C uses inet_pton(). We recommend first verifying your conversion results with this tool.

术语表

Dotted Decimal
The most common human-readable IPv4 format, dividing the 32-bit address into four 8-bit groups, each converted to a decimal number 0–255 and connected by dots, e.g., 192.168.1.1.
Decimal Integer
Treating the 32-bit IPv4 address as a single unsigned integer in the range 0–4294967295. Commonly used for database storage (e.g., MySQL's INET_ATON function) and range comparison.
Binary
The raw 32-bit binary representation of an IPv4 address, with 8 bits per octet. Bitwise operations for subnet masks and CIDR prefixes all occur at the binary level.
Hexadecimal
An 8-digit hexadecimal representation prefixed with 0x, where each 2 digits correspond to one octet. Commonly seen in packet capture analysis (e.g., Wireshark) and low-level protocol debugging.
Octet
Each dot-separated 8-bit segment in an IPv4 address is called an octet, with values from 0–255. Four octets make up the complete 32-bit address.
Network Byte Order
TCP/IP protocols specify Big-Endian for transmitting multi-byte data, meaning the most significant byte comes first. The writing order of dotted decimal is consistent with network byte order.
CIDR (Classless Inter-Domain Routing)
A notation using a /prefix length to indicate network bits, e.g., /24 means the first 24 bits are network bits and the last 8 bits are host bits.
Subnet Mask
A 32-bit binary number where network bits are all 1s and host bits are all 0s, used to distinguish the network portion from the host portion of an IP address, e.g., 255.255.255.0.
Wildcard Mask
The bitwise NOT of a subnet mask, where 0 means must match and 1 means ignore. Used in ACL and routing configurations, e.g., 0.0.0.255 corresponds to /24.
INET_ATON / INET_NTOA
Classic function names for IP address-to-integer conversion. ATON (ASCII to Number) converts dotted IP to integer; NTOA (Number to ASCII) does the reverse. Available in MySQL, PHP, and C.

Common IPv4 Address Ranges and Base Comparison

0.0.0.000x0000000000000000 00000000Default route / unspecified address
10.0.0.01677721600x0A00000000001010 00000000Private Class A address range start
127.0.0.121307064330x7F00000101111111 00000000Local loopback address
172.16.0.028867297280xAC10000010101100 00010000Private Class B address range start
192.168.0.032322355200xC0A8000011000000 10101000Private Class C address range start
192.168.1.132322357770xC0A8010111000000 10101000Common home router default gateway
255.255.255.042949670400xFFFFFF0011111111 11111111/24 subnet mask
255.255.255.25542949672950xFFFFFFFF11111111 11111111Limited broadcast address

Reserved/Special IPv4 Address Range Quick Reference

0.0.0.0/8This Network0 – 16777215Represents "this host on this network", used only as source address
10.0.0.0/8Private Class A167772160 – 184549375Enterprise internal network, not routed on the public internet
127.0.0.0/8Loopback2130706432 – 2147483647Local loopback testing, packets never leave the network interface
169.254.0.0/16Link-Local2851995648 – 2852061183Auto-assigned when DHCP fails (APIPA)
172.16.0.0/12Private Class B2886729728 – 2887778303Enterprise internal network, not routed on the public internet
192.168.0.0/16Private Class C3232235520 – 3232301055Home/small office internal networks
224.0.0.0/4Multicast3758096384 – 4026531839Multicast addresses
240.0.0.0/4Reserved4026531840 – 4294967295Reserved for experimental use; 255.255.255.255 is broadcast

Authoritative References

  • Reference
  • Reference
  • Reference