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.
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
| Binary | Hex | Decimal | Binary | Hex | Decimal |
|---|---|---|---|---|---|
| 0000 | 0 | 0 | 1000 | 8 | 8 |
| 0001 | 1 | 1 | 1001 | 9 | 9 |
| 0010 | 2 | 2 | 1010 | A | 10 |
| 0011 | 3 | 3 | 1011 | B | 11 |
| 0100 | 4 | 4 | 1100 | C | 12 |
| 0101 | 5 | 5 | 1101 | D | 13 |
| 0110 | 6 | 6 | 1110 | E | 14 |
| 0111 | 7 | 7 | 1111 | F | 15 |
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.
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.