Binary to Octal Converter

Convert binary numbers to octal (and back) using 3-bit grouping.

Convert 3-bit groups chmod-ready
Rate this calculator

Binary ↔ Octal

3-bit grouping · chmod-ready output

Instructions — Binary to Octal Converter

1

Pick a direction

Binary → Octal takes 0s and 1s, returns digits 0-7. Octal → Binary expands each octal digit into three bits. Default 11010110 yields 326.

2

Enter the value

Whitespace and separators are stripped. Quick-pick buttons load chmod-style examples (755, 644, 700) plus a full byte (11111111 = 377).

3

Read the step-by-step

Below the result, each 3-bit triplet is shown alongside its octal digit. Output spacing options group binary bits in triplets, nibbles, or no spacing.

chmod cheat sheet: 4 = read, 2 = write, 1 = execute. Sum them. 7 = rwx, 6 = rw-, 5 = r-x.
Why 3-bit groups: 8 = 2³, so each octal digit fits exactly three binary bits with no leftover.

Formulas

Octal is base 8. Because 8 = 2³, three binary bits map onto one octal digit cleanly. This is the same trick hex uses with four bits.

Binary to octal (triplet method)
$$ \text{Octal digit} = b_2 \cdot 4 + b_1 \cdot 2 + b_0 \cdot 1 $$
Group bits in threes from the right, pad with leading zeros, convert each triplet to its octal digit 0-7.
Octal to binary
$$ \text{Triplet} = \text{octal digit in 3 bits} $$
Each octal digit expands to exactly three binary bits. 7 becomes 111, 5 becomes 101, 0 becomes 000.
Why three bits per digit
$$ 2^3 = 8 $$
Three bits have exactly 8 possible patterns (000 through 111). Octal has 8 digits (0-7). The match is perfect, which is why no arithmetic is required.
Worked example: 11010110
$$ 011_2 = 3, \; 010_2 = 2, \; 110_2 = 6 $$
Split from the right: 110, 010, 011 (read left-to-right: 011, 010, 110). The answer is 326 octal.
chmod permission encoding
$$ rwx = 111_2 = 7_8 \\ r{-}x = 101_2 = 5_8 $$
Unix chmod uses three octal digits: owner, group, others. Each digit encodes read (4), write (2), execute (1).
Decimal cross-check
$$ 326_8 = 3 \cdot 64 + 2 \cdot 8 + 6 = 214_{10} $$
Multiply each octal digit by 8 to its position. Same value as binary 11010110, just in a different base.

Reference

Triplet Lookup — 3-bit binary to octal
BinaryDecimalOctal
00000
00111
01022
01133
10044
10155
11066
11177

Common chmod and permission values

chmod codes
OctalBinaryrwx
755111 101 101rwxr-xr-x
644110 100 100rw-r--r--
700111 000 000rwx------
777111 111 111rwxrwxrwx
600110 000 000rw-------
555101 101 101r-xr-xr-x
Bytes in octal
BinaryOctalDec
0000000000
000011111715
000100002016
01111111177127
10101010252170
11111111377255

Article — Binary to Octal Converter

Binary to Octal Conversion Explained

Binary to octal conversion turns a string of 0s and 1s into a base-8 representation, where each octal digit (0-7) corresponds to exactly three binary bits. The binary 111101101 becomes 755 — the same notation millions of Linux users type after chmod every day. The rule is mechanical because 2³ equals 8.

Octal is less common than hex in modern code, but it has a permanent home in Unix file permissions and a handful of legacy systems. Once you know the 8-row triplet table, conversion is a glance.

What is binary to octal conversion?

Binary to octal is a base change, not an arithmetic operation. The numeric value is preserved across the conversion: 214 in decimal, 11010110 in binary, 326 in octal. Each octal place is worth eight times the place to its right. The digit set runs 0 through 7 — there is no 8 or 9 in octal, just as there is no A in decimal.

Octal sat between binary and decimal on early computers because the 12-bit, 24-bit, and 36-bit word sizes of machines like the PDP-8 divided cleanly into 3-bit groups. The IBM/360 standardized on 8-bit bytes and 32-bit words, which divide into 4-bit nibbles, and hex displaced octal in most contexts.

Did you know

Charles XII of Sweden proposed using octal in 1717, almost three centuries before computing. Emanuel Swedenborg argued for base 8 as a human counting system around the same time. Both were ignored — decimal won at the human level, and the computer-age octal revival had nothing to do with these earlier proposals.

The 3-bit grouping method

The algorithm is straightforward. Take the binary number, split into 3-bit groups starting from the right, pad the leftmost group with zeros if it is short, then convert each group to its octal digit. The technical name for a 3-bit group is a triplet — there is no standard term equivalent to nibble.

Take 110101110. Split from the right: 110, 101, 110. Convert each: 110 = 6, 101 = 5, 110 = 6. The answer is 656 octal. A few of the most useful triplet-to-digit mappings are worth memorizing because they cover most cases.

Triplet anchors — memorize these
111 = 7 110 = 6
101 = 5 100 = 4
011 = 3 010 = 2
001 = 1 000 = 0

Octal to binary the reverse way

