Octal to binary, three bits per digit
This octal to binary converter expands every octal digit into its 3-bit pattern. It is the clearest way to see what a Unix permission mode actually switches on, and it works for any octal number, including fractions and very long values.
Digit-by-digit expansion
Octal digit 0 1 2 3 4 5 6 7
Bits 000 001 010 011 100 101 110 111
Replace each digit and join the groups. Leading zeros of the first group are dropped in the output, so octal 12 becomes 001 010, shown as 1010.
Permission modes as bits
In a mode like 755, the digits describe the owner, the group and everyone else. Within each 3-bit group, the bits mean read (4), write (2) and execute (1).
| Mode | Binary | Permissions |
|---|---|---|
| 755 | 111 101 101 | rwx r-x r-x |
| 644 | 110 100 100 | rw- r-- r-- |
| 600 | 110 000 000 | rw- --- --- |
A fourth leading digit adds the special bits. In 4755, the extra 4 (binary 100) is the setuid bit, so the full pattern is 100 111 101 101.
Example
Input Output
12 1010
377 11111111
644 110100100
755 111101101
17.4 1111.1
For 17.4, the fraction digit 4 expands to 100, and trailing zeros after the point are removed, leaving 1111.1.
A note on grouping
The Group digits option splits bits into blocks of four (Nibbles) or eight (Bytes), which aligns with hexadecimal, not octal. With Nibbles selected, 755 appears as 0001 1110 1101, which reads directly as 1ED in hex. Leave grouping off when you want to read permission triples, and split the digits into threes yourself as in the table above.
Input rules
- Digits 8 and 9 are invalid and produce an error.
- A
0oprefix or a leading zero is accepted. - Spaces and underscores inside a number are ignored; the field holds one number at a time.
Converting octal to binary in code
# Python
format(0o755, "b") # '111101101'
bin(int("755", 8)) # '0b111101101'
// JavaScript
parseInt("755", 8).toString(2); // '111101101'
# Shell with bc: set obase before ibase
echo "obase=2; ibase=8; 755" | bc
# Current mode of a file on Linux, in octal
stat -c %a script.shThe order in the bc line matters: once ibase=8 is set, every later number is read as octal, so writing obase=2 afterwards still works, but obase=10 would silently mean eight. Setting the output base first avoids the trap.
Reading the pattern in reverse
You can also use the binary output to answer questions like "can the group write to this file?" Take the middle triple and check its middle bit: in 664 (110 110 100), the group triple is 110, so write is allowed. In 644 it is 100, so the group can only read.
To go back, use binary to octal. For the hexadecimal form of a mode, try octal to hex, and for its plain integer value, octal to decimal.