Network

Method of number base conversion

What is radix conversion

Radix conversion is the process of converting a number from one base (radix) to another.

In computing, numbers are often represented in different bases, such as:

  • Binary (Base 2): Used by computers, consisting of only 0s and 1s.
  • Octal (Base 8): Sometimes used in computing for compact binary representation.
  • Decimal (Base 10): The standard numbering system humans use.
  • Hexadecimal (Base 16): Commonly used in programming and memory addressing.

Radix conversion is essential in programming, especially when dealing with low-level operations, memory addresses, and encoding schemes.

You can find more details here.

How to convert bases

How to convert decimal to binary(base 10 => base 2)

When you convert decimal “109” to binary, you can make the following calculation.

109 ÷ 2 = 54 R 1
54 ÷ 2 = 27 R 0
27 ÷ 2 = 13 R 1
13 ÷ 2 = 6 R 1
6 ÷ 2 = 3 R 0
3 ÷ 2 = 1 R 1

Binary: 1101101

You continue to divide by “2”.

And then if its quotient became “1”, you need to count quotient and remainder.

109 ÷ 2 = 54 R 1(7)
54 ÷ 2 = 27 R 0(6)
27 ÷ 2 = 13 R 1(5)
13 ÷ 2 = 6 R 1(4)
6 ÷ 2 = 3 R 0(3)
3 ÷ 2 = 1(1) R 1(2)

How to convert decimal to hexadecimal(base 10 => base 16)

When you convert decimal “26295” to hexadecimal, you can make the following calculation.

26295 ÷ 16 = 1643 R 7
1643 ÷ 16 = 102 R 11
102 ÷ 16 = 6 R 6

Hexadecimal: 66C(11)7

You continue to divide by “16”.

And then if its quotient became “1” ~ “15”, you need to count quotient and remainder.

26295 ÷ 16 = 1643 R 7(4)
1643 ÷ 16 = 102 R 11(3)
102 ÷ 16 = 6(1) R 6(2)

*Difference between decimal and hexadecimal:
10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F

How to convert binary to decimal(base 2 => base 10)

When you convert binary “1101101” to decimal, you can make the following calculation.

(26×1) + (25×1) + (24×0) + (23×1) + (22×1) + (21×0) + (20×1)
= 64 + 32 + 8 + 4 + 1
= 109

Starting from the least significant bit of a binary number, multiply 20, 21, 22, … by either 1 or 0.

How to convert binary to hexadecimal(base 2 => base 16)

When you convert binary “1101101” to hexadecimal, you can make the following calculation.

Starting from the least significant bit of a binary number, divide it into groups of 4 bits, and convert each group in hexadecimal.

And then, Combine the numbers from each group.

1. Divide it into groups of 4 bits.
Binary: “1101101” => Binary1: “0110”, Binary2: “1101”

2. Convert each group in hexadecimal.
Binary1: “0110” => Hexadecimal1: 6
Binary2: “1101” => Hexadecimal2: D(13)

3. Combine the numbers from each group.
Hexadecimal1: 6 || Hexadecimal2: D(13) = 6D

How to convert hexadecimal to binary(base 16 => base 2)

When you convert hexadecimal “6D” to binary, you can make the following calculation.

First of all, Separate the hexadecimal number each digit by one like “6” and “D”.

And, Convert the hexadecimal number each digit to a decimal number like “6” and “13”(D).

And, Convert the each decimal number to a binary number like “110”(decimal:6) and “1101”(decimal:13).

Finally, Combine the binary numbers.

“110” || “1101” = 1101101

How to convert hexadecimal to decimal(base 16 => base 10)

When you convert hexadecimal “6DD” to decimal, you can make the following calculation.

(162×6) + (161×D) + (160×D)
= (256×6) + (16×13) + (1×13)
= 1536 + 208 + 13
= 1757

Starting from the least significant bit of a hexadecimal number, multiply 20, 21, 22, … by each a hexadecimal number.