Reverse conversion is even faster. Each octal digit expands to exactly three binary bits. Write them in order, strip leading zeros from the final result, and you are done. The octal 755 expands to 111 101 101. Concatenated and trimmed: 111101101.

Note the leading-zero rule: pad each digit to three bits during expansion. Octal 5 is 101, not just 11. Without the leading zero you misalign the next digit when concatenating.

Why octal still matters in Unix

The killer app for octal in 2026 remains chmod. Linux, macOS, BSD, and every other Unix-like system encodes file permissions as three octal digits — one for the owner, one for the group, one for everyone else. Each digit packs three permission bits: read (weight 4), write (weight 2), execute (weight 1).

chmod 755 means the owner has read + write + execute (4 + 2 + 1 = 7) and everyone else has read + execute (4 + 1 = 5). The same value in binary is 111 101 101 — exactly nine bits, three groups of three. This is the entire reason octal survives: file permissions are nine bits, and three octal digits express nine bits compactly.

Did you know

The C function umask() also takes its argument in octal: umask(022) clears the group and other write bits from new files. The leading 0 is the C signal that a number literal is octal. In modern Python you must write 0o022 instead, because Python 3 dropped the C-style leading-zero convention.

Binary, octal, and hex compared

Hex (base 16) and octal (base 8) both exist for the same reason: condensing binary into a shorter human-readable form. The difference is the group size. Octal uses 3 bits per digit, hex uses 4. For a byte (8 bits), hex gives you two clean digits; octal gives three digits where the leftmost has only two significant bits.

  • One byte = 8 binary bits = 2 hex digits = 3 octal digits (top digit max 3)
  • One word (32-bit) = 32 bits = 8 hex digits = 11 octal digits
  • chmod = 9 bits = 3 octal digits cleanly (no padding needed)
  • Hex prefix = 0x (C), # (CSS), $ (Pascal)
  • Octal prefix = leading 0 (C), 0o (Python 3, JS), 0o or @ (Forth)
  • Max digit: octal 7, hex F, decimal 9

chmod octal cheat sheet

Web servers and shared filesystems use a small set of canonical chmod values. Memorize these and you cover most real-world permission decisions.

644 (file)
rw-r--r--
owner writes, world reads
755 (dir)
rwxr-xr-x
owner full, world traverses
Tip

SSH private keys must be chmod 600 (rw-------) or the SSH client refuses to use them. Public web files should be 644 for files and 755 for directories. SUID/SGID files are 4xxx or 2xxx — the leading digit is a fourth octal digit for special bits.

Common binary-to-octal mistakes

The classic error is grouping from the left. Always start from the right and pad the leftmost group with zeros. The number 1010 has four bits, so pad to six: 001 010, giving 12 octal — not 10 octal (which would be 8 decimal, totally wrong).

Beware leading zeros in code

In C and many older languages, 0755 is octal 755 (decimal 493), but 755 without the leading zero is decimal 755. Forgetting the leading 0 silently changes the permission you set. Modern languages either banned this (Python 3) or require explicit 0o prefix.

The second mistake is confusing octal with hex. The number 70 in octal is 56 in decimal; the same digits 70 in hex are 112 in decimal. Always confirm the base before interpreting a digit string.

Octal prefixes in code (0, 0o)

The leading-zero convention dates back to 1972 K&R C. It worked when programmers were careful, but it produced a famous category of bugs where adding a leading zero for visual alignment accidentally re-interpreted a constant. Python 3 fixed this by requiring 0o755 instead of 0755. JavaScript followed in ES6, and Rust uses 0o too.

This converter strips any leading 0 or 0o prefix automatically when you paste an octal value. Same for spaces, commas, and underscores in either direction.

FAQ

Group the bits in threes from the right, padding the leftmost group with zeros if needed. Convert each triplet to a single octal digit 0-7. Example: 11010110 splits into 011, 010, 110, giving 326.
Because 8 = 2³. Three binary bits have exactly 8 patterns (000-111), matching the 8 octal digits (0-7). The grouping is exact — no arithmetic, no rounding.
The biggest active use is Unix file permissions: chmod 755 sets owner to rwx and others to r-x. Older systems (PDP-11, early Unix) also used octal for opcodes and addresses because their word sizes were multiples of three bits.
755 octal = 111 101 101 binary. Each triplet is one permission group: owner gets 111 (rwx), group gets 101 (r-x), others get 101 (r-x). Read = 4, write = 2, execute = 1; add for combinations.
11111111 = 377 octal = FF hex = 255 decimal. An 8-bit byte needs three octal digits because 8 bits don't divide evenly by three — the top group has just two bits.
Hex uses 4-bit groups (one digit = 4 bits, 16 values). Octal uses 3-bit groups (one digit = 3 bits, 8 values). Hex is more compact for byte-aligned data; octal aligned better with old word sizes that were multiples of 3 bits.
In C, C++, and many older languages a leading 0 in a number literal means octal. So 0755 in C is 493 in decimal, not 755. Modern languages like Python 3 require 0o755 to avoid this confusion. JavaScript uses 0o too.
Yes, but you need to know the bit width first. In two's complement 8-bit form, -1 is 11111111 = 377 octal. In 16-bit form, -1 is 177777 octal. The hex or octal representation depends on how many bits store the signed value.