Binary to Hex Converter

Free binary to hex converter: turn binary into hexadecimal in one step, see the decimal and octal values, and learn the four-bit nibble method for converting binary to hex by hand.

https://hexacalculator.com/calculators/other/computers/binary-to-hex-calculator

Other

Computers

Binary to Hex Converter

Free binary to hex converter: turn binary into hexadecimal in one step, see the decimal and octal values, and learn the four-bit nibble method for converting binary to hex by hand.

Binary to Hex Converter

Enter a number

Result

Hexadecimal (base 16)

0xFF

(base 8)

(base 2)

Hexadecimal (base 16)

0xFF

Decimal value
Bits
Bytes
Hex digits
Largest value in these bits

Grouped into nibbles the binary is 1111 1111, and in octal it is 377.

Every base at a glance

The same number in hexadecimal, binary, octal, and decimal

Base

Radix

Value

Hexadecimal160x FF
Binary20b 1111 1111
Octal80o 377
Decimal10255
Loading calculator…

This binary to hexadecimal conversion tool converts strings of 0s and 1s into a compact hexadecimal representation. Enter a binary number, leave the base as "binary" to display its equivalent hexadecimal value along with its decimal and octal representations.

Binary and hexadecimal are two of the most commonly used simplified representations for programmers. Binary numbers represent how computers actually store data while hexadecimal allows you to read that same data without having to look at a long series of numbers.

The key to connecting these two base systems is simple: four binary digits always correspond exactly to one hexadecimal digit. So a long string of binary characters is grouped together, reducing its length by a factor of four.

Binary and hexadecimal systems - two ways to represent the same number.

The binary system is a base-2 number system. It uses only two symbols: 0 and 1. The value of each digit is twice that of the digit to its right.

The hexadecimal system is also a base-16 number system. Since each digit requires sixteen different symbols, the digits 0 through 9 are used followed by the letters A, B, C, D, E and F to represent ten through fifteen respectively.

To distinguish between the two systems we use markers in the notation. The prefix 0b stands for binary numbers while the prefix 0x stands for hexadecimal numbers. So 0b1010 and 0xA represent the same value, written in two different ways.

A half-byte - four bits make up a hexadecimal number

A group of four bits is called a nibble and is half of an eight-bit byte. The four bits are counted from 0000 to 1111, or decimal 0 through 15, which is exactly the range of values for one hexadecimal digit.

Since 2 to the power of 4 is 16, every possible nibble without a remainder corresponds to exactly one hexadecimal symbol. This table shows the whole conversion process in full and it's worth memorizing.

Binary nibble

Hex

Binary nibble

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

How to convert a binary number to hexadecimal.

The conversion can be done manually in two steps and also the above calculator uses the same logic.

Step 1: Divide into foursomes, starting on the right.

Starting with the bit furthest to the right (the least significant bit), mark off positions by moving left and making groups of four. If there are not enough bits in the group furthest on the left, pad it out with leading zeros until it has four digits.

Take the binary number 1011010 for example. Splitting it up from the right, we get 101 1010. By adding a zero to the front of the first group, we get 0101 1010.

Step 2: Transformation and concatenation of groups.

Replace each nibble with the corresponding hexadecimal character according to the table above and write down these hexadecimal numbers in the same order. For 0101 1010: 0101 becomes 5, 1010 becomes A, so the result is 5A.

This method can be used for any length binary number. The binary number 1110001111011 grouped and padded with zeros gives 0001 1100 0111 1011. Converting each half-byte to hexadecimal gives 1, C, 7, B so the hexadecimal value is 1C7B.

How to convert a hexadecimal number to binary.

The conversion in the opposite direction can also be done mechanically. Replace each hexadecimal digit with its corresponding four-digit half-byte from the table and concatenate them while preserving order.

In hexadecimal F1, F is 1111 and 1 is 0001, so in binary F1 is 11110001. After conversion all leading zeros can be removed.

There is an important note about this tool: The input field is a numeric field and does not accept letters A through F. It reads binary, decimal or octal numbers and outputs hexadecimal. To convert a hexadecimal number to binary, use the table above and convert each digit individually. The text field where you can directly enter hexadecimal numbers (as mentioned below) will be added later.

Binary to hexadecimal conversion table:

Looking at these common values the regularity is immediately apparent. It also contains clear byte and word boundaries which are useful to programmers.

Binary

Hex

Decimal

0

0

0

1

1

1

10

2

2

1000

8

8

1010

A

10

