Binary, Hexadecimal, and Decimal Conversion — Simple Explanation|computer Science

Musindesarah
5 min readApr 19, 2024

--

In networking, understanding binary, hexadecimal, and decimal is crucial for managing data. These systems serve as the foundation of data transmission.

Binary uses only two digits, 0 and 1, representing data in computers. In networking, all data is transmitted in binary. Hexadecimal, with base 16, is widely used for its compact representation of binary data. Each hexadecimal digit represents four binary digits. Its range for numbers is from 0 to 9, and for letters, it’s from A to F. Decimal, the base 10 system, is essential for human interaction in networking. It’s familiar and convenient for displaying IP addresses and network parameters. Its range is from 0 to 9

In this article, I’ll guide you through simple steps to convert numbers effortlessly. By the end, you’ll be equipped to handle conversions with ease.

Decimal to Binary Conversion

To convert a decimal number to binary, we’ll utilize a systematic approach using a table of powers of 2. Let’s take an example with the decimal number 44 and walk through each step of the conversion process:

| 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
|-----|-----|-----|-----|-----|-----|-----|-----|
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

Notice that each number to the right is the double of the number to its left. For instance, 2 is the double of 1, 4 is the double of 2, and so on. This pattern continues as we move from left to right in the table of powers of 2.

2. Start with the Largest Power of 2 Less Than or Equal to the Decimal Number(44):

  • The largest power of 2 less than or equal to 44 is 32. So, we put a 1 under the column for 32 and subtract 32 from 44, leaving us with 12.
| 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
|-----|-----|-----|-----|-----|-----|-----|-----|
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |

3 . We Repeat the Process with the Remaining Value:

  • The largest power of 2 less than or equal to 12 is 8. So, we put a 1 under the column for 8 and subtract 8 from 12, leaving us with 4.
| 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
|-----|-----|-----|-----|-----|-----|-----|-----|
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |

Repeat the process until the remaining value becomes 0.

| 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
|-----|-----|-----|-----|-----|-----|-----|-----|
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 |
  • The binary representation of the decimal number 44 is 101100.

Binary to Decimal

To convert a binary number to decimal, we’ll use a systematic approach where the binary number is listed alongside a table of powers of 2. For each 1 in the binary number, we add the corresponding power of 2 to obtain the decimal equivalent.

Consider the binary number: 101100

Add the Powers of 2 for Each 1 in the Binary Number:

  • For the binary number 101100
| 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
|-----|-----|-----|-----|-----|-----|
| 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 0 | 1 | 1 | 0 | 0 |

Adding the powers of 2 for each 1 in the binary number: 32+8+432+8+4 = 44

The decimal equivalent of the binary number 101100 is 44.

Binary to Hexadecimal

To convert binary to hexadecimal, we group the binary digits into sets of 4 bits starting from right to left, and then we convert each group to its corresponding hexadecimal value.

Consider the binary number:
110110101

  1. Group Binary Digits into Sets of 4 Bits from right to left :
  • Starting from the right, the binary number 110110101 is split into

0001 1011 0101 .

Convert Each Group to its Corresponding Hexadecimal Value:

  • 0001 in binary is 1 in hexadecimal.
  • 1011 in binary is B in hexadecimal.
  • 0101 in binary is 5 in hexadecimal.

Now , let’s combine the Hexadecimal Values:

The hexadecimal representation of 110110101 is 1B5.

Hexadecimal to Binary

To convert hexadecimal to binary, we convert each hexadecimal digit to its corresponding 4-bit binary representation.

Consider the hexadecimal number: 1B5

Convert Each Hexadecimal Digit to Binary:

  • 1 in hexadecimal is 0001 in binary.
  • B in hexadecimal is 1011 in binary.
  • 5 in hexadecimal is 0101 in binary.

Let’s Combine the Binary Values:

  • The binary representation of 1B5 is 110110101.

Decimal to Hexadecimal

To convert decimal to hexadecimal, we first convert the decimal number to binary and then convert the binary representation to hexadecimal.

Consider the decimal number: 183

  1. Convert Decimal to Binary:

Decimal 183 in binary is 10110111.

Now , let’s convert Binary to Hexadecimal:

  • Grouping the binary number 10110111 into sets of 4 bits gives us

1011 0111.

  • 1011 in binary is B in hexadecimal.
  • 0111 in binary is 7 in hexadecimal.

Now let’s Combine the Hexadecimal Values:

The hexadecimal representation of 183 is B7.

Hexadecimal to Decimal

To convert hexadecimal to decimal, we first convert the hexadecimal number to binary and then convert the binary representation to decimal.

Consider the hexadecimal number: B7

  1. Convert Hexadecimal to Binary:
  • B in hexadecimal is 1011 in binary.
  • 7 in hexadecimal is 0111 in binary.

let’s Combine the Binary Values:

  • The binary representation of B7 is 1011 0111.
  1. Convert Binary to Decimal:
  • Binary 1011 0111 in decimal is 183.

In conclusion, understanding binary, hexadecimal, and decimal conversions is vital for networking. It helps us handle data better and improve network performance. Mastering these skills is essential for staying up-to-date in the networking field.

--

--

Musindesarah

Tech enthusiast exploring cybersecurity, aspiring SOC Analyst🔐💻