We've updated our
Privacy Policy effective December 15. Please read our updated Privacy Policy and tap

Учебные пособия > Mathematics for the Liberal Arts

Binary, Octal, and Hexadecimal

In modern computing and digital electronics, the most commonly used bases are decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). If we are converting between two bases other than decimal, we typically have to convert the number to base 10 first, and then convert that number to the second base. However, we can easily convert directly from binary to octal, and vice versa, and from binary to hexadecimal, and vice versa. This video gives a basic introduction to these conversions: https://youtu.be/5sS7w-CMHkU For another description, this one is more like a math lecture: https://youtu.be/2UwxdCLFW70 For further clarification, recall that the numbers 0 through 7 can be represented by up to three digits in base two. In base eight, these numbers are represented by a single digit.

Base 2 (binary) number Base 10 (decimal) equivalent Base 8 (octal) number
000  0 0
001 1 1
010 2 2
011 3 3
100 4 4
101 5 5
110 6 6
111 7 7
Now when we get to the number 8, we need four digits in base 2 and two digits in base 8. In fact, the numbers 8 through 63 can be represented by two digits in base 8. We need four, five, or six digits in base 2 to represent these same numbers:
Base 2 number Base 10 equivalent Base 8 number
1000 8 10 = 1 × 8 + 0 × 1
1001 9 11 = 1 × 8 + 1 × 1
1010 10 12 = 1 × 8 + 2 × 1
111100 60 74 = 7 × 8 + 4 × 1
111101 61 75 = 7 × 8 + 5 × 1
111110 62 76 = 7 × 8 + 6 × 1
111111 63 77 = 7 × 8 + 7 × 1
The number 64 in base 8 is represented by 1008 = 1 × 82 + 0 × 81 + 0 × 80 = 1 × 64 + 0 × 8 + 0 × 1. In base 2, this would be 10000002. Do you see a pattern here? For a single digit in base 8, we need up to three digits in base 2. For two digits in base 8, we need 4, 5, or 6 digits in base 2. For three digits in base 8, we need 7, 8, or 9 digits in base 2. For each additional digit in base 8, we need up to three spaces to represent it in base 2. Here’s a way to remember this: 23 = 8, so we need three spaces. A couple of examples would help here.
  1. Convert the number 61578 to base 2. We split each digit in base 8 to three digits in base 2, using the three digit base 2 equivalent, so 68 = 1102, 18 = 0012, etc.
  2. Convert the number 101110110010102 to base 8. Split this number into sets of three, starting with the right-most digit, then convert each set of three to its equivalent in base 8.
For hexadecimal (base 16), we need up to four digits in binary to represent each single digit. Remember this by recalling that 24 = 16, so we need four digits. You may want to print out copies of these worksheets to help you with your conversions between binary and octal or hexadecimal: If you would like to quiz yourself on converting the numbers 0 through 255 to binary, octal, and hexadecimal (and between those bases), here’s a link to the representations of those numbers: Binary, Octal, and Hexadecimal Numbers.

Licenses & Attributions

CC licensed content, Original

  • Mathematics for the Liberal Arts I. Provided by: Extended Learning Institute of Northern Virginia Community College Located at: https://online.nvcc.edu/. License: CC BY: Attribution.

CC licensed content, Shared previously

  • Pre-Algebra 3 - Decimal, Binary, Octal & Hexadecimal. Authored by: MyWhyU. License: All Rights Reserved. License terms: Standard YouTube License.
  • Binary, Hexadecimal, Octal conversion. Authored by: Joey Lawrance. License: All Rights Reserved. License terms: Standard YouTube License.