Binary to Hexadecimal Converter

Convert a binary number into hexadecimal and a hexadecimal number back to binary.

Supports binary and hexadecimal integers of any length with full working precision.

Updated August 12, 2026
Frank Zhao - Creator
CreatorFrank Zhao
Loading calculator…

Introduction / overview

Binary to Hexadecimal Converter turns any whole binary number into its hexadecimal equivalent and back again. Because every four binary digits — one nibble — collapse into a single hex digit, the tool also shows the binary value grouped into nibbles, so 111111101111111101 appears as 0001 1111 11010001\ 1111\ 1101 instead of a hard-to-read run of digits.

Both fields are editable. Type a binary string and the hexadecimal value appears; type a hex value and the binary appears. The Results panel below always shows the clean, copy-friendly forms: the nibble-grouped binary and the standard uppercase hex.

It is the tool to reach for when you are decoding a value from code, a network trace, a color, or a register dump — or just double-checking a conversion you did by hand. Every conversion is exact, and there is no fixed bit-width cap, so values of any length work as long as they are non-negative whole numbers.

How to use / quick start

1

Type a binary number

In the Binary field, enter a string made only of 0s and 1s. Leading zeros are fine but not required — the tool works with the value, not the number of digits you typed.

2

Read the other field — or go the other way

The Hexadecimal field fills in automatically. You can also type a hex value instead — digits 0–9 and letters A–F, upper or lower case — and the binary field updates. The editable fields keep exactly what you type, so a lowercase fafa stays lowercase.

3

Grab the canonical form from Results

The Results panel shows the nibble-grouped binary (for example 0001 1111 1101) and the standard uppercase hex (1FD) — the two forms you would paste into code or documentation.

Example — convert 111111101 to hex

Type 111111101111111101 in the Binary field. The tool pads the nine bits to the next nibble boundary and groups them:

1111111012111111101_2  \ \to\ 0001 1111 11010001\ 1111\ 1101  \ \to\ 1FD161FD_{16}

The Results panel reads Binary (grouped): 0001 1111 1101 and Hexadecimal (standard): 1FD, and the note above it says this is a 12-bit representation.

Calculation method

Binary to hexadecimal is a place-value conversion. Starting from the right, the binary digits are split into groups of four (nibbles); if the leftmost group has fewer than four bits, it is padded with leading zeros so every group lines up. Each nibble is a value from 0 to 15, which maps to a single hex digit.

hk=8b4k+3+4b4k+2+2b4k+1+b4k,H=k=0m1hk16m1kh_k = 8 b_{4k+3} + 4 b_{4k+2} + 2 b_{4k+1} + b_{4k}, \qquad H = \sum_{k=0}^{m-1} h_k \cdot 16^{m-1-k}

Going the other way, each hex digit expands back into its own four-bit pattern — 00 to 00000000, AA to 10101010, FF to 11111111 — and the patterns are joined in order.

Worked example

Split 111111101111111101 into nibbles from the right, padding the leftmost group:

0001 1111 11010001\ 1111\ 1101  \ \Rightarrow\ 1, F, D1,\ F,\ D  \ \Rightarrow\ 1FD161FD_{16}

Each nibble becomes one hex digit, and the digits keep the same order as the groups.

Variables

  • HH — the hexadecimal value
  • mm — the number of nibbles (hex digits)
  • hkh_k — the kk-th hex digit (0–9, A–F)
  • bib_i — the bit at position ii (0 or 1)

Frequently asked questions

Why does the binary result show leading zeros?

Because one hex digit always stands for four bits, the binary value is padded to the next nibble boundary so every group is complete. 111111101111111101 has nine bits, so it is shown as 0001 1111 11010001\ 1111\ 1101 (12 bits). The leading zeros do not change the value.

I typed lowercase “fa” but Results shows “FA” — did my input change?

No. The editable Hexadecimal field keeps exactly what you typed, so lowercase fafa stays lowercase while you work. The Results panel always shows the standard uppercase form FAFA for clean copying — both represent the same value.

Can I convert negative numbers or fractions?

No — this tool converts non-negative whole numbers only. The Binary field accepts only 0 and 1, and the Hexadecimal field accepts only 0–9 and A–F, so a minus sign, decimal point, or fraction is not valid input. For negative or fixed-width binary, use the binary converter.

Limitations

This calculator accepts non-negative whole numbers only: the Binary field takes the digits 0 and 1, and the Hexadecimal field takes 0–9 and A–F. A minus sign, decimal point, or any other character produces a “Enter a valid number.” message and the value is not converted. There is no fixed bit-width cap, and because the conversion is an exact integer operation the result is never rounded — the grouped form simply adds the leading zeros needed to complete nibbles.

Binary to Hexadecimal Converter - Convert Between Base-2 and Base-16