IP information · Local calculator

IP Address Notation Converter

Convert an IPv4 or IPv6 literal between normalized notation and full-width numeric forms. For IPv6, compare the canonical compressed spelling with all eight expanded groups.

Inputs

Result

Normalized address
2001:db8::2
Address family
IPv6
Binary
00100000000000010000110110111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010
Decimal
42540766411282592856903984951653826562
Hexadecimal
20010db8000000000000000000000002
Expanded IPv6
2001:0db8:0000:0000:0000:0000:0000:0002

Address notation is converted locally. The displayed value does not establish ownership or reachability.

In this guide12 sections

Introduction

Convert an IPv4 or IPv6 literal between normalized notation and full-width numeric forms. For IPv6, compare the canonical compressed spelling with all eight expanded groups.

Formula and calculation

Address value from positional digits
value = Σ digit[i] × base^i; base = 2, 10, or 16

The notation converter formats the same unsigned IPv4 or IPv6 integer as binary, decimal, and hexadecimal. Its leading zeroes preserve the family's fixed address width in formatted output.

digit[i] · base digit
digit at position i, counted from the right
base · 2, 10, or 16
number system used for the notation

Method and concepts

IPv6 text can vary while representing the same 128-bit value. Canonical presentation uses lowercase hexadecimal, removes leading zeroes within each group and compresses the longest run of at least two zero groups. If two longest runs tie, it compresses the first; a single zero group remains explicit. Expansion restores exactly eight four-digit groups.

  1. Enter one IPv4 or IPv6 address literal without a prefix or zone identifier.
  2. Read the normalized address and the full-width binary, unsigned decimal and hexadecimal forms.
  3. For IPv6, compare the canonical address with Expanded IPv6. Use the expanded groups to locate bit positions; use the compressed form for consistent text display.

Binary mathematics for network engineers diagram

  1. Host octet · 10101101
  2. AND mask · 11100000
  3. Network · 10100000
  4. OR wildcard · 10111111
For 173 with a /27 boundary, masking gives the block start 160. Setting the five host bits gives its inclusive end 191.

Worked examples

Compress and expand the same IPv6 value

  1. Enter 2001:0DB8:0000:0000:00AB:0000:0000:0001.
  2. Lowercase the hex and remove group-leading zeroes. The two tied zero runs each contain two groups, so canonical notation compresses the first: 2001:db8::ab:0:0:1.
  3. The expanded display is 2001:0db8:0000:0000:00ab:0000:0000:0001. Both forms encode the same eight groups and 128 bits.

Binary mathematics for network engineers: Check the fourth octet of 192.0.2.173/27

  1. Decompose 173 into 128 + 32 + 8 + 4 + 1, giving 10101101. The fourth mask byte for /27 is 11100000, or 224.
  2. AND the two bytes to get 10100000, or 160. Complement 11100000 within eight bits to get wildcard 00011111, or 31.
  3. OR 10100000 with 00011111 to get 10111111, or 191. Count inclusively: 191 − 160 + 1 = 32, which matches 2^5 host-field patterns.

Reference table

IP Address Notation Converter reference
RepresentationExampleUse
Input spelling2001:0DB8:0000:0000:00AB:0000:0000:0001Valid literal supplied to the converter
Canonical compressed2001:db8::ab:0:0:1Consistent lowercase text with the first longest zero run compressed
Expanded groups2001:0db8:0000:0000:00ab:0000:0000:0001Fixed-width groups for diagrams and bit-boundary inspection

Reading the result

Use canonical text to compare or copy IPv6 addresses consistently. The expanded form makes group and bit positions visible. Neither notation assigns a prefix or establishes address ownership or reachability.

Common mistakes

  • Compressing more than one zero run with ::, which makes the missing group count ambiguous.
  • Removing trailing zeroes from a group instead of only leading zeroes.
  • Assuming address notation supplies a prefix length or proves network reachability.

Frequently asked questions

How is a tie between IPv6 zero runs resolved?

Compress the first longest run when the longest runs have equal length. Runs must include at least two consecutive zero groups; a single zero remains explicit.

Does the expanded form represent a different address?

No. It restores the omitted zero groups and leading zeroes. The compressed and expanded forms represent the same 128-bit value.

How do shifts relate to multiplication?

For an unsigned integer, shifting left one place multiplies it by two if the result still fits. A fixed-width register can lose its top bit on overflow.

Why does 255 + 1 become 256 on paper?

The exact sum has nine bits, 100000000. An eight-bit register needs an overflow indication or a defined wrapping rule to represent that operation.

Why do binary place values double from right to left?

Binary is base two. Each position is one power of two, so moving one place left multiplies its value by two.

How many bits are in a byte?

A byte contains eight bits. The byte can represent 256 distinct patterns, from 00000000 through 11111111.

Why is a subnet mask useful in binary?

A bitwise AND between an address and a contiguous mask preserves prefix bits and clears host bits, producing the network address.

Can hexadecimal shorten an IPv6 address without changing its value?

Yes. Hexadecimal groups four bits per digit, so it is a compact way to display 128-bit values. Zero compression changes notation, not the address bits.

What does two's complement do?

It is a common fixed-width representation for signed integers. The same bit pattern has a different interpretation depending on whether it is treated as signed or unsigned.

What does a bitwise AND do to a mask and address?

Each output bit is one only where both corresponding input bits are one. With a contiguous subnet mask, this preserves the prefix bits and clears host bits.

Why must a bitwise operation specify width?

Fixed-width operations constrain results to a chosen number of bits. Without a width, leading zeroes and overflow behavior can differ between mathematical integers and machine values.

How many bits does one hexadecimal digit represent?

One hexadecimal digit represents four binary bits. Two hex digits make one byte, which is why IPv6 hextets and MAC octets are naturally written in hex.

How do I convert a small binary number to decimal?

Multiply each bit by its power-of-two place value and add the results. For example, 10110₂ is 16 + 4 + 2 = 22₁₀.

Why group binary digits into fours when writing hexadecimal?

Each hex digit maps exactly to four bits. Grouping bits this way makes long address values shorter while preserving the exact bit pattern.

What is the difference between a signed and unsigned integer?

An unsigned fixed-width value treats all bits as magnitude. A signed representation reserves patterns for negative values, often using two's complement, so the same bit string can have a different decimal interpretation.

Does integer overflow wrap automatically in every calculator?

No. Behavior depends on the implementation and chosen width. A fixed-width calculator may reject an overflow, wrap, or report a carry, so inspect its documented range.

What does a bitwise OR do?

It sets an output bit when either corresponding input bit is one. It is often used to combine bit flags, while AND isolates bits and XOR highlights differences.

Further learning and references