Number base conversion

Binary to Hex Calculator

Convert a whole number from binary (base 2) to hexadecimal (base 16) using exact four-bit groups.

Base 2 input

Enter a binary integer

Base 2 → 16
Base 16 output

Hexadecimal equivalent

The hexadecimal value will appear here

Enter a binary integer using only 0 and 1.

What Is Binary to Hexadecimal Conversion?

The Binary to Hex Calculator writes an unsigned binary integer in hexadecimal. Enter up to 1,000 bits using only 0 and 1. The main Hexadecimal value card shows the exact result, using uppercase A–F.

One hex digit represents four bits. The converter groups integer bits from the right, pads the leftmost group when needed and maps each group to a hex digit. It removes unnecessary leading zeroes rather than preserving a fixed bit width or interpreting signed data.

How to Group Binary Bits into Hex Digits

  1. Enter one binary integer in Binary number. Use only 0 and 1, with no internal spaces, commas, sign, 0b prefix or binary point.
  2. Keep the entry within 1,000 bits. Leading zeroes are accepted and count toward the input limit.
  3. Select Convert to hexadecimal. Read Hexadecimal value and the repeated Hexadecimal integer.
  4. Read letters A–F as digit values 10–15. The output uses uppercase and has no 0x prefix.
  5. For a manual check, form groups of four starting at the right, add zeroes only at the left of a short first group, then translate each group in order.

The page converts one integer in a fixed direction. It does not add a decimal card, generated grouping table, signed format, word-size selector or character decoder. Grouping spaces in this guide explain the method but are not valid input.

Four-Bit Values and Left Padding Formula

Hex digit value = 8 × left bit + 4 × next bit + 2 × next bit + right bit

Left padding = (4 − (normalized bit count mod 4)) mod 4

The first formula assigns the four positions weights 8, 4, 2 and 1. A group such as 1101 has value 13, which is written as D. McMaster’s number-system notes explain hexadecimal grouping and digit values.

In the padding expression, mod 4 means the remainder after division by four. The expression adds zero to three zeroes at the left of the normalized input, ensuring complete groups. Appending those zeroes to the right would shift positions and change the number.

NPTEL’s hexadecimal/binary explanation supports four-bit grouping. The local controller normalizes leading zeroes, keeps a single zero for zero, pads the start and uses a lookup table to produce uppercase hex digits.

The result stays a string from endpoint to display. It is exact within the accepted input length and does not need a floating-point or intermediate decimal conversion. The explanatory groups are not additional visible outputs.

Binary Input, Padding and Hexadecimal Result

Binary number
An unsigned integer string of 1 to 1,000 bits. Only 0 and 1 are accepted.
Normalized bit count / left padding
Intermediate quantities used to complete four-bit groups. They are explanation terms rather than editable fields.
Hexadecimal value / Hexadecimal integer
The same exact base-16 result in the main result card, using uppercase A–F and no unnecessary leading zeroes.

Binary to Hexadecimal Grouping Example

Illustrative example. Enter 1011010011101, which has thirteen bits. Group from the right: 1 | 0110 | 1001 | 1101.

Add three zeroes at the left to complete the first group: 0001 | 0110 | 1001 | 1101. The groups map to 1 | 6 | 9 | D, giving 169D.

Check the value separately: hex 169D equals 1×4096 + 6×256 + 9×16 + 13 = 5789. An independent binary sum gives the same value. The added left zeroes do not change that unsigned integer.

Calculation check. Independent positional arithmetic, Python integer conversion and the endpoint agree. Adding leading zeroes to the input still gives 169D. The result’s uppercase letters are a display convention, not a change in value.

Example breakdown. The table follows the grouping rules explained above.

Four-bit groups for the illustrative input after left padding
Completed groupDigit valueHex digit
000111
011066
100199
110113D

Left Padding, Uppercase Digits and Signed Data

Padding belongs on the left of the highest group. This completes groups of four while keeping the ones position at the right. The output letters use uppercase as a consistent writing convention.

Illustrative unsigned binary inputs and normalized hexadecimal results
Binary inputHex outputInterpretation
1011010011101169DThree zeroes added at the left for grouping
0001011010011101169DSame value with written padding
11111111FFUnsigned pattern; no signed mode
00000Zero normalized

A hex letter is one digit even though its value needs two digits in decimal: D means thirteen. The code does not reverse the order of groups or reinterpret them as characters.

Signed formats attach meaning to a pattern using additional rules and a specified width. This page does not apply those rules. Keep a record’s width, signedness and byte order separate from this plain unsigned integer conversion.

How to Read the Hexadecimal Integer

Each hex digit summarizes four binary positions. The leftmost digit may summarize a group that needed padding. Those zeroes complete the grouping without implying that the original record had that many stored bits.

Start integer grouping at the rightmost bit, which occupies the ones position. Grouping from the left and padding the last group at the right shifts place values. It can produce a valid-looking hex string for the wrong number.

A leading 1 is not automatically a negative sign here. For example, binary 11111111 gives FF as an unsigned pattern. Its interpretation under a signed eight-bit format would require rules outside this tool.

Leading zeroes and original width do not survive as metadata. A reverse conversion through Hex to Binary can restore the same numerical value, but returns the shortest binary representation rather than the original padded field.

A 1,000-bit input produces at most 250 hex digits. The converter does not decode bytes as text, reverse byte order, encrypt data or format a colour value. Preserve the original data’s width and meaning separately if those properties matter.

Common Binary to Hex Mistakes

  • Grouping integer bits from the left instead of the right.
  • Padding a short group at the right and changing the value.
  • Pasting grouping spaces or a 0b prefix.
  • Entering digits other than 0 and 1.
  • Reading uppercase A–F as letters unrelated to numeric digit values.
  • Expecting the original leading zeroes or width to survive a round trip.
  • Assuming the converter applies a signed or byte-order convention.

Binary to Hex Questions

How do I convert binary to hexadecimal?

Group bits in fours from the right, pad the first group at the left if needed and map each group to a hex digit. The page returns uppercase digits without a prefix.

Where should I add padding zeroes?

Only at the left of the incomplete first group. Padding at the right changes the unsigned value.

What do A, B, C, D, E and F mean?

They represent digit values 10, 11, 12, 13, 14 and 15 in base 16. A four-bit group can represent any value from 0 to 15.

Can I enter spaces between bit groups?

No. Enter an unbroken sequence of 0 and 1. Visual groups in the example are teaching aids.

Why does 11111111 give FF rather than a negative result?

This is an unsigned conversion. The page does not apply an eight-bit signed format or two’s-complement interpretation.

Will the output preserve leading zeroes?

No. It returns a normalized integer. Record the original bit width separately when padding has meaning.

What happens if every input bit is zero?

The output is the single digit 0, not an empty value or a fixed-width row of zeroes.

How large can the hexadecimal output be?

The 1,000-bit input limit produces at most 250 hex digits. The result is exact because conversion uses character groups rather than floating-point rounding.

Sources and References