Base Converter

Convert Numbers Between Any Base

Use this calculator to convert numbers between different bases. Enter your number, select the input and output bases, and click Convert.

How to Convert Numbers Between Different Bases

Converting numbers between different bases is a fundamental operation in computer science and mathematics. Here's a comprehensive guide on how to perform these conversions:

Base Conversion Formula

To convert a number from base \(b\) to decimal (base 10), use the following formula:

\[ (d_n d_{n-1} ... d_1 d_0)_b = d_n \times b^n + d_{n-1} \times b^{n-1} + ... + d_1 \times b^1 + d_0 \times b^0 \]

Where:

  • \(d_i\) represents each digit of the number
  • \(b\) is the base of the original number
  • \(n\) is the position of the digit (starting from 0 for the rightmost digit)

Conversion Steps

  1. Convert the input number to decimal (base 10) using the formula above.
  2. Convert the decimal number to the target base by repeatedly dividing by the new base and keeping track of the remainders.
  3. The remainders in reverse order will give the digits of the number in the new base.

Example Conversion

Let's convert the binary number 1010 (base 2) to hexadecimal (base 16).

Step 1: Convert to Decimal

Binary 1010 to decimal:

\[ 1010_2 = 1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 = 8 + 0 + 2 + 0 = 10_{10} \]

Step 2: Convert Decimal to Hexadecimal

To convert 10 to hexadecimal, divide by 16 repeatedly and read the remainders from bottom to top:

10 ÷ 16 = 0 remainder 10 (A in hexadecimal)
        

Therefore, 10 in hexadecimal is A.

Final Result

1010 (base 2) = A (base 16)

Visual Representation

1010 Base 2 A Base 16

This diagram illustrates the process of converting the binary number 1010 to its hexadecimal equivalent A.