Binary to Octal Converter

Binary

Octal is still alive in Unix file permissions (chmod 755), old PDP-era manuals and a handful of microcontroller toolchains. This converter takes any binary string, groups the bits three at a time from the right, and maps each group to a base-8 digit between 0 and 7 — with optional leading-zero prefix for languages that treat 0755 as an octal literal.

How to convert binary to octal

  1. 1

    Enter the binary value

    Spaces are stripped. Any length is fine; the leftmost group is zero-padded to three bits automatically.

  2. 2

    Group bits in threes from the right

    `111101100` becomes `111 101 100`. The grouping direction matters — always right-to-left.

  3. 3

    Map each triplet

    000 = 0, 001 = 1, 010 = 2, up to 111 = 7. Every triplet maps to exactly one octal digit.

  4. 4

    Read and copy the result

    Choose raw digits (`754`), a leading-zero prefix (`0754`) or a `0o` prefix (`0o754`) for Python 3 and Rust compatibility.

Triplet to octal map

Binary Octal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

Example: Unix permissions

rwxr-xr-x means owner has read/write/execute, group and others have read/execute. In binary that is 111 101 101, which groups directly into octal 755 — the exact number you pass to chmod.

When octal is useful

  • File permissions: chmod 644, umask 022, stat -c %a all talk octal.
  • Escape sequences: \100 in C is octal for @ (64 decimal).
  • Legacy machine codes: PDP-8, PDP-11 and early DEC docs list opcodes in octal because their word size was a multiple of 3 bits.
  • Visual clarity: three-bit grouping reads faster than binary without the full alphabet of hex.

Gotchas

  • Leading zero means octal in C: 0755 is octal 755 (= decimal 493), 755 is decimal 755. Check your language before pasting.
  • JavaScript removed legacy octal: strict mode rejects 0755. Use 0o755 instead.
  • Grouping direction: if you group left-to-right you will get a wrong answer for any bitstream whose length is not a multiple of 3.

Frequently Asked Questions

Because permission flags come in neat groups of three (read, write, execute) per role (user, group, other). Each triplet maps 1-to-1 to an octal digit, so rwxr-xr-x reads as 755 in one step.

For C, Perl and shells use a leading 0. For Python 3, Rust and Swift use 0o. For chmod on the command line use no prefix.

Negative numbers require a signed bit width (two’s complement). Specify the width first; otherwise the converter treats all input as unsigned.

No. The converter zero-pads the leftmost group up to three bits. 1111 becomes 001 111, which is octal 17.

Related Tools