Illustrated picture. Photo: Mixi's
Illustrated picture. Photo: Mixi's

The Hexadecimal Number System

The hexadecimal system, however, is base 16 as there are sixteen possible values for each digit position. So, you may be asking, how can you have a base-16 system when we only have numerals from zero to nine?

Hexadecimal – or hex, as it’s commonly known – does this by using a combination of numbers and letters: 0-9 plus A-F for values from ten to fifteen. Therefore, while the number 1 in both decimal and hex is 1, the number 10 in decimal would be A in hex, and 25 in decimal would be 19 in hex. To make it clear you’re using hex, a subscript can be used after the number: 1016, 10hex, or 10h.

Again, for the sake of comparison, here are the numbers 11-20 in decimal, hex, and binary.

​Hex is particularly useful in computing because of the amount of data compression it allows versus binary numbers because, by default, each hex digit is equivalent to one byte (four binary digits). Given that, while it takes four digits to express 11112 as a binary number, you only need one (F16) to do the same in hex, according to javabeat.

As numbers increase in size, this becomes even more helpful. For example, it takes four digits to express 567810 and its hex equivalent 162E16, but this will take thirteen digits in binary: 10110001011102. In addition, converting from hex to binary and vice versa is much quicker – especially when a computer is doing it hundreds or thousands of times per second – than performing the same process with decimal numbers.

Hex is also used in the following computing situations:

Displaying error messages: Because memory addresses use hex, this makes resolving error messages easier as they reference these memory locations.

Defining colors on web pages: Each primary color on a web page – red, blue, and green – is represented by two hex numbers which, when combined to create other colors, use six hex numbers to represent the amount of each primary color being used.

Representing Media Access Control (MAC) addresses: With these twelve-digit hex numbers, the first six identify the adapter manufacturer while the second six are the adapter’s serial number.

The Binary Number System

Photo: javabeat
Photo: javabeat

Most people also recognize the base-2 binary system where every number is represented by a combination of zeros and ones. For example, while the number 1 is represented as 1 in binary, the number 2 is expressed as 10.The numbering system everyone is most familiar with is base 10, also known as decimal or denary. That’s when each number position can have a value from zero to nine.

Given the overlap in terms of how numbers can be represented, though, it can be confusing to determine which system is being used. To make the distinction clear, a subscript denoting the system can be used after the number: 1010, 10decimal, or 10d for decimal and 102, 10binary, or 10b for binary.

Binary numbers are used primarily with computers because, at the most basic level, computers only recognize two states: on or off. Each zero or one is a “bit” which is short for “binary digit.” A string of four bits is a nibble, and eight bits are a byte. A byte is also the number of bits needed to represent a character.

For the sake of comparison, here are the numbers 1-10 in both the decimal and binary number systems.

How to Convert Hex to Binary

Converting from hex to binary is straightforward since hexadecimal numbers are simplified versions of binary strings. You just need to remember that each hex value will produce four binary digits.

Step 1: Write down the hex number. If there are any, change the hex values represented by letters to their decimal equivalents.

Step 2: Each hex digit represents four binary digits and therefore is equal to a power of 2. The rightmost digit equals to 20 (1), the next one equals to 21 (2), the next one equals to 22 (4) and the leftmost one equals to 23 (8). Write these numbers (8, 4, 2 and 1) below the hex values.

Step 3: Determine which powers of two (8, 4, 2 or 1) sum up to your hex digits. For example, if one of your hex values is 10, this means 8 and 2 sum up to 10 (4 and 1 are not used). If your hex number is 2, only 2 is used; 8, 4 and 1 are not.

Step 4: Write down 1 below those 8, 4, 2 and 1’s that are used. Write down 0 below those that are not used.

Step 5: Read the 1’s and 0’s from left to right to get the binary equivalent of the given hex number.

Let's apply these steps to the hex number (4FA)16

Practicing

Example 1: Convert 62F7 to Binary

62F716 breaks out into the individual hex digits 6, 2, F, 7.

