Skip to content
uencoder

Octal

Octal is the base-8 numeral system, using digits 0-7, where each digit corresponds to 3 binary bits; it was widely used on early computers.

Purpose

It compactly represented binary on early machines whose word lengths were multiples of 3 and reads naturally in 3-bit groups; today it survives mainly in Unix file permission bits.

Mechanism

Each octal digit corresponds to 3 binary bits. Values expand by positional weight: N = d_n×8^n + ... + d_0×8^0. For example, octal 17 = 1×8 + 7 = 15 in decimal.

Use cases

  • Unix file permissions (e.g., chmod 755)
  • Instruction debugging on early PDP-8 / PDP-11
  • JavaScript 0o-prefixed numeric literals
  • C-style string escapes

Examples

  • Input
    493
    Output
    755

    Decimal 493 → octal 755, the rwxr-xr-x permission mask

Common errors

A leading 0 making a JavaScript number parse as octal (non-strict mode)
Use the 0o prefix to declare octal explicitly

Related terms

Related tools

References