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
| Decimal | Binary | Hexadecimal | Octal | Common use |
|---|---|---|---|---|
| 0 | 0000 | 0x0 | 0 | GPIO pin LOW |
| 1 | 0001 | 0x1 | 1 | GPIO pin HIGH |
| 15 | 1111 | 0xF | 17 | 4-bit nibble max |
| 255 | 11111111 | 0xFF | 377 | 8-bit byte max / RGB color max |
| 1023 | 1111111111 | 0x3FF | 1777 | 10-bit ADC max value |
| 4095 | 111111111111 | 0xFFF | 7777 | 12-bit ADC/DAC max |
| 65535 | 1111111111111111 | 0xFFFF | 177777 | 16-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.
| Binary | Hex | Binary | Hex |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | A |
| 0011 | 3 | 1011 | B |
| 0100 | 4 | 1100 | C |
| 0101 | 5 | 1101 | D |
| 0110 | 6 | 1110 | E |
| 0111 | 7 | 1111 | F |
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.