Advertisement

Binary to hexadecimal converter

Group long binary strings into readable hexadecimal digits, or expand a hexadecimal integer back into bits.

Calculator

Decimal integer
175
Binary representation
10101111
Octal representation
257
Hexadecimal representation
AF
Minimum unsigned bits
8
Same integer in four bases
BaseRepresentation
Decimal (10)175
Binary (2)10101111
Octal (8)257
Hexadecimal (16)AF

Advertisement

How this calculator works

Each hexadecimal digit corresponds to four bits because 16 equals 2 to the fourth power. Start grouping from the right; pad the leftmost group conceptually with zeros. The output uses uppercase A through F and removes insignificant leading zeros. Reverse conversion gives a minimum-length unsigned bit string. Large integers are processed exactly rather than converted through a floating-point decimal number.

Formula

One hex digit = four bits. 0000 through 1001 map to 0 through 9; 1010 through 1111 map to A through F.

Worked example

Binary 10101111 splits as 1010 and 1111, giving AF. The decimal check is 10 x 16 + 15 = 175. Hexadecimal 100 is binary 100000000 and decimal 256.

Advertisement

Frequently asked questions

Which side should I group from?

Group from the rightmost digit so each four-bit group keeps its correct power of sixteen.

Can I paste 0b or 0x?

Enter digits only. Prefixes, spaces and separators are intentionally rejected so an input is unambiguous.

Why did leading zeros disappear?

They do not affect an unsigned integer. Use the binary converter when you need a fixed-width word.

Sources

Advertisement