Binary to Octal Converter
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
Enter the binary value
Spaces are stripped. Any length is fine; the leftmost group is zero-padded to three bits automatically.
-
2
Group bits in threes from the right
`111101100` becomes `111 101 100`. The grouping direction matters — always right-to-left.
-
3
Map each triplet
000 = 0, 001 = 1, 010 = 2, up to 111 = 7. Every triplet maps to exactly one octal digit.
-
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 %aall talk octal. - Escape sequences:
\100in 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:
0755is octal 755 (= decimal 493),755is decimal 755. Check your language before pasting. - JavaScript removed legacy octal: strict mode rejects
0755. Use0o755instead. - 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
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
Random Color Palette Generator
Generate random color palettes from 2 to 15 swatches, choose a vibrant, pastel, muted or dark style, then copy HEX codes or CSS variables.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.
HEX Color Picker
Pick any colour visually and get its HEX, RGB, HSL, HSV and CMYK values, plus accessibility contrast against white and black.
BBCode to HTML Converter
Convert BBCode (bulletin-board markup) to clean HTML. Handles formatting tags, lists, quotes, code, images, links and tables.
Random Color Generator
Generate 1 to 50 random HEX colors with swatches you can preview, copy and use in CSS, design tests or palette exploration.