Binary to Hex Converter

Quick answer: 11111111 binary = FF hex (one hex digit per four bits). Use this when a datasheet gives you a register value in hex but your code prints it in binary, or when a debugger dumps raw bit patterns you need to compare against 0x-prefixed constants.

Last updated: June 2026

Paste a register value or binary string above and the hex equivalent appears here.

How to use this number base converter

Type your number in any base and see it in all other bases instantly. The quick buttons show 11111111 in binary (8 bits all high), 255 in decimal (max value for 8-bit unsigned), FF in hex (same value, compact notation), and 377 in octal (less common but still used in some embedded systems).

Common number base reference values

DecimalBinaryHexadecimalOctalCommon use
000000x00GPIO pin LOW
100010x11GPIO pin HIGH
1511110xF174-bit nibble max
255111111110xFF3778-bit byte max / RGB color max
102311111111110x3FF177710-bit ADC max value
40951111111111110xFFF777712-bit ADC/DAC max
6553511111111111111110xFFFF17777716-bit unsigned max

Binary to hex without losing a bit

This converter is most useful in two moments: reading a datasheet register map and translating a value your logic analyzer printed in binary into the hex constant your firmware actually uses, or verifying that a bit-field mask written as 0b00111100 in one file matches the 0x3C it becomes in another. Both cases call for a fast, exact translation with no mental arithmetic in between.

The most common mistake is grouping bits from the left instead of the right. Binary-to-hex works by replacing each four-bit nibble with one hex digit, but that grouping must start at the rightmost bit. If you have a 10-bit ADC value like 1011001100, the right-anchored split is 10 | 1100 | 1100, giving 0x2CC after left-padding the leading group to 0010. Start from the left and you get different groups entirely, producing a wrong hex value that will still look plausible in code.

A related trap: forgetting to pad. If the total bit count is not a multiple of four, the leftmost group is short and must be padded with leading zeros before you look up its hex digit. The number 101 is not three bits mapping to a single nibble of 5; it is 0101, which is also 5 in this case, but the step matters because 1101 and 101 look similar until the pad reveals they are the same nibble in one reading and an incomplete one in another.

Signedness is the third trap. This converter treats all input as unsigned, which is correct for addresses, color channels, GPIO masks, and most hardware registers. If you are working with a signed two's-complement value (a temperature reading in a sensor register, a signed 16-bit result from a DSP), the hex output here is still the correct bit pattern. Just be aware that the bit pattern for -1 in an 8-bit signed integer is 11111111, which this tool will show as FF, not as negative one. That is the right answer for a hardware perspective but may surprise you if you expected a negative decimal result.

How to convert binary to hex by hand

Because every hex digit maps to exactly four binary digits, you can convert between the two without any arithmetic: just group the bits. Starting from the right, split the binary number into groups of four (pad the leftmost group with zeros if needed), then replace each four-bit group with its hex digit. To go the other way, expand each hex digit back into its four bits.

For example, 10110010 splits into 1011 and 0010, which are B and 2, giving 0xB2. The byte 11111111 splits into 1111 and 1111, which is FF. The nibble table below is the only thing you need to memorize.

BinaryHexBinaryHex
0000010008
0001110019
001021010A
001131011B
010041100C
010151101D
011061110E
011171111F

Frequently Asked Questions

My logic analyzer shows a binary value but the datasheet uses hex: how do I match them up?

Group the binary output into nibbles of four bits starting from the right, pad the leftmost group with zeros if it is short, then replace each nibble with its hex digit using the table above. A logic analyzer showing 10110010 splits into 1011 and 0010, which is B and 2, confirming it matches 0xB2 in the datasheet. One misread nibble sends your I2C command to the wrong address.

What is the relationship between binary and hex?

Every hex digit is exactly 4 binary digits. 0xFF in hex is 11111111 in binary. This makes hex a shorthand for binary: it takes 8 characters to write 1 byte in binary but only 2 in hex. That is why register maps and memory dumps use hex while debuggers that expose individual bit states prefer binary.

Why does grouping from the left give the wrong hex value?

Because the nibble boundary must align to the least-significant bit, not the most-significant one. Take 101010: grouping from the left gives 1010 and 10, which you might read as A and 2. Grouping from the right gives 10 and 1010, which after padding becomes 0010 and 1010, producing 0x2A (decimal 42). The second answer is correct. Padding the short group on the left, not the right, is what makes the math work.

How do I convert binary to hex by hand?

Split the binary number into groups of four bits starting from the right, padding the left with zeros if needed, then swap each group for its hex digit. So 10110010 becomes 1011 and 0010, which is B and 2, or 0xB2. It works because one hex digit always equals exactly four bits.

What do the 0x and 0b prefixes mean?

They tell you which base a number is written in. 0x marks hexadecimal (0xFF), 0b marks binary (0b1010), and a leading 0 or 0o marks octal in many languages. Decimal needs no prefix. The prefixes matter because 10 means ten in decimal but sixteen when written 0x10.

Embed this tool

Use this converter on your own website by copying the iframe code below.