Binary to Hex Converter
Convert numbers between binary, decimal, hexadecimal and octal. For reading register values, understanding color codes, setting pin configurations, or debugging Arduino and ESP32 code.
Last updated: June 2026
Enter a value to see the conversion instantly.
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 |
When you need this tool
Your ESP32 datasheet shows a register value of 0x3FF but your code uses decimal, and a single mistyped digit in the address points to the wrong register entirely, sending the wrong command to your hardware. Or the web designer sends you a color #FF5733 but your microcontroller needs three separate 0-255 values for R, G, B, and you need to translate without mistakes. Or you're debugging I2C communication: the logic analyzer shows binary 10110010 but the device manual lists 0xB2, and you need to confirm they match. One wrong digit in a number base conversion can cause your hardware to fail silently. This converter ensures you're reading datasheets correctly and translating between number systems without mistakes.
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
When do I need to convert between number bases?
Datasheets, register values, color codes and memory addresses use different bases. Hex is compact for large numbers. Binary shows bit patterns. Decimal is what humans read. Embedded engineers switch between them constantly when debugging registers, setting colors or checking addresses.
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's why datasheets and memory dumps use hex.
Why get the conversion right?
A single wrong digit in a register address (like 0x3E instead of 0x3F) points to the wrong memory location. Wrong color code sends the wrong LED color to production. Exact conversion prevents bugs and failed hardware initialization.
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.