1111

F

15

1 0000

10

16

10 1010

2A

42

1010 1100

AC

172

1111 1111

FF

255

1111 0000 1111 0000

F0F0

61680

Why do we use hexadecimal and where do we encounter it?

The value of the hexadecimal system is its compactness. A single hexadecimal digit represents four bits of information. Since two hexadecimal digits can represent a full byte, values that would otherwise be represented by eight hard-to-read binary digits can be compressed into a more readable two-digit hexadecimal value like FF.

If you look closely, this compact representation is everywhere. Colors of websites and designs are often represented by hexadecimal groups like #FF8800 where each two-digit number represents a color channel with values ranging from 0 to 255.

Memory addresses and pointers in debuggers are often displayed as hexadecimal values, e.g. 0x7FFF. Network devices use hexadecimal MAC addresses, and hex editors show the bytes of an original file pairwise. Error codes, status codes, Unicode code points (such as U+00E9) and even data words in standards like ARINC 429 use hexadecimal for this reason.

Bits, half bytes and bytes:

A bit is either a 0 or a 1. Four bits make up a half-byte, which is one hexadecimal character, and eight bits make up a byte, which is two hexadecimal characters. The range of values is between 0 and 255, or between 00 and FF.

Stacking more bytes quickly increases the range of values. A value with 16 bits consists of four hexadecimal numbers and can be a maximum of 65,535. A value with 32 bits consists of eight hexadecimal numbers and exceeds four billion. With each additional bit, the range of values doubles.

Distinguish between binary and hexadecimal systems:

If a number only contains the digits 0 and 1 it could be binary but the most reliable indicator is the prefix. The prefix "0b" or the subscript "2" indicates binary numbers, while the prefix "0x" or the subscript "16" indicates hexadecimal numbers.

You can also tell by the digits themselves. If a letter from A to F appears, or if a number greater than 1 appears in a code that is clearly not decimal, then it's hexadecimal.

Frequently asked questions

How do you convert binary to hexadecimal?

Divide the binary number from right to left into groups of four digits, padding with leading zeros if necessary to make a complete group. Use a half-byte table to convert each group of four bits to its hexadecimal equivalent, then concatenate those values in order. For example, 1011010 becomes 01011010, which is 5 and A, so the hexadecimal value is 5A.

What is the hexadecimal equivalent of the binary number 1011010?

We split the number from right to left into groups of 0101 and 1010. As a group of 0101 represents 5, and a group of 1010 represents A, the binary number 1011010 is hexadecimal 5A.

What is the binary representation of the hexadecimal value F1?

Each hexadecimal digit is converted to a four-digit half-byte sequence. Since F represents 1111 and 1 represents 0001, keeping the order results in 1111 0001. This is the binary representation of F1.

Why do we use hexadecimal instead of decimal or binary?

Hexadecimal numbers are a perfect match for binary numbers because one hexadecimal digit represents exactly four bits. This means that a byte can always be represented by two hexadecimal digits. This allows long binary values to be represented concisely and avoids the cumbersome calculations required when converting to decimal.

How do you know if a number is binary or hexadecimal?

Check for prefixes and numbers. The prefix 0b or the subscript 2 indicates a binary number, which only uses the digits 0 and 1. The prefix 0x or the subscript 16 indicates a hexadecimal number, which also uses the letters A through F.

What is a half-byte?

A nibble is a group of four bits, so half of an eight-bit byte. A nibble can store values from 0 to 15, which happens to be the range of hexadecimal digits. Thus, each nibble always corresponds to one hexadecimal digit.

Can this tool convert hexadecimal to binary?

The input field here is a numeric field and therefore does not accept letters A through F that are used in hexadecimal systems. It reads binary, decimal or octal numbers and displays the result in hexadecimal. To manually convert a hexadecimal number to binary, replace each hexadecimal digit with its corresponding four-digit half-byte representation in the table. A special input field for hexadecimal numbers will be added later.

Related calculators

Disclaimer: This calculator is provided for general informational and educational purposes only. Our calculators are under active development, and results may be inaccurate, incomplete, or unsuitable for your situation. Always verify the figures independently and seek advice from a qualified professional before relying on them. We make no warranties and accept no liability for any loss or decision arising from use of this tool.

References

  1. Britannica: Hexadecimal number system

    Background on base-16 notation and its role in computing.

  2. NIST Special Publication 811: Guide for the Use of the International System of Units

    The US national standard for SI units, unit names and symbols, and conversion factors.