Skip to content

Latest commit

 

History

History
66 lines (35 loc) · 1.73 KB

base-conversion.md

File metadata and controls

66 lines (35 loc) · 1.73 KB
modified title
2025-01-15 23:17:09 UTC
Common conversion methods between number bases include:

Common conversion methods between number bases include:

Binary to Decimal

Sum the products of each binary digit and its corresponding power of 2.

  • Example: 1010 in binary is 1*2^3 + 0*2^2 + 1*2^1 + 0*2^0 = 10 in decimal.

Decimal to Binary

Divide the decimal number by 2 and record the remainders.

  • Example: 10 in decimal is 1010 in binary.

Hexadecimal to Decimal

Sum the products of each hexadecimal digit and its corresponding power of 16.

  • Example: 1F in hexadecimal is 1*16^1 + F*16^0 = 1*16 + 15 = 31 in decimal.

Decimal to Hexadecimal

Divide the decimal number by 16 and record the remainders.

  • Example: 31 in decimal is 1F in hexadecimal.

Binary to Hexadecimal

Group the binary digits into sets of four (starting from the right) and convert each group to its hexadecimal equivalent.

  • Example: 10101100 in binary is AC in hexadecimal.

Hexadecimal to Binary

Convert each hexadecimal digit to its 4-bit binary equivalent.

  • Example: AC in hexadecimal is 10101100 in binary.

Octal to Decimal

Sum the products of each octal digit and its corresponding power of 8.

  • Example: 157 in octal is 1*8^2 + 5*8^1 + 7*8^0 = 111 in decimal.

Decimal to Octal

Divide the decimal number by 8 and record the remainders.

  • Example: 111 in decimal is 157 in octal.

Binary to Octal

Group the binary digits into sets of three (starting from the right) and convert each group to its octal equivalent.

  • Example: 10101100 in binary is 254 in octal.

Octal to Binary

Convert each octal digit to its 3-bit binary equivalent.

  • Example: 254 in octal is 10101100 in binary.