How to Convert Hexadecimal to Binary
![Author](/_next/image?url=%2Flogo.png&w=96&q=75)
Published on Jan 26, 2022
Converting hexadecimal to binary is a common task in computer programming. Hexadecimal is a base-16 number system that uses sixteen digits, 0 through 9 and A through F. Binary, on the other hand, is a base-2 number system that uses only two digits, 0 and 1. Converting hexadecimal to binary involves converting each hexadecimal digit to its binary equivalent.
Conversion
Here's a step-by-step guide on how to convert hexadecimal to binary:
- Choose the hexadecimal number you want to convert to binary.
- Convert each hexadecimal digit to its binary equivalent using the below table.
- Write the binary equivalent of each hexadecimal digit in order to get the binary representation of the hexadecimal number.
Example
Let's walk through an example to illustrate the process. Suppose we want to convert the hexadecimal number 2A to binary.
- The hexadecimal number we want to convert is 2A.
- We convert each hexadecimal digit to its binary equivalent using the table below.
- We write the binary equivalent of each hexadecimal digit in order to get the binary representation of 2A: 00101010.
Binary-Hexadecimal Table
Hexadecimal | Binary |
---|---|
0 | 0000 |
1 | 0001 |
2 | 0010 |
3 | 0011 |
4 | 0100 |
5 | 0101 |
6 | 0110 |
7 | 0111 |
8 | 1000 |
9 | 1001 |
A | 1010 |
B | 1011 |
C | 1100 |
D | 1101 |
E | 1110 |
F | 1111 |
References
Become a Sponsor![Heart with ribbon](/_next/image?url=%2Fheart-with-ribbon.png&w=48&q=75)
Become a sponsor and help us maintain and improve this project. Every contribution counts. Thank you!
GitHub Sponsors