Conversion from Base r to Decimal (Base 10) It is important to note that hexadecimal number provides a compact form or shorthand for representing binary bits.
Starting from the right-most bit (least-significant bit), replace each group of 4 bits by the equivalent hex digit (pad the left-most bits with zero if necessary), for examples,ġ0001011001011B = 0010 0010 1100 1011B = 22CBH Replace each hex digit by the 4 equivalent bits (as listed in the above table), for examples,ġ02AH = 0001 0000 0010 1010B Conversion from Binary to Hexadecimal Each hex digit is equivalent to 4 binary bits, i.e., shorthand for 4 bits, as follows: Hexadecimal Hexadecimal system is used as a compact form or shorthand for binary bits. However, writing or reading a long sequence of binary bits is cumbersome and error-prone (try to read this binary string: 1011 0011 0100 0011 0001 1101 0001 1000B, which is the same as hexadecimal B343 1D18H). Most programming languages accept lowercase 'a' to 'f' as well as uppercase 'A' to 'F'.Ĭomputers uses binary system in their internal operations, as they are built from binary digital electronic components with 2 states - on and off. Some programming languages denote hex numbers with prefix 0x or 0X (e.g., 0x1A3C5F), or prefix x with hex digits quoted (e.g., x'C3A4D98B').Įach hexadecimal digit is also called a hex digit. We shall denote a hexadecimal number (in short, hex) with a suffix H. Hexadecimal number system uses 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, called hex digits. Eight bits is called a byte (why 8-bit unit? Probably because 8=2 3). Some programming languages denote binary numbers with prefix 0b or 0B (e.g., 0b1001000), or prefix b with the bits quoted (e.g., b'10001111').Ī binary digit is called a bit. We shall denote a binary number with a suffix B. Binary (Base 2) Number Systemīinary number system has two symbols: 0 and 1, called bits. We shall denote a decimal number with an optional suffix D if ambiguity arises. That is, the least-significant digit (right-most digit) is of the order of 10^0 (units or ones), the second right-most digit is of the order of 10^1 (tens), the third right-most digit is of the order of 10^2 (hundreds), and so on, where ^ denotes exponent. Decimal (Base 10) Number Systemĭecimal number system has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, called digits. In computing, we also use hexadecimal (base 16) or octal (base 8) number systems, as a compact form for representing binary numbers. Computers use binary (base 2) number system, as they are made from binary digital components (known as transistors) operating in two states - on and off. Human beings use decimal (base 10) and duodecimal (base 12) number systems for counting and measurements (probably because we have 10 fingers and two big toes).