gettoolz.app

Binary to hex converter

Convert binary numbers to hex — every 4 bits become one hex digit. Exact at any size, with a worked example and a table of common values. Free, and computed in your browser.

Part of developer tools.

Base

Binary

10101101

Octal

255

Decimal

173

Hexadecimal

AD

Binary to hex table

DecimalBinaryHex
000
111
2102
3113
41004
51015
61106
71117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
161000010
100110010064
12711111117F
25511111111FF
256100000000100
100011111010003E8
102410000000000400
409610000000000001000
655351111111111111111FFFF
429496729511111111111111111111111111111111FFFFFFFF
184467440737095516151111111111111111111111111111111111111111111111111111111111111111FFFFFFFFFFFFFFFF

The last rows are the largest 32-bit and 64-bit unsigned values. The second is past the point where ordinary JavaScript numbers start rounding; the table and the converter above both compute with BigInt, so every digit is exact.

How to convert binary to hex

Split the binary number into groups of 4 bits, starting from the right, and pad the leftmost group with zeros if it comes up short. Each group is exactly one hex digit, because 16 = 2⁴: no carrying and no arithmetic across groups, just a lookup of 16 possible patterns. For 10101101: 1010 1101; then 1010 → A, 1101 → D — so 10101101 in binary is AD in hex.

Binary and hex side by side

The largest 16-bit value is 1111111111111111 in binary and FFFF in hex: 16 digits against 4. Every hex digit is exactly 4 bits, so the lengths stay in a fixed ratio and any stretch of digits can be converted without looking at its neighbours. Hex is the usual way to write bytes — colours like #FF8800, memory addresses, hashes, escape sequences — because a byte is always exactly two hex digits. In JavaScript and Python source, 173 is written 0b10101101 in binary and 0xAD in hex. Paste a prefixed number into the converter and it switches to the matching base; a number with no prefix is read in the selected base — binary on this page.

Other conversions

Going the other way? Hex to binary converter.

Or open the full number base converter and see a number in all four bases at once.