6, 2, F, 7 converts to the binary numbers 0110, 0010, 1111, 0111.

0110, 0010, 1111, 0111 becomes the single string 0110001011110111.

0110001011110111 becomes 1100010111101112 after deleting the zero beginning the string.

Example 2: Convert A24B7 to Binary

A24B716 breaks out into the individual hex digits A, 2, 4, B, 7.

A, 2, 4, B, 7 converts to the binary numbers 1010, 0010, 0100, 1011, 0111.

1010, 0010, 0100, 1011, 0111 becomes the single string 10100010010010110111.

101000100100101101112 is the final form of this binary number as there are no zeros before the first one which need to be deleted.

Steps to Convert Binary to Hex

On occasion, you’ll need to convert a binary number to hex. This is also relatively simple except for also needing to account for any zeros at the beginning of the binary number which are not present. For example, let’s take another look at 62F716 from above which is expressed in 1100010111101112 in binary form.

Step 1. Working from right to left, break out the binary number into groups of four digits

1100010111101112 becomes 110, 0010, 1111, 0111. You must work from right to left to account for any deleted zeros which began the binary number. With this binary number, for example, after moving from right to left, the first set of numbers only has three digits: 110. This indicates you need to put a zero at the beginning of it.

Step 2. Convert individual binary 4-digit groups to hex

0110, 0010, 1111, 0111 converts to 6, 2, F, 7.

Step 3. Combine the hex digits into a single string

6, 2, F, 7 becomes 62F716.

Online Hex to Binary Converters

While it’s useful to know how to convert numbers from hex to binary, this can be a labor-intensive process doing one number after another. Given that, you should consider using one of these online hex-to-binary converters:

* Code Beautify

* Browserling

* BinaryHexConverter

Decimal to Hex and Binary Table

Decimal Hex Binary

0

0

0

1

1

1

2

2

10

3

3

11

4

4

100

5

5

101

6

6

110

7

7

111

8

8

1000

9

9

1001

10

A

1010

11

B

1011

12

C

1100

13

D

1101

14

E

1110

15

F

1111

16

10

10000

17

11

10001

18

12

10010

19

13

10011

20

14

10100

...

...

...

25

19

11001

26

1A

11010

27

1B

11011

28

1C

11100

29

1D

11101

30

1E

11110

31

1F

11111

32

20

100000

33

21

100001

34

22

100010

Photo: javabeat
Photo: javabeat

Hexadecimal & Binary Number System Resources

Now that you know the basics of converting hexadecimal numbers to their binary equivalents and vice versa, you may want to know more about how each of these numbering systems work in relationship to each other, especially in terms of computing. To that end, here are some recommended resources to check out:

SparkFun: This extensive hexadecimal tutorial covers the basics of using hex as well as converting to and from both binary and decimal numbers and provides a handy conversion calculator.

Tutorials Point: This tutorial shows how to add and subtract using hexadecimal numbers.

Grinnell College Math Department: Topics covered include binary number theory, negation in the binary system, converting from binary to decimal, and performing addition, subtraction, multiplication, and division using binary numbers.

Remember: Whether you convert from hex to binary by hand or use a converter, understanding how these numbering systems work and their use with computers is key for every programmer.

In this video, you can learn how to convert Binary to Hex:

For more interesting news of KnowInsiders, check out right below!

How to Convert Minutes to Hours: Easy Ways to Change How to Convert Minutes to Hours: Easy Ways to Change

How to convert minutes to hours? Follow our simple steps!

How to Convert Degrees to Radians and Radians to Degrees: Best Ways to Change How to Convert Degrees to Radians and Radians to Degrees: Best Ways to Change

Welcome to math lessons of KnowInsiders. The first lesson in the series will be how to convert degrees to radians with simple guides.

How to Convert Word to PowerPoint How to Convert Word to PowerPoint

PowerPoint is a great way to merge text and images for presentations. Are you struggling with the way to convert Word to Powerpoint? Check out ...