Cipher Utility

Binary to Hex Converter

E-10

Binary to hexadecimal, four bits to a digit, with the groups shown. Runs in your browser; nothing is sent anywhere.

Spaces:
Case:
Zeros:
Group:

Groups of four bits

How to convert by hand

  1. Split the bits into groups of four, starting from the right.
  2. Fill the leftmost group with zeros.
  3. Add up each group with the values 8, 4, 2, 1.
  4. Write 10 to 15 as A to F.

Worked example

101101 = ?

0010   1101
   2     13
   2      D

Two zeros fill the first group:

101101 = 2D

Cipher Utility reference card Catalog no. E-10

How to convert binary to hex

One hex digit holds exactly four bits, because 16 is 2 to the power 4. That means you can convert binary to hexadecimal without going through decimal. Split the bits into groups of four, starting from the right, and replace each group with its hex digit.

1011011101 0010 1101 1101 2 D D 1011011101 = 2DD

The leftmost group had only two bits (10), so two zeros were added in front of it. Zeros on the left never change the value. In the working table under the converter, the added zeros are shown in a lighter colour.

Binary to hex table

BinaryHexDecimalBinaryHexDecimal
000000 100088
000111 100199
001022 1010A10
001133 1011B11
010044 1100C12
010155 1101D13
011066 1110E14
011177 1111F15

These 16 rows are all you need, because any binary number, however long, is made of these groups.

Why programmers write binary as hex

A byte is 8 bits, which is exactly two hex digits. 11111111 becomes FF, and a 32-bit value takes 8 hex digits instead of 32 binary ones. Hex is four times shorter and still shows the bits clearly once you know the table above, so it is the usual way to write colour codes such as #FF8800, memory addresses and raw file contents.

Keeping whole bytes

The converter writes one hex digit for every four bits you type, so 00001111 gives 0F and the byte stays two digits long. If you paste several bytes separated by spaces, Spaces set to Ignore gives one long hex number, and Split gives one hex value per byte.

01001000 01101001 Ignore 4869 Split 48 69

Binary fractions in hex

Bits after a binary point are grouped from the point to the right, and zeros are added at the end of the last group. 101.1 becomes 0101.1000, which is 5.8 in hex. Both are 5.5 in decimal.

Binary to octal

Octal works the same way with groups of three bits, because 8 is 2 to the power 3. 101101 splits into 101 and 101, which is 55 in octal and 45 in decimal. Octal is still used for Unix file permissions, where 755 means rwxr-xr-x.

Binary that spells words

If your binary is text in groups of 8 bits, the hex result is the same bytes written in hex. To read the letters, paste the binary into the Binary Translator or the hex into the Hex Decoder.

Questions about binary to hex

What is 11111111 in hex?

FF. Split it into 1111 and 1111. Each group is 15, and 15 is F in hex.

What is 1010 in hex?

A. 1010 is 8 + 2 = 10, and hex writes 10 as A.

Why are the bits grouped in fours?

Four bits have exactly 16 combinations, because 2 to the power 4 is 16. Hex has 16 digits, so each group of four bits matches one hex digit. Groups of three bits give 8 combinations, which is how binary to octal works.

What if the number of bits is not a multiple of four?

Add zeros on the left until the leftmost group has four bits. 101101 becomes 0010 1101, which is 2D. The converter does this for you and shows the added zeros in a lighter colour in the working table.

Should hex be upper or lower case?

Either one. A1 and a1 are the same number. Use the Case option to match whatever you are pasting the result into.

Is my input sent to a server?

No. The conversion runs in your browser with JavaScript, and nothing you type leaves your device.