Binary to Octal Converter — How to Convert Binary to Octal
Convert binary to octal instantly using our free online calculator, or learn the step-by-step 3-bit grouping method. Includes a complete binary-to-octal table, worked examples with fractional binary numbers, common mistakes, Unix permission examples, and code snippets in Python, JavaScript, C, and Java.
Try it: Binary to Octal Converter
Binary to Octal Conversion Table (3-Bit Grouping)
Every 3-bit binary pattern corresponds to exactly one octal digit (0–7). Use this fundamental 3-bit conversion table as the direct lookup key for all binary-to-octal conversions:
| 3-Bit Binary | Octal Digit (Base 8) | Decimal Equivalent | Positional Weights (4 + 2 + 1) |
|---|---|---|---|
| 000 | 0 | 0 | 0·4 + 0·2 + 0·1 = 0 |
| 001 | 1 | 1 | 0·4 + 0·2 + 1·1 = 1 |
| 010 | 2 | 2 | 0·4 + 1·2 + 0·1 = 2 |
| 011 | 3 | 3 | 0·4 + 1·2 + 1·1 = 3 |
| 100 | 4 | 4 | 1·4 + 0·2 + 0·1 = 4 |
| 101 | 5 | 5 | 1·4 + 0·2 + 1·1 = 5 |
| 110 | 6 | 6 | 1·4 + 1·2 + 0·1 = 6 |
| 111 | 7 | 7 | 1·4 + 1·2 + 1·1 = 7 |
Popular Fast Conversions:
| Binary | Octal | Decimal | Usage |
|---|---|---|---|
| 010 000 | 20 | 16 | octalbin20 reverse |
| 111 101 101 | 755 | 493 | Unix rwxr-xr-x |
| 110 100 100 | 644 | 420 | Unix rw-r--r-- |
| 101 010 | 52 | 42 | Alternating bits |
| 011 111 111 | 377 | 255 | Max 8-bit byte (0xFF) |
Why binary-to-octal conversion works.
Octal is base-8 and binary is base-2. The simple conversion comes from one fact: 8 = 2³. Because 8 is exactly the third power of 2, exactly 3 binary digits represent all 8 possible octal values (0–7). No arithmetic is required — just a direct one-to-one group substitution.
How to convert a binary to octal number (Step-by-step).
- Write the binary number. Example:
11010110 - Group from the right in triplets, padding left as needed: 11010110 → [011] [010] [110]
- Convert each group: 011=3, 010=2, 110=6
- Concatenate: → 326₈
Worked examples.
Example 1: 1010 → Octal
Example 2: 11111111 → Octal (255 decimal)
Example 3: 101010 → Octal
Example 4: 111101101 → Octal (Unix chmod 755)
How to convert a binary fraction to octal.
Converting a binary number with a decimal point (a binary fraction) to octal requires splitting the number into two parts: the integer part and the fractional part. Group the integer part from right-to-left, and group the fractional part from left-to-right. Pad with zeros as necessary.
Example: Convert 11010111.010110 to octal
Common mistakes to avoid.
- ✗Grouping from left instead of right. Binary
10101groups as[010][101]= 25₈, not from the left. - ✗Forgetting leading zeros.
1010must pad to[001][010]= 12₈. - ✗Wrong side for fraction padding. Fractional trailing zeros go on the RIGHT.
.01→[010]= .2₈.
Binary to octal in code.
print(format(int("11010110", 2), 'o')) # Output: 326
print(format(int("101010", 2), 'o')) # Output: 52
print(oct(int("11111111", 2))[2:]) # Output: 377 const toOct = b => parseInt(b, 2).toString(8);
console.log(toOct("11010110")); // "326"
console.log(toOct("101010")); // "52" #include <stdio.h>
#include <stdlib.h>
int main() {
long d = strtol("11010110", NULL, 2);
printf("%lo\n", d); // 326
return 0;
} System.out.println(
Integer.toOctalString(Integer.parseInt("11010110", 2))
); // "326" Unix/Linux file permissions (real-world use).
| chmod | Binary | Permissions | Use Case |
|---|---|---|---|
| 755 | 111 101 101 | rwxr-xr-x | Scripts/executables |
| 644 | 110 100 100 | rw-r--r-- | Regular files |
| 600 | 110 000 000 | rw------- | SSH keys |
| 777 | 111 111 111 | rwxrwxrwx | Full access (avoid) |
r=4, w=2, x=1. Digit 7 = 4+2+1 = all permissions set (rwx).
Frequently Asked Questions
How do you convert binary to octal?▼
Group binary bits into sets of three starting from the rightmost digit. Pad the leftmost group with leading zeros if fewer than three bits. Convert each 3-bit group to its octal digit (0–7).
What is the binary to octal conversion with decimal point?▼
For fractional binary, group the integer part right-to-left and the fractional part left-to-right, each in triplets. Pad with zeros as needed. Example: 11010111.010110 → 327.26₈.
What is the octal value of binary 10101?▼
Binary 10101 = 25₈. Groups: [010][101] → 2, 5 → 25₈ (decimal 21).
Why do we group bits in threes for octal?▼
Because 8 = 2³. Three binary digits create 8 unique combinations (000–111) which map exactly to the 8 octal digits (0–7).
Binary → Octal Table
| 3-Bit | Oct | Dec |
|---|---|---|
| 000 | 0 | 0 |
| 001 | 1 | 1 |
| 010 | 2 | 2 |
| 011 | 3 | 3 |
| 100 | 4 | 4 |
| 101 | 5 | 5 |
| 110 | 6 | 6 |
| 111 | 7 | 7 |
Powers of 2 in Octal
| 2ⁿ | Dec | Oct |
|---|---|---|
| 2⁰ | 1 | 1 |
| 2¹ | 2 | 2 |
| 2² | 4 | 4 |
| 2³ | 8 | 10 |
| 2⁴ | 16 | 20 |
| 2⁵ | 32 | 40 |
| 2⁶ | 64 | 100 |
| 2⁷ | 128 | 200 |