Binary to Hexadecimal Converter
Enter any binary number, whole or fractional, to get the hexadecimal equivalent instantly. The converter groups your binary digits into 4-bit nibbles, maps each nibble to its hex digit, and shows you the full working step by step. You also get the decimal value and a nibble reference table.
How binary to hexadecimal conversion works
Binary (base 2) and hexadecimal (base 16) have a special relationship: 16 is exactly 2 to the power of 4, so one hex digit maps to exactly four binary bits, called a nibble. To convert, you split the binary integer from right to left into 4-bit groups, padding the leftmost group with leading zeros if it is fewer than 4 bits, and then replace each group with its hex equivalent. For fractional parts, you group from the dot leftward to right, padding with trailing zeros. Because the mapping is direct and lossless, the conversion never introduces rounding errors.
Step-by-step example: 11011010 to hex
Start with 11011010. Split into nibbles from the right: [1101] [1010]. Convert each nibble using the reference table: 1101 is 13 in decimal, which is D in hex; 1010 is 10 in decimal, which is A in hex. Concatenate: DA. So 11011010 in binary equals DA in hexadecimal, and 218 in decimal. You can verify: D (13) times 16 plus A (10) equals 208 plus 10 equals 218.
Fractional binary numbers and hexadecimal
If your binary number has a fractional part (a binary point), group the fractional digits in sets of four from the binary point rightward, padding the last group with trailing zeros if needed. For example, 1011.101 splits into [1011].[1010], giving B.A in hex. Fractional hex notation is common in IEEE 754 floating-point representations and in color depth calculations. The conversion remains exact because no rounding is involved.
Why hexadecimal matters in computing
Hexadecimal is the lingua franca of low-level computing because it is far more compact than binary while still mapping perfectly onto binary. One byte (8 bits) is always exactly 2 hex digits (00 to FF). Memory addresses, color codes (such as #FF5733 in web design), machine instructions, and debugging output all use hex because it is readable yet directly translatable back to bits without arithmetic. A programmer reading 0xDA knows instantly that the upper nibble is 1101 and the lower is 1010, something impossible to see at a glance in decimal.
Binary to Hexadecimal Nibble Reference Table
| Decimal | Binary (nibble) | Hexadecimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
Each hex digit maps to exactly one 4-bit binary nibble. This table covers all 16 possible nibble values.
Frequently asked questions
How do I convert binary to hexadecimal by hand?
Group the binary digits into sets of 4, starting from the right (least significant end). Pad the leftmost group with leading zeros if it has fewer than 4 digits. Then look up each 4-bit group in the nibble table: 0000 is 0, 0001 is 1, ..., 1010 is A, 1011 is B, ..., 1111 is F. Write the hex digits in the same order and you are done. No arithmetic is required beyond memorizing or looking up the 16 nibble values.
How many binary digits equal one hexadecimal digit?
Exactly four binary digits (one nibble) equal one hexadecimal digit. This is because 2 to the power 4 is 16, which is the base of the hexadecimal system. So an 8-bit byte equals exactly 2 hex digits, a 16-bit word equals 4 hex digits, and a 32-bit value equals 8 hex digits.
Can I convert a fractional binary number to hexadecimal?
Yes. Group the fractional bits into sets of 4 from the binary point going right, padding the last group with trailing zeros on the right if it is short. Convert each group to its hex digit just like you would for the integer part. For example, 0.1010 has one group of 4 bits (1010 = A), so the result is 0.A in hex.
Is 0x just a prefix for hexadecimal numbers?
Yes. In most programming languages (C, C++, Java, Python, JavaScript, and many others), the prefix 0x or 0X signals that the following digits are in base 16. For example, 0xDA is the same number as 218 in decimal or 11011010 in binary. The prefix itself is not part of the numeric value.
What is a nibble and why does it matter?
A nibble is a group of 4 binary bits. It matters because it represents exactly one hexadecimal digit (values 0-15, or 0-F). A byte is two nibbles (8 bits, or 2 hex digits). This neat relationship makes hex a natural shorthand for binary: you can read hex digit by digit and mentally expand each one to its 4-bit equivalent, or collapse 4 bits into a single character when writing.