Skip to content
BetterDL

Octal

Also called: base 8, base-8, oct

The base-8 number system, with digits 0 to 7. One octal digit stands for exactly 3 bits, so binary converts to octal in groups of three.

Octal is base 8. It uses the digits 0 to 7 (there is no digit 8 or 9), and its place weights are powers of 8: 1, 8, 64, 512, …

Since 8 = 2³, one octal digit is exactly 3 bits:

  • 0 = 000, 1 = 001, 2 = 010, 3 = 011
  • 4 = 100, 5 = 101, 6 = 110, 7 = 111

So binary octal conversion is a lookup: group the bits in threes from the right. 110 101₂ = 65₈, which is 6 × 8 + 5 = 53.

Octal was popular on early computers whose word sizes were multiples of 3 bits. Today hexadecimal is far more common, but octal survives in Unix and Linux file permissions. In chmod 754, each digit is three on/off bits for read (4), write (2) and execute (1): 7 = 111 (all three), 5 = 101 (read and execute), 4 = 100 (read only).

To get between octal and hex, go through binary, since 3-bit and 4-bit groups don't line up (see hex octal conversion).

1
32
1
16
0
8
1
4
0
2
1
1

Worked example

Example

725₈ to binary and to decimal

Expand each digit into 3 bits, then check the value with octal weights.

  1. 1.

    7 → 111, 2 → 010, 5 → 101.

  2. 2.

    Binary: 111010101₂. The 0 in 010 must stay, or every bit to its left shifts.

  3. 3.

    Decimal: 7 × 64 + 2 × 8 + 5 = 448 + 16 + 5 = 469.

  4. 4.

    Check from the binary: 256 + 128 + 64 + 16 + 4 + 1 = 469.

Common mistakes

  • Using the digit 8 or 9. Octal stops at 7.

  • Dropping a digit's leading zero: 2 must become 010, not 10.

  • Converting hex to octal digit by digit. The groups don't line up, so go through binary.

Practice Octal

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Octal is taught in Number Systems.