Discrete Math · Undergraduate

Number Bases: Binary, Hexadecimal and Base b

Quick answer

In base b, each place is worth a power of b instead of a power of 10, and the digits run from 0 to b − 1. So 1011 in base 2 means 8 + 0 + 2 + 1 = 11. To convert a base-10 number to base b, divide by b again and again and read the remainders from last to first. Hexadecimal, base 16, uses the digits 0–9 and A–F for 10–15. Since 16 = 2⁴, each hex digit stands for exactly four binary digits.

What you'll learn

  • Find the value of a numeral written in base b
  • Convert a base-10 number to base b by repeated division
  • Read and write hexadecimal numbers
  • Convert between binary and hexadecimal in groups of four bits

Place values are powers of the base

In base 1010, the places are worth 1,10,100,…1, 10, 100, \ldots. In base bb, they are worth 1,b,b2,…1, b, b^2, \ldots, and the digits are 00 to b−1b - 1. A small subscript names the base:

10112=1⋅8+0⋅4+1⋅2+1⋅1=111011_2 = 1 \cdot 8 + 0 \cdot 4 + 1 \cdot 2 + 1 \cdot 1 = 11
BaseNameDigitsPlace values
22binary0,10, 11,2,4,8,16,…1, 2, 4, 8, 16, \ldots
33ternary0,1,20, 1, 21,3,9,27,…1, 3, 9, 27, \ldots
1616hexadecimal00–99, AA–FF1,16,256,…1, 16, 256, \ldots

To write a base-10 number in base bb, divide by bb again and again, and read the remainders from the last one to the first.

Why repeated division gives the digits

Write n=dkbk+⋯+d1b+d0n = d_k b^k + \cdots + d_1 b + d_0. Every term but the last is a multiple of bb, so the remainder of nn divided by bb is d0d_0, the last digit, a fact from modular arithmetic. The quotient is dkbk−1+⋯+d1d_k b^{k-1} + \cdots + d_1, the same number with its last digit removed, so dividing again gives the next digit. That is why the remainders come out from right to left.

Worked examples

Common mistakes

Practice problems

  1. What is the base-10 value of 11010211010_2?

    Answer

    2626

    Full solution

    16+8+2=2616 + 8 + 2 = 26.

  2. What is 2525 in binary?

    Answer

    1100111001

    Full solution

    25=16+8+125 = 16 + 8 + 1.

  3. What is the base-10 value of 3C163C_{16}?

    Answer

    6060

    Full solution

    3⋅16+12=603 \cdot 16 + 12 = 60.

  4. What is the base-10 value of 2123212_3?

    Answer

    2323

    Full solution

    2⋅9+1⋅3+2=232 \cdot 9 + 1 \cdot 3 + 2 = 23.

  5. What is 100100 in base 55?

    Answer

    400400

    Full solution

    100=4⋅25100 = 4 \cdot 25, so the digits are 4,0,04, 0, 0.

  6. What is the largest number, in base 1010, that 88 binary digits can show?

    Answer

    255255

    Full solution

    111111112=28−111111111_2 = 2^8 - 1.

  7. What is 10110110210110110_2 in hexadecimal?

    Answer

    B6B6

    Full solution

    1011=11=B1011 = 11 = B and 0110=60110 = 6.

  8. A student reads 1012101_2 as one hundred one. What is its value in base 1010?

    Answer

    55

    Full solution

    4+0+1=54 + 0 + 1 = 5.

Frequently asked questions

How do I convert binary to decimal?

Multiply each bit by its place value, 1, 2, 4, 8, … from the right, and add. 1011₂ = 8 + 2 + 1 = 11.

How do I convert decimal to binary?

Divide by 2 repeatedly and write down each remainder. Read the remainders from the last one to the first.

What are the hex digits?

0–9, then A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

Why do binary and hex convert so neatly?

16 = 2⁴, so each hex digit matches a block of four binary digits.

What to learn next