# Using hexadecimal to represent machine code

Hexadecimal code is the lowest form of programming language used by programmers. It cannot be understood by the processor but it makes binary more readable for humans.

Earlier, we saw how 180 can be coverted to binary as 10110100

Using hexadecimal the same instruction can be represented as B4

In hexadecimal the letter B represents the number 11. Hexadecimal code works to the power of 16 (Base 16). The hexadecimal representation of 180 is B4:

 16 1 B 4

This means we are using 16 eleven times (as B represents 11) and we are using 1 four times.

16 x 11 = 176

1 x 4 = 4

176 + 4 = 180

We can see that B4 is a more succinct way of representing 180 than 10110100. Programming in hexadecimal saves time when compared to using binary instructions.

Here are the values 1-26 represented in decimal, binary and hexadecimal.

 Decimal Binary Hexadecimal 0 00000000 00 1 00000001 01 2 00000010 02 3 00000011 03 4 00000100 04 5 00000101 05 6 00000110 06 7 00000111 07 8 00001000 08 9 00001001 09 10 00001010 0A 11 00001011 0B 12 00001100 0C 13 00001101 0D 14 00001110 0E 15 00001111 0F 16 00010000 10 17 0010001 11 18 00010010 12 19 00010011 13 20 00010100 14 21 00010101 15 22 00010110 16 23 00010111 17 24 00011000 18 25 00011001 19 26 00011010 1A

Here we can see an example of the value for 500 in both binary and hexadecimal:

### Binary

 256 128 64 32 16 8 4 2 1 1 1 1 1 1 0 1 0 0

256 + 128 + 64 + 32 + 16 + 4 = 500

 256 16 1 1 F 4

F represents 15 in hexadecimal so...

(256 x 1) + (16 x 15) + (1 x 4) = 500

An example of a complete binary instruction and the same hexadecimal instruction is shown below:

`10110100 00000000 10110000 00010011 11001101 00010000`

`B4 00 B0 13 CD 10`

Hexadecimal code is easier for programmers to work with than machine code.