Math glossary

Number Systems in Maths: Decimal, Binary, Octal, and Hexadecimal

Understand positional number systems and learn to convert whole numbers and fractions between binary, octal, decimal, and hexadecimal.

TL;DR

A positional number system writes values using digits and a base. Decimal uses base 10, binary uses base 2, octal uses base 8, and hexadecimal uses base 16. Place values are powers of the base.

Key Points

  • The base tells you how many digit values are available and how adjacent places relate.
  • Digits in base bb have values from zero through b−1b-1.
  • Read a numeral by multiplying each digit by its place value and adding the results.
  • To convert a decimal whole number to another base, divide repeatedly and read the remainders from last to first.
  • A base changes how a number looks. Sets such as integers and rational numbers classify its value.

What is a number system in maths?

A number system is a way to represent numbers. In a positional number system, both the digit and its position contribute to the value. For instance, the same 2 represents twenty in 241024_{10} and sixteen in 24824_8. In the first numeral it occupies the tens place. In the second it occupies the eights place.

The small subscript names the base. Use it when more than one base appears. For example, 10210_2, 10810_8, 101010_{10}, and 101610_{16} have values two, eight, ten, and sixteen respectively. The units place always has weight b0=1b^0=1 in base bb. Moving one place to the left multiplies the weight by bb. OpenStax, Introduction to Whole Numbers

The numeral ten has value two in binary, eight in octal, ten in decimal, and sixteen in hexadecimal
The written digits stay the same in each row. The base determines the weight of the left digit.

Roman numerals also represent numbers, with rules for combining symbols. Their letters do not mark columns of base powers. See the Roman numerals chart for a comparison.

What are the four common positional number systems?

System Base Digits Where you may see it
Binary 2 0 and 1 Digital circuits and bit patterns
Octal 8 0 through 7 Compact notation for groups of three bits
Decimal 10 0 through 9 Everyday measurements and calculations
Hexadecimal 16 0 through 9, then A through F Compact notation for groups of four bits

Hexadecimal uses A for ten, B for eleven, C for twelve, D for thirteen, E for fourteen, and F for fifteen. So 1F161F_{16} means one sixteen plus fifteen ones. Octal has no digit 8, just as binary has no digit 2. McMaster University, Number Systems

How do you read any base in decimal?

Starting from the units place, label the positions b0,b1,b2,b3,…b^0,b^1,b^2,b^3,\ldots as you move left. Multiply each digit by its position’s value. For a numeral with three digits d2,d1,d0d_2,d_1,d_0, the number is

d2b2+d1b+d0.d_2b^2+d_1b+d_0.

To the right of the radix point, use b−1,b−2,b−3,…b^{-1},b^{-2},b^{-3},\ldots. For instance, the first place after the point in binary is worth one-half, and the first place after the point in octal is worth one-eighth. This extends the familiar place-value rule for tenths and hundredths.

How do you convert decimal to binary, octal, or hexadecimal?

For a whole number, divide by the target base and save the remainder. Divide the quotient again until it is zero. Each division peels off the next digit from the right. Read the remainders from the bottom up. Convert remainders 10 through 15 to A through F for hexadecimal.

For a fractional part, multiply it by the target base. Take the integer part as the next digit to the right of the point and repeat with the new fractional part. Read those digits in the order you find them. A fraction can terminate in one base and repeat in another. A reduced fraction with denominator qq terminates in base bb exactly when qq divides some power of bb. Decimal 0.10.1 has denominator 10, so it repeats in binary because no power of 2 has a factor of 5. Open Book Project, Number Systems and Complements

When can you convert without going through decimal?

Since 8=238=2^3, every octal digit corresponds to three binary digits. Since 16=2416=2^4, every hexadecimal digit corresponds to four. Separate the binary digits into groups from the radix point outward. On the whole-number side you may pad the far left with zeros. On the fractional side you may pad the far right. Padding on the wrong end shifts the values.

To convert between octal and hexadecimal, expand each digit into binary, then regroup around the same point. The binary number system guide and hexadecimal conversion guide apply the method to longer numerals.

How are numeral systems different from number sets?

A base tells you how to write a value. A number set tells you which values a category contains. The same number 12 is represented by 121012_{10}, 110021100_2, and C16C_{16}. In all three forms it is a positive integer and a rational number.

