Binary to Hexadecimal Converter

Enter a number and pick the conversion direction.

Result

D7A
3,450
12 bits

How it is calculated

Binary to hex: the bit string is padded on the left with zeros to a multiple of 4, cut into groups of four bits (nibbles), and each nibble becomes one hex digit, printed in uppercase (1010 = A). Hex to binary: each hex digit is expanded to four bits, then leading zeros are removed, keeping at least one digit. The decimal line is the exact value Σ digit × baseposition, with positions counted from the right starting at 0; it is computed with whole-number arithmetic, so even a 64-bit all-ones input gives 18,446,744,073,709,551,615. The length line counts the bits or hex digits you typed. Input must contain only 0 and 1, or 0–9 and A–F (either case), up to 4096 bits or 1024 hex digits; longer input shows no result.

Worked example

Convert the binary number 110101111010. It has 12 bits, already a multiple of 4. Split it into 1101, 0111 and 1010. These nibbles are 13, 7 and 10, which are the hex digits D, 7 and A, so the result is D7A. Check in decimal: 13 × 256 + 7 × 16 + 10 = 3,328 + 112 + 10 = 3,450. The tool reports D7A, decimal 3,450 and a length of 12 bits.

Try this example →

Common mistakes

  • Typing spaces between nibbles (1101 0111 1010) or a 0x prefix. Both make the tool show no result; remove them first.
  • Grouping the bits from the left. The groups of four must start from the right, which is why 11010 is padded to 00011010 and gives 1A, not D0.
  • Expecting leading zeros back in hex to binary. 00FF becomes 11111111, while the length line still counts the four digits you typed.
  • Leaving the direction on binary to hex when the input is hex. A value like FF is then rejected because it contains letters.
  • Pasting a very long string without checking its size. Binary above 4096 bits or hex above 1024 digits is refused rather than truncated.

About this calculator

Binary and hexadecimal are both positional number systems used throughout computing — binary (base 2) reflects how hardware stores data as on/off bits, while hexadecimal (base 16) packs exactly four bits into each digit, making it a compact, human-readable shorthand for binary strings. This converter moves in either direction, showing the matching decimal value and bit/digit length alongside the result.

Hex-binary conversion is a daily task for software developers, network engineers, and computer science students — reading memory addresses and dumps, decoding color codes (like #FF00FF), configuring subnet masks and MAC addresses, and working with low-level protocols where data is typically documented in hex but processed in binary at the hardware level.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Colour codes make a good practice case. The hex value FF00FF, magenta, has 6 digits and expands to 24 bits: 111111110000000011111111, which is 16,711,935 in decimal. The length line reports the 6 digits you typed, not the 24 bits, so keep the two straight. In the other direction, the bit count tells you how many leading zeros to restore if you need a fixed width. What width do you usually work with, 8, 16 or 32 bits?

Popular calculators

All Calculators