How to Read Hexadecimal and Binary Numbers – A Complete Guide
Anyone who wants to enter special characters can do so either via hexadecimal or decimal Unicode, the latter in the &0000; format often also referred to as HTML entities. Computers, on the …
How Do You Actually Read Hexadecimal and Binary Numbers?
Anyone who wants to enter special characters can do so either via hexadecimal or decimal Unicode, the latter in the � format often also referred to as HTML entities. Computers, on the other hand, calculate in the dual or binary system, meaning only with zeros and ones. That takes some getting used to. … sheds light on the matter.
Anyone who works a lot with colors professionally can tell you how difficult it often is to convert the frequently hexadecimally noted RGB color values into decimal numbers, i.e. from base 16 to base 10. Pure black or white are still easy with the HTML encoding #00 00 00 (0 0 0 for red, green, blue) and #FFFFFF (255 255 255). But with silver and its hex code #C0C0C0 (192 192 192) it gets more difficult, especially since all three RGB colors each come with a saturation of 79.29%. Odd number.
Computers Calculate with Signs + and –
The hexadecimal letters represent the decimal number values 10 to 15. And then with C0 you only need to consider the positional values to arrive at the decimal 192. In the decimal system, positional values begin with the ones place or of the respective numerical value to the left of the decimal point and with the tenths place or to the right of the decimal point. The number 75.5 could therefore also be written as . This method can also be applied to other positional numeral systems. The binary number can consequently be translated as or .
Expressed in binary -or in the dual system- you would need 24 binary digits (binary digits or bits) for FFFFFF or C0C0C0. It would be even better to prepend at least one 0, because computers generally calculate with signs (signed) and not without signs (unsigned). The first bit in a string indicates as the Most Significant Bit (MSB) whether it is a positive value (0) or a negative value (1) of the respective positional value.
If you enter FFFFFF in the Windows Programmer Calculator, for example, the unsigned binary value and the corresponding decimal value 16,777,215 (2²³+2²²…2⁰) appear. With signs, however, you would have to subtract the leading 1 as 2²³ or 8,388,608 to arrive at a completely different value, as computers read the string.
Unicode Has Brought All Languages Together
Converting hexadecimal to binary and vice versa is relatively simple, because four bits together each represent one hex value. Only the positional values within each 4-bit block need to be known, where F or the binary number stands for i.e. 15. Converting hexadecimal to decimal and vice versa is more complicated, but also not rocket science, as will be seen later.
First, here is another topic where you occasionally need to convert between hexadecimal and decimal: entering special characters and other characters. Depending on the environment and input method, you sometimes need to know the hex code, sometimes the decimal code.
The Unicode standard has simplified a lot and more or less put an end to the muddle where, for example, Chinese texts -depending on the encoding- appeared either as a jumble of letters or numbers. The current Unicode Standard 15.0 from September 2022 brings together practically all living and dead languages of the world and encompasses nearly 150,000 different characters. Theoretically, across 17 planes with 2¹⁶ or 65,536 code points each, there could be more than 1.1 million letters, numbers, commands and characters upon characters. Computers only know binary states (on or off, 1 or 0). And ASCII characters, as they are still used up to code point 255 today, are also still encoded in binary.
ASCII Is Not the Same as ASCII
But to represent just the exclamation mark, the first printable ASCII character, you would have to write instead of hexadecimal 21 or decimal 33. That is why Unicode numbers, as designated by the Unicode Consortium following the U+0000 scheme, are usually given in hexadecimal form.
Below or next to it, in the � format, you often also find the usually decimal-designated HTML entity. If you know this decimal digit sequence, it is easy in Microsoft Word to enter less common characters using the ALT key and the numeric keypad. Sometimes, however, you also need to put a 0 before the digit sequence according to the English keyboard layout, because ALT+190 in Word for Windows, for example, produces the Japanese currency symbol ¥, while ALT+0190 produces the three-quarters sign ¾.
This is because the ASCII code, extended from 128 to 256, is not uniform but depends on the code page or character table. In IBM’s Codepage 437, introduced in 1981, for example, 190 is the box-drawing element ╛, which in the Unicode character set only occupies position U+255B and according to the HTML entity occupies position 9563. Therefore, it may be necessary to change the encoding for some foreign-language texts, even though Unicode and UTF-8 have now become established worldwide.
TIP: If you have seen a character on the internet and want to find the Unicode number and vice versa, you only need to copy it to Microsoft Word and use the keyboard shortcut ALT+c directly after it. U+FDFD for example, with or without the preceding U+, is the Unicode number for the Arabic ligature ﷽, spelled out (“Bismillah arahman arahim”, in English “In the name of God, the Most Merciful”), one of the most complex Unicode characters of all. Whether and how it appears on screen depends on the underlying character set. Characters that cannot be displayed appear with a placeholder such as a crossed-out rectangle.
How to Convert from One Positional Numeral System to Another
Now to the question of how to convert hexadecimal to decimal and vice versa. In the hexadecimal or base-16 system, the digits range not only from 0 to 9, but from 0 to 9 and from A to F, where the letters represent the decimal numbers 10 to 15. As with every positional numeral system, the hexadecimal digits to the left of the decimal point each stand for the X-fold of the respective positional value.
ABCDEF16 thus reads as .
So you only need to add the individual multiplication results to arrive at the decimal number 11,259,375. Conversely, you can do the same if you know the powers of 16:
The latter number is 256 × 256 × 256 and is not just coincidentally reminiscent of the still widely used 24-bit color depth with 3 times 8 bits or 2²⁴, i.e. approximately 16.78 million displayable colors, also known as True Color. If you want to convert from other positional numeral systems to the decimal system, you can break down the number into the multiples of the respective positional values. The binary then reads as 2⁴ + 2³ + 2⁰ or 16 + 8 + 1, which equals 25.
A Table Can Help
Another way to convert from another positional numeral system to the decimal system is to use the so-called Horner scheme. You start by multiplying the leftmost digit (without leading zeros) by the respective base, then add the next digit and multiply the sum again by the base (base-2 for binary numbers and base-16 for hexadecimal numbers). You then continue until there is nothing more to add:
Let us take the hexadecimal 73CC16 as an example:
7 × 16 + 3 = 115 × 16 + 12 = 1,852 × 16 + 12 = 29,64410
As you can see, the decimal number is somewhat longer, and in binary with it is even four times longer. This is the reason why hexadecimal is often used in data processing instead of binary or decimal numbers.
Converting hexadecimal numbers to binary numbers is comparatively easy, while converting hexadecimal numbers to decimal numbers is a greater challenge. But with the aforementioned Horner scheme, you usually do not even need a calculator for that; the reverse is more likely. The good thing about it is that every intermediate result is already the decimal equivalent of the digits up to that point. 7316 for example is, as seen above, the decimal 115.
To convert decimal numbers to other positional numeral systems, you can either break down the number into the multiples of the respective positional values or apply the division method with integer remainders.
for example can be broken down into , which yields the hexadecimal number 137B16. B stands for the number 11.
If you continuously divide 4,987 by 16 and read the integer remainders upward, you arrive at the same result:
| 4,987 ÷ 16 =
311 ÷ 16 = 19 ÷ 16 = 1 ÷ 16 = |
311
19 1 0 |
R11 (B)
R7 R3 R1 |
From the remainders read upward or from back to front, we again get the sought hexadecimal number 137B16. Converting hexadecimal to binary is thus simple, because the 1 at the front corresponds to the binary 0001, the 3 to the binary 0011, the 7 to the binary 0111 and the B to the binary 1011, together thus .
Binary numbers are usually presented in groups of 4 for better readability, as shown here, which are also referred to as nibbles or half-bytes. If you form groups of 3 instead, it is in turn easy to convert the binary number to the octal system (base-8), where the first of the three bits counts as 2², the second as 2¹ and the third as 2⁰, i.e. 1.
For those who are dizzy from all the converting, the following conversion table extended with duodecimal numbers (base-12) is recommended:
| Conversion table for the most common positional numeral systems |
||||
| DEC | HEX | OCT | DDC | BIN |
| 0 | 0 | 0 | 0 | 0000 |
| 1 | 1 | 1 | 1 | 0001 |
| 2 | 2 | 2 | 2 | 0010 |
| 3 | 3 | 3 | 3 | 0011 |
| 4 | 4 | 4 | 4 | 0100 |
| 5 | 5 | 5 | 5 | 0101 |
| 6 | 6 | 6 | 6 | 0110 |
| 7 | 7 | 7 | 7 | 0111 |
| 8 | 8 | 10 | 8 | 1000 |
| 9 | 9 | 11 | 9 | 1001 |
| 10 | A | 12 | T | 1010 |
| 11 | B | 13 | E | 1011 |
| 12 | C | 14 | 10 | 1100 |
| 13 | D | 15 | 11 | 1101 |
| 14 | E | 16 | 12 | 1110 |
| 15 | F | 17 | 13 | 1111 |
| 16 | 10 | 18 | 14 | 1 0000 |
Instead of T and E (Ten and Eleven), you can also write A and B or ↊ and ↋ for 10 and 11 in the duodecimal system. The latter is incidentally ancient and can be found among other things in our time and calendar division into 12 hours and 12 months, as well as in numerical values like dozen and in English and other older units of measurement. One English inch, for example, corresponds to one twelfth or 12⁻¹ of an English foot, and one English ounce is one twelfth of an English pound.
Calculating Is Like Counting in Other Positional Numeral Systems
As you can see, decimal, hexadecimal, octal and duodecimal numbers or more precisely digits up to and including 7 are all the same. From the decimal 8 onward, opinions diverge and then you have to calculate downward or upward depending on the positional numeral system. Thus the decimal 8 becomes an octal 10 and the hexadecimal 10 becomes a decimal 16 and an octal 20. For binary numbers, it is better to prepend at least one 0, because the first 1 could otherwise be counted as negative of the respective positional value.
Explaining how to calculate in binary, hexadecimal, octal or decimal would go too far here. But if you know that the base in every positional numeral system is 10, you only need to count up and down along the table above to be able to add or subtract respectively.
Anyone who does not know by heart what 7 + 8 is, for example, will perhaps unconsciously subtract the difference from 7 to 10 (i.e. 3) from 8 and place the carry 1 under the next digit position. You can calculate A + F hexadecimally in the same way. The difference to the hexadecimal 10 (the decimal 16) from A (the decimal 10) is 6, and if you subtract 6 from F (i.e. 15), you get 9 and a carry of 1. A + F is thus 19 in the hexadecimal system and 16 + 9 or 25 in the decimal system, 31 in the octal system, 21 in the duodecimal system and in the binary system.