In much school mathematics, natural numbers start at 1, while whole numbers start at 0. Some textbooks include 0 in the natural numbers. Integers include the negative whole numbers, zero, and the positive whole numbers. A rational number can be written as a ratio of integers with a nonzero denominator. Irrational numbers such as 2\sqrt{2} are real numbers outside that set. OpenStax, Real Numbers: Algebra Essentials

Worked Number-System Examples

Example 1

Convert 10110210110_2 to decimal.

  1. Label the five places 16, 8, 4, 2, and 1.
  2. The ones occur in the 16, 4, and 2 places.
  3. Add 16+4+2=2216+4+2=22.

Example 2

Convert 5728572_8 to decimal.

  1. The positions have values 64, 8, and 1.
  2. Multiply the digits by their weights: 5(64)5(64), 7(8)7(8), and 2(1)2(1).
  3. Add 320+56+2=378320+56+2=378.

Example 3

Write decimal 94 in hexadecimal.

  1. Divide 94 by 16 to get quotient 5 and remainder 14.
  2. Divide 5 by 16 to get quotient 0 and remainder 5.
  3. Read the remainders up. Since 14 is E, the result is 5E165E_{16}. Check 5(16)+14=945(16)+14=94.

Example 4

Convert 110101121101011_2 to octal and hexadecimal.

  1. Group the integer places from the right in threes: 001001, 101101, 011011.
  2. These groups give 1538153_8.
  3. Group instead in fours: 01100110, 10111011. These give 6B166B_{16}. Both represent decimal 107.

Example 5

Write decimal 0.68750.6875 in binary.

  1. Double 0.68750.6875 to get 1.3751.375. Take digit 1 and keep 0.3750.375.
  2. Double 0.3750.375 to get 0.750.75. Take digit 0. Doubling 0.750.75 gives 1.51.5, so take digit 1.
  3. Doubling the final 0.50.5 gives 1.01.0, so take digit 1 and stop. The result 0.101120.1011_2 equals 1/2+1/8+1/161/2+1/8+1/16.

Example 6

Add 278+16827_8+16_8 directly in octal.

  1. The units digits sum to 7+6=137+6=13 in decimal. That is one group of eight plus five, so write 5 and carry 1.
  2. The eights digits sum to 2+1+1=42+1+1=4.
  3. The result is 45845_8. A decimal check gives 23+14=37=4(8)+523+14=37=4(8)+5.

Mistakes That Change Base Conversion

Mistake 1: Using a digit too large for the base

1088108_8 is invalid because 8 is not an octal digit. A single position can hold only zero through seven. Eight units carry into the next position.

Mistake 2: Reading the division remainders from top to bottom

The first remainder belongs in the units place. For decimal 19, dividing repeatedly by 2 produces remainders 1, 1, 0, 0, 1 in that order. Reading upward gives 10011210011_2.

Mistake 3: Dropping a zero within a numeral

A zero can hold an empty place. In 2038203_8, it keeps the 2 in the sixty-fours place. Removing it gives 23823_8, which has a different value.

Try It Yourself

  1. Convert 3048304_8 to decimal.
  2. Write decimal 45 in binary.
  3. Convert A.416A.4_{16} to decimal.

Answers and Reasoning

  1. The value is 3(64)+4=1963(64)+4=196.
  2. 1011012101101_2. Its ones are in the 32, 8, 4, and 1 positions.
  3. The value is 10+4/16=10.2510+4/16=10.25.

Frequently Asked Questions

Why do number systems use different bases?

Base 10 is the convention for most daily arithmetic. Base 2 uses two states, making it practical for digital representation. Octal and hexadecimal save space when people read and write binary values.

Is 0.1120.11_2 the same number as 0.11100.11_{10}?

No. In binary, 0.112=1/2+1/4=0.75100.11_2=1/2+1/4=0.75_{10}. The decimal numeral 0.11100.11_{10} means eleven hundredths.

Does a negative number require a new digit?

Ordinary mathematical notation can use a minus sign before the numeral. A digital format may use a separate convention such as two’s complement. Its interpretation depends on bit width.

Conclusion

  • Identify the base and check that every digit is allowed.
  • Use powers of the base to read a numeral or repeated division to write a whole number in a new base.
  • Verify a conversion by evaluating the result in decimal.

Read More

Research Behind This Article

  1. OpenStax, Prealgebra 2e: Introduction to Whole Numbers. OpenStax
  2. McMaster University, 4D6 Lab Manual: Number Systems. McMaster Physics
  3. The Open Book Project, Number Systems and Complements. Open Book Project
  4. OpenStax, College Algebra 2e: Real Numbers, Algebra Essentials. OpenStax