What is a hexadecimal number system?
Unlike decimal and binary numbers which use base 10 and 2 respectively. Hexadecimal base or radix is 16.
Hexadecimal refers to number 16. Hexadecimal numbering system consists of 1st 10 digits from decimal numbers and the remaining 6 are represented by letters. The following table shows the first sixteen hex numbers equivalent to decimal numbers.
Use of Hexadecimal
Hexadecimal digits are important part of mathematics used in digital electronics. These numbers are widely used by programmers and computer designers to design computer systems because they are useful in representing binary coded data. For example, a single byte can have values ranging from 00000000 to 11111111 in binary form, which can be conveniently represented as 00 to FF in hexadecimal.
Hexadecimal to Colors
Hex are also used to display colors on a web page. RGB color system is uses combination of red, green and blue colors to make 16777216 colors possible.
Representation of Hexadecimal
Hexadecimal numbers can be often confused with the decimal numbers because they contain the first 10 digits of decimal numbers. So we write radix 16 to make them different from decimal numbers. For example (123)16 , (9AC)16 .
Hexadecimal Conversion Techniques
1. Hexadecimal to Decimal
We can write hexadecimal in decimal form by using the very easy and simple method. Starting from left, each hex digit is multiplied by powers of 16 in descending order towards right. The following example explains how we can convert hexadecimal to a radix 10 number.
To convert decimal to hexadecimal we use division method just like we used to convert a decimal number into binary.
Some online hexadecimal converters are also available.
2. Hexadecimal to Binary
One hexadecimal number value can be written using 4 binary bits. So a converter uses a similar idea to convert a hexadecimal into binary i.e represent one hex by 4 bits. The following table provides a better understanding.
Lets understand with examples.
(AF10)16= (1010 1111 0001 0000)2
From above table, A = 1010, F = 1111, 1 = 0001, 0 = 0000
The number with a decimal point can be solved in the same way. See below
(20CE. A5)16 = (0010 0000 1100 1110 . 1010 0101 )2
A binary number to hexadecimal can be converted in the opposite manner. For example we want to convert (10011111011)2
Make the groups of four bits. Start from left for integer part and from right side for decimal part.
3. Hexadecimal to Octal
Since there is no direct way of converting to octal but can be done easily by the following steps.
- 1st convert hexa to binary
- Then make groups of 3 bits instead of 4 like above
- Then find the equivalent octal number.
4. Hexadecimal to Text
- Get hex byte code
- Convert hex byte to decimal
- Get character of decimal ASCII code from ASCII table contains alphabets and symbols
- Continue with next hex byte