Hexadecimal numeral system

From Wikipedia, the free encyclopedia

Jump to: navigation, search

The hexadecimal numeral system, or commonly known just as Hex, is a numeral system made up of 16 symbols (base 16). It uses the common symbols in the decimal numeral system ( 0 through 9 ) and includes six extra symbols. These symbols are characters taken from the English alphabet: A, B, C, D, E and F. The hexidecimal system replaced the Octal numeral system for much of the work done on computers. The most commonly used form of binary is the byte. This is 8 binary digits (bits). Hexadecimal only needs two digits to show the information in one byte of data. As computers become more advanced, they tend to use larger groups of bits but they use multiples of 8 (16, 24, 32, 64, etc). Hexadecimal makes it easier to write these large binary numbers. Hexadecimal numbers are written with a "h" after the number. For example 63h means 63 hexadecimal.

Contents

[change] Hexadecimal values

Hexidecimal is similar to the octal numeral system (base 8) because each can be easily compared to the Binary numeral system. Hexidecimal use a four bit binary coding. This means that each digit in hexidecimal is the same as four digits in binary. Octal uses a three bit binary system.

Hex Binary Octal Decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
Hex Binary Octal Decimal
8 1000 10 8
9 1001 11 9
A 1010 12 10
B 1011 13 11
C 1100 14 12
D 1101 15 13
E 1110 16 14
F 1111 17 15
Hex Binary Octal Decimal
10 1 0000 20 16
11 1 0001 21 17
24 10 0100 44 36
5E 101 1110 136 94
100 1 0000 0000 400 256
5C2 101 1100 0010 2702 1472
1000 1 0000 0000 0000 10000 4096
FACE 1111 1010 1100 1110 175326 64206

[change] Conversion

[change] Binary to Hexadecimal

Changing a number from binary to hex uses a grouping method. The binary number is separated into groups of four digits starting from the right. These groups are then converted to hexadecimal digits as shown in the chart above for the hexidecimal numbers 0 through F. To change from hexidecimal, the reverse is done. The hex digits are each changed to binary and the grouping is usually removed.

Binary groupings Hex
01100101 0110 0101 65
010010110110 0100 1011 0110 4B6
1101011101011010 1101 0111 0101 1010 D75A

[change] Hexadecimal and Decimal

To convert a number from hexadecimal to decimal do the following:

1) Take the least significant bit. If it is 0 thru 9 leave it at that value. If it is A or above convert it to 10 thru 15 this will be the first item in a sum.

2) Take the 2nd significant bit do the above but multiply the value obtained by 16 add this to the sum

3) Take the 3rd significant bit and convert is as in 1 above then multiply it by 16^2. Add it to the sum

4) Repeat the above for more places. for each new place increment power of 16. Because hexidecimal uses extra symbols, it is important to remember the decimal value of each of the symbols: A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

  Location
6 5 4 3 2 1
Value 1048576 (165) 65536 (164) 4096 (163) 256 (162) 16(161) 1 (160)

Example: 3425h to decimal

 
5Fh to decimal
Hex Decimal
5Fh = ( 5 x 16) + ( 15 x 1 )
= 90 + 15
5Fh = 105
 
3425h to decimal
Hex Decimal
3425h = ( 3 * 4096) + ( 4 * 256 ) + ( 2 x 16) + ( 5 x 1 )
= 12288 + 1024 + 32 + 5
3425h = 13349

[change] Other pages