Hexadecimal numeral system

From Wikipedia, the free encyclopedia
Jump to: navigation, search

The hexadecimal numeral system, also known as just 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 hexadecimal 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 eight 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

Hexadecimal is similar to the octal numeral system (base 8) because each can be easily compared to the binary numeral system. Hexadecimal uses a four-bit binary coding. This means that each digit in hexadecimal 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 1474
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 hexadecimal numbers 0 through F. To change from hexadecimal, 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 hexadecimal digit. That is the digit on the right end. 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 second-least significant digit. That is next to the digit on the right end. Do the above but multiply the value obtained by 16. Add this to the sum.

3) Take the third-least significant digit and convert is as in 1) above, then multiply it by 162 (that is, 16 squared, or 256). Add it to the sum.

4) Repeat the above for more places. For each new place, add one more to the power of 16. Because hexadecimal 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: 5Fh and 3425h to decimal

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

[change] Other pages

Personal tools
Namespaces

Variants
Actions
Getting around
Print/export
Toolbox
In other languages