What is the binary number system?
The binary number system is one of the most fundamental systems in computer science and digital electronics. It uses only two digits — 0 and 1 — to represent all possible numbers. Each digit in a binary number is called a “bit.” Binary is the natural language of computers because all modern digital devices use two states (on and off, represented by 1 and 0) to store and process data.
For example:
- Decimal 2 in binary is written as 10.
- Decimal 7 in binary is 111.
Each digit’s position in binary represents a power of 2:
where can be 0 or 1.
What is the hexadecimal number system?
The hexadecimal system (or simply “hex”) is a base-16 system. It consists of 16 digits — from 0 to 9 and then A to F (representing decimal values 10 to 15). It is widely used in programming, memory addressing, and computer graphics because it allows compact representation of large binary numbers.
| Hex digit | Decimal value |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| A | 10 |
| B | 11 |
| C | 12 |
| D | 13 |
| E | 14 |
| F | 15 |
For example:
- Decimal 255 = FF in hexadecimal.
- Decimal 64 = 40 in hexadecimal.
Formula for conversion
Binary numbers can be directly grouped and converted into hexadecimal numbers because both are powers of two:
This means one hexadecimal digit represents exactly four binary digits (bits). The step-by-step conversion process is as follows:
- Group the binary digits in sets of four, starting from the right (add leading zeros if necessary).
- Convert each group of four bits into its corresponding hexadecimal value.
- Combine all hexadecimal digits into a single hexadecimal number.
Conversion table of 4-bit groups
| Binary | Hexadecimal |
|---|---|
| 0000 | 0 |
| 0001 | 1 |
| 0010 | 2 |
| 0011 | 3 |
| 0100 | 4 |
| 0101 | 5 |
| 0110 | 6 |
| 0111 | 7 |
| 1000 | 8 |
| 1001 | 9 |
| 1010 | A |
| 1011 | B |
| 1100 | C |
| 1101 | D |
| 1110 | E |
| 1111 | F |
Examples
You can use two conversion methods. Let’s look at them with examples.
Example 1: Convert binary 1101101 to hexadecimal
Step 1: Group into 4-bit sets (from right to left)
Binary number: 0110 1101
Step 2: Convert each group using the table
0110 → 6
1101 → D
Answer:
Binary 1101101 = Hexadecimal 6D
| Division Process | Quotient | Remainder in Decimal → Hex |
|---|---|---|
| 109 ÷ 16 | 6 | 13 → D |
| 6 ÷ 16 | 0 | 6 |
The result is 6D.
Example 2: Convert binary 101101001010 to hexadecimal
Step 1: Convert to decimal
Step 2: Convert to hexadecimal
| Division Process | Quotient | Remainder in Decimal → Hex |
|---|---|---|
| 2890 ÷ 16 | 180 | 10 → A |
| 180 ÷ 16 | 11 | 4 |
| 11 ÷ 16 | 0 | 11 → B |
This gives the result B4A, confirming equivalence with binary.
Why binary and hexadecimal are used in computing
Computers use binary internally because it is easy to represent two states physically (electric current on or off). However, binary numbers can become very long. Representing large binary numbers in hexadecimal form significantly shortens them and improves readability for programmers.
For example:
- Binary: 1111 1111 1111 1111
- Hexadecimal: FFFF
Both represent the same value but the hex form is shorter and easier to interpret.
Frequently asked questions
How to convert a binary number like 11110000 to hexadecimal?
Group into sets of 4 bits: 1111 0000
1111 → F, 0000 → 0
Therefore, the result is F0.
How many hexadecimal digits are needed to represent 8 binary digits?
Since 1 hex digit represents 4 bits, 8 binary digits require 8 ÷ 4 = 2 hexadecimal digits.
Why do hexadecimal digits go up to F?
Hex uses base 16, so after 9, letters A-F represent decimal values 10 to 15 to fill the 16 possible symbol positions.
How does the grouping method simplify conversion?
Direct grouping into 4-bit segments avoids converting binary to decimal first, making the process faster and less error-prone.
Can binary fractions be converted to hexadecimal too?
Yes, fractional binary numbers can also be converted. Group the bits on both sides of the decimal point separately into sets of four and then convert each group. For example, binary 1010.1101 = hex A.D.