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 , the places are worth . In base , they are worth , and the digits are to . A small subscript names the base:
| Base | Name | Digits | Place values |
|---|---|---|---|
| binary | |||
| ternary | |||
| hexadecimal | –, – |
To write a base-10 number in base , divide by again and again, and read the remainders from the last one to the first.
Why repeated division gives the digits
Write . Every term but the last is a multiple of , so the remainder of divided by is , the last digit, a fact from modular arithmetic. The quotient is , 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
-
What is the base-10 value of ?
Answer
Full solution
.
-
What is in binary?
Answer
Full solution
.
-
What is the base-10 value of ?
Answer
Full solution
.
-
What is the base-10 value of ?
Answer
Full solution
.
-
What is in base ?
Answer
Full solution
, so the digits are .
-
What is the largest number, in base , that binary digits can show?
Answer
Full solution
.
-
What is in hexadecimal?
Answer
Full solution
and .
-
A student reads as one hundred one. What is its value in base ?
Answer
Full solution
.
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.