What is an octal number?

Octal is base 8: it counts with the digits 0 to 7 only, so 10 in octal is eight and 777 is 511. One octal digit stands for three bits, which is why Unix and Linux file permissions are written in octal. In chmod 755, each digit adds up read (4), write (2) and execute (1), for the owner, the group and everyone else. Octal also shows up in umask values, in escape codes of C strings and in lessons on number bases. Python and JavaScript write octal numbers with a 0o prefix, as in 0o755, and C with a leading zero, as in 0755.

You check an octal number when a form, a script or a config file asks for permissions or another octal value, or before you convert it.

Tool description

Type or paste a value into the Octal number field, and the result shows as you type: "Octal number is valid" or "Octal number is not valid". Spaces and line breaks around a pasted value are ignored. The page has no settings: the rules below always apply.

Numbers that pass

  • The digits 0 to 7: 755, 644, 17
  • A 0o or 0O prefix: 0o755, 0O644
  • Leading zeros, the way C writes octal: 0755, 0007

Numbers that fail

  • The digits 8 and 9: 778, 19
  • A plus or minus sign: -7
  • Other prefixes: 0x7, o755, \755
  • Decimal points and spaces inside: 7.5, 7 55
  • Symbolic permissions: rwxr-xr-x

Good to know

  • Many ordinary numbers are valid octal numbers too, such as 42 and 100, so the check can't tell which base someone meant. Only an 8 or a 9 gives a decimal number away.
  • A valid octal number isn't always a valid permission: chmod takes at most four digits, but 12345 passes this check too.
  • To turn symbolic permissions into an octal mode, or back, use the chmod Symbolic Octal Converter. To see what an octal number is in decimal, use the Octal to Decimal Converter.

Features

  • Checks octal numbers made of the digits 0 to 7
  • Accepts the 0o prefix and leading zeros
  • Results as you type, with no button to press
  • Runs in your browser, so nothing you type is sent anywhere