Tool

IPv4 and number base converter

Convert IPv4 and integers between decimal, hexadecimal and binary with exact precision right in your browser.

Your data is processed locally in your browser and is not sent to our servers.

Conversion input

In automatic mode, four octets are interpreted as IPv4; 0xmeans hexadecimal and 0bmeans binary. Without a prefix, input is interpreted as decimal.

Enter an integer or IPv4 address to get its representations.

Verifiable example

An IPv4 address is a 32-bit unsigned integer divided into four octets. These four expressions represent exactly the same value:

Format Result
IPv4 192.168.1.1
Decimal 3232235777
Hexadecimal 0xC0A80101
IPv4 Binary 11000000.10101000.00000001.00000001

Enter either the dotted IPv4 address or the decimal integer to convert in either direction. Hexadecimal integers are also supported with 0x, and binary integers with 0b.

How input is detected

In automatic mode, four dotted octets are interpreted as IPv4, an input with 0x as hexadecimal, and an input with 0b as binary. An input without dots or a prefix is interpreted as a decimal integer.

You can also select the format explicitly. A prefix that does not match the selected base produces a validation error.

How to convert an IPv4 to an integer

Dotted decimal notation separates the integer into four bytes, from most significant to least significant. For 192.168.1.1, the calculation is:

192 × 256³ + 168 × 256² + 1 × 256 + 1 = 3232235777

RFC 1208 describes this notation as four 8-bit numbers representing a 32-bit integer. The tool exclusively supports four decimal octets between 0 and 255, according to the standard form defined by the RFC 3986.

IPv4 range and large integers

The IPv4 space ranges from 0.0.0.0, equivalent to 0, to 255.255.255.255, equivalent to 4294967295. Values within this interval also display a dotted IPv4 representation.

Negative numbers and values greater than 4294967295 can still be converted between decimal, hexadecimal and binary, but do not produce an IPv4 address. The general number conversion uses BigInt, so an integer like 18446744073709551615 is transformed exactly into 0xFFFFFFFFFFFFFFFF and into 64 binary ones.

Presentation and copy

For IPv4 input, hexadecimal output is padded to eight digits and binary output is displayed as four eight-bit octets. For general number conversion, grouping spaces are only a visual aid. Copy buttons return canonical values without those decorative spaces.

Common errors

  • An IPv4 must contain exactly four octets between 0 and 255.
  • Abbreviations such as 127.1 and empty octets are not supported.
  • Leading zeros such as 192.168.001.1 are rejected to avoid ambiguous interpretations.
  • In automatic mode, write 0xFF instead of FF to indicate hexadecimal.
  • A binary input can only contain 0 and 1.
  • Fractions, exponents or separators within an integer are not allowed.
  • A + or - sign must appear only once and at the beginning of an integer.

Edge cases

  • Integer inputs 0, -0 and +000 are normalized to 0.
  • 0.0.0.0 and 255.255.255.255 cover both ends of the IPv4 space.
  • Negative values retain their sign in all three number bases and do not display IPv4.
  • Leading zeros are valid in integers, but not within an IPv4 octet.
  • Numeric entry is limited to 4,096 digits to protect the responsiveness of the tab.
  • The tool converts representations; it does not determine whether an address is public, private, or routable.

Frequently asked questions

Is a decimal octet the same as the complete IPv4 integer?

No. In 192.168.1.1, each octet is already written in decimal, but the complete IPv4 integer combines all 32 bits and produces 3232235777.

Can I convert a decimal integer back to an IP?

Yes, as long as it is between 0 and 4294967295. The tool divides the value into four octets and displays the normalized address.

Why doesn’t a negative integer produce an IPv4?

IPv4 uses 32 unsigned bits. Negative integers are valid for general conversion between bases, but do not represent an IPv4 address.

Is the negative result in two’s complement?

No. Negative output uses a sign, for example -0x2A. A two’s complement representation requires a specific word width, which this tool does not assume.

Is the entered address or number saved?

No. Input and results remain in the current tab and are not persisted by the tool.

Reviewed on by Tools in a Tab.