Binary and Hexadecimal Conversions, Examples, and Tips for Beginners
Binary numbers are something commonly used in our modern world. In fact, the device you're using right now is using binary to render this article!
In this guide to binary and hexadecimal for beginners, you will how to identify number systems, converting binary and hexadecimal into decimal, and how computers use these systems internally.
Base Two and Base Ten Systems
Our everyday counting system (1, 2, 3, 4, etc.) is what we call base-10. This is because we have ten digits: 0 through 9.
Base two systems are simply systems with only 2 digits. This is what binary is, because it only uses a 1 and a 0.
How Digital Electronics Use Binary
When someone says their device is digital, that means their device runs on Boolean logic.
Boolean logic is like a light switch. It has two states (or digits): on and off. This means your light switch is a base two system, just like binary.
Digital electronics use Boolean logic in the form of binary. Behind the scenes, 1s and 0s are just two different voltages in digital electronics.
To distinguish a 1 from a 0, digital electronics use something called a voltage threshold.
- A "1" in digital logic would be considered a signal of about
- A "0" would be considered a anything below a would be a 0.
How to Convert Binary to Decimal
To learn how to convert decimal numbers to binary, it would be useful to realize how to convert binary numbers to decimal first. Let's say we are dealing with the binary number 1101. First, we take into account the number of digits in this number, which is 4. Then, from right to left, we add up the values according to their place in the number. The formula is:
Where
- is the bit value (0 or 1)
- is the position of the bit. We start at 0 for the rightmost bit (also called the Least Significant Bit, or LSB) and add one for every bit to the left.
Let's take a look at the binary number . Starting with the LSB, we find .
To find the rest of the number's value, we add all the digits together like this:
This works with any binary number. This number has four digits, so it can have or different combinations.
One of those combinations is 0, so a four-digit binary number can be any whole number from 0 to 15. Here's a quick chart to help visualize the binary conversion from decimal
| Decimal | Binary |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
| 10 | 1010 |
| 11 | 1011 |
| 12 | 1100 |
| 13 | 1101 |
| 14 | 1110 |
| 15 | 1111 |
How to Convert Decimal to Binary
To convert decimal numbers to binary, we will look at the number 53. The method for this is dividing this number by two, and keeping the remainder separate from the result. Then, by looking at the remainders, we get the binary number. This is how it would look to perform this operation on 53:
Then, by looking at the remainders, the first binary digit is the last remainder, which was 1. Then we take the remainders in reverse order to get .
We can double-check this work by converting this number back into decimal with the previous equation:
As you work more with binary numbers, it gets easier to find patterns in your head, and you can do almost all problems quickly and efficiently.
My Grandma used to work at IBM in the 70's, and she was able to add and subtract binary (in her head) faster than decimal. Practice helps a lot in all areas of life, but especially in math and science.
Hexadecimal Explained Simply
Hexadecimal (also called hex) is a base-16 number system, and it is used for simplifying binary code to a more readable (but still very difficult for large programs) format for humans.
The possible characters are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Because the A-F digits aren't traditionally numbers, understanding hexadecimal as a beginner can be tricky. Here's a conversion table for the hex value and the corresponding decimal value:
| Decimal | Hexadecimal |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
Choosing a base-16 system may seem odd, but think back to how many combinations had. It had 16 total different combinations. Hexadecimal also has 16 total combinations.
This makes it very easy to convert a binary number to hexadecimal. If you choose any 1 hexadecimal digit, let's say A, you can convert that directly into a 4-digit binary number.
How to Convert Hexadecimal to Decimal
To start, let's use . To convert to decimal:
Now try one on your own:
Convert to binary and decimal.
How to Convert Decimal to Hexadecimal
Converting decimal to hexadecimal is similar to converting decimal to binary. You divide the decimal number by 16 until you get 0.
Try converting 53 to decimal
Conclusion
The binary number system and hexadecimal number system are both important to learn because of their prevalence in digital computations and data. In understanding how computers work, you would get lost without a basic understanding of binary numbers.
Binary represents the fundamental on/off nature of digital electronics, while hexadecimal offers a good way to handle binary values. Mastering conversions between these systems helps in understanding data storage, computer architecture, and programming.
People Also Ask
About the Author
This article was written by Boden Bensema, an electronics hobbyist focused on teaching beginner-friendly circuit design, breadboarding, and electronics fundamentals.
About page