Binary to Hexadecimal Converter

Converting binary to hexadecimal is straightforward once you grasp the grouping method. Binary numbers use base-2 (only 0s and 1s), whilst hexadecimal uses base-16 (0-9 and A-F). Each hexadecimal digit represents exactly four binary digits, making the conversion remarkably efficient for computer programming and digital systems.

Quick Convert Common Binary Values

Binary to Hex Conversion Table

This table shows the relationship between 4-bit binary patterns and their hexadecimal equivalents. Every hexadecimal digit corresponds to precisely four binary bits.

Binary (4 bits) Hexadecimal Decimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15

How to Convert Binary to Hexadecimal

The direct method groups binary digits into sets of four and converts each group. This approach is far simpler than converting through decimal first.

1 Group the binary digits: Starting from the right, divide your binary number into groups of four digits. If the leftmost group has fewer than four digits, pad it with leading zeros.
2 Convert each group: Look up each 4-bit group in the conversion table to find its hexadecimal equivalent. Binary 1010 becomes A, 1111 becomes F, and so forth.
3 Combine the results: Write the hexadecimal digits in the same order as your binary groups, reading from left to right.

Worked Examples

Example 1: Convert 11010110 to hexadecimal
• Group into fours: 1101 0110
• Convert each group: 1101 = D, 0110 = 6
• Final result: D6
Example 2: Convert 101111 to hexadecimal
• Group into fours: 0010 1111 (padded left with zeros)
• Convert each group: 0010 = 2, 1111 = F
• Final result: 2F
Example 3: Convert 1111111111111111 to hexadecimal
• Group into fours: 1111 1111 1111 1111
• Convert each group: 1111 = F (four times)
• Final result: FFFF

Conversion Formula

Whilst there’s no single mathematical formula, the conversion principle relies on positional notation and grouping.

Each hex digit = 4 binary bits (nibble)

For manual conversions, remember that each binary position has a value: 8-4-2-1 from left to right within each group. Add up the values where you see a 1.

Note: The term “nibble” describes four bits, exactly half a byte. Each nibble maps perfectly to one hexadecimal character, which is why hex is so popular in computing.

Number System Comparison

Binary (Base-2)

Uses only 0 and 1. Each position represents a power of 2. Long strings can be cumbersome for humans to read and write.

Hexadecimal (Base-16)

Uses 0-9 and A-F. Each position represents a power of 16. Compact representation ideal for computer memory addresses and colour codes.

Why Convert?

Programmers use hex because it’s more concise than binary but still maps directly to binary patterns. This makes debugging and reading machine code much easier.

Extended Conversion Table

Here are common 8-bit binary values (one byte) and their hexadecimal equivalents.

Binary (8 bits) Hexadecimal Decimal
00000000000
000011110F15
000100001016
001000002032
010000004064
011111117F127
1000000080128
10101010AA170
11000000C0192
11110000F0240
11111111FF255

Everyday Uses

Binary to hex conversion appears throughout computing and digital technology.

  • Colour codes: Web colours like #FF5733 are hexadecimal representations of RGB values (red, green, blue). Each pair represents one colour channel in binary.
  • MAC addresses: Network hardware identifiers use hex format (e.g., A4:5E:60:E7:9B:F2) because it’s more compact than binary.
  • Memory addresses: Computer memory locations are typically shown in hexadecimal notation for readability.
  • Error codes: System error codes often appear as hex values, making them easier to reference in technical documentation.
  • File formats: Binary file headers and magic numbers are commonly expressed in hexadecimal for clarity.

Related Number System Conversions

Conversion Type Description Difficulty
Hex to Binary Reverse process – each hex digit becomes 4 binary bits Simple
Binary to Decimal Add up powers of 2 where bits are set to 1 Moderate
Hex to Decimal Multiply each digit by powers of 16 and sum Moderate
Decimal to Binary Repeatedly divide by 2 and record remainders Moderate
Decimal to Hex Repeatedly divide by 16 and record remainders Moderate
Binary to Octal Group binary digits in threes instead of fours Simple

FAQs

Why does hexadecimal use letters A through F?
Hexadecimal is base-16, which means it needs 16 unique symbols. We use 0-9 for the first ten values, then A (10), B (11), C (12), D (13), E (14), and F (15) for the remaining six. This gives us exactly 16 distinct characters to represent all possible values in a single digit.
Can I convert fractional binary numbers to hexadecimal?
Yes, the same grouping method applies. Place your binary point, then group four bits to the left and four bits to the right of the point. Convert each group separately. For example, 1010.1100 becomes A.C in hexadecimal.
What happens if my binary number isn’t divisible by four?
Simply add leading zeros to the leftmost group until you have groups of four bits. For instance, 110101 becomes 0011 0101, which converts to 35 in hex. The leading zeros don’t change the value of your number.
Is hexadecimal case-sensitive?
No. Both uppercase (A-F) and lowercase (a-f) are acceptable and mean exactly the same thing. You might see hex values written as FF, ff, or even Ff – all represent the same number (255 in decimal).
What does the “0x” prefix mean in hexadecimal notation?
The “0x” prefix indicates that the following number is in hexadecimal format. This notation originated in C programming and is now widely used across many programming languages. For example, 0xFF means hexadecimal FF, not decimal 255.
Why is hexadecimal preferred over binary in programming?
Hex is far more compact than binary whilst maintaining a direct relationship to binary patterns. A single hex digit replaces four binary digits, reducing errors and making code more readable. The number 11111111 in binary is simply FF in hex.
Can I convert negative binary numbers to hexadecimal?
Yes, but you need to know whether you’re working with signed or unsigned numbers. For two’s complement representation (common in computing), convert the entire binary string including the sign bit using the standard grouping method. The result remains in hexadecimal but represents a negative value.
How do I verify my binary to hex conversion is correct?
Convert both your binary and hexadecimal results to decimal separately. If both conversions produce the same decimal number, your conversion is correct. Alternatively, convert your hex result back to binary and check it matches your original binary input.
Scroll to Top