How to use the Binary to Octal tool
- Enter the bits in the Base-2 number box with no spaces, for example 111101101.
- Select Convert to translate the number to base 8.
- Read the octal digits in the Result box. The result has no 0o prefix and no leading zeros.
- Select Copy to take the octal number, or Example to convert 101101 to 55.
How binary to octal conversion works
Eight is two cubed, so three bits map to one octal digit: 000 is 0, 001 is 1, 010 is 2, 011 is 3, 100 is 4, 101 is 5, 110 is 6 and 111 is 7. Split the bits into threes from the right, pad the left group with zeros, and write one digit per group.
The sample 101101 splits into 101 and 101. Both groups are 5, so the octal form is 55. Eight bits do not divide evenly by three, so 11111111 is read as 011 111 111 and becomes 377.
101101 -> 55
11111111 -> 377
111101101 -> 755
110100100 -> 644
-101101 -> -55File permissions: the classic octal case
A Unix file mode has nine permission bits: read, write and execute for the owner, the group and everyone else. Each trio is one octal digit, with read worth 4, write worth 2 and execute worth 1.
The bits 111 101 101 mean rwx for the owner and r-x for group and others. Entered as 111101101, they convert to 755, the argument you would pass to chmod. In the same way 110 100 100 is rw-r--r-- and converts to 644.
Octal compared with hexadecimal
Hexadecimal groups bits in fours and suits bytes, which are eight bits. Octal groups in threes and suits fields whose width is a multiple of three: permission triplets, the 12-bit and 36-bit words of older machines, and the four-digit transponder codes used in aviation.
Octal needs no letters. C string literals still support octal escapes, so the byte 11111111 can be written as \377.
Input rules for this converter
The tool reads one whole number. A leading minus sign is allowed and a 0b prefix is skipped. Spaces between bit groups, a binary point and any digit other than 0 or 1 are reported as an invalid base-2 digit. The limit is 4,096 characters.
Since the value is what gets converted, 000101101 returns 55 and not 055. Remember that when a format expects a fixed number of octal digits. The output never carries a 0 or 0o prefix, so add the one your language requires.
Frequently asked questions
How do I convert binary to octal by hand?
Mark off the bits in groups of three from the right. Add one or two zeros to the left group if it is short. Then write the value of each group, 0 to 7, in the same order.
How do I turn permission bits into a chmod number?
Write the nine permission bits as one binary number, with 1 for each granted permission, and convert it. rwxr-xr-x is 111101101, which gives 755.
Why does octal only use the digits 0 to 7?
A base-8 system has eight digits. Three bits can express exactly the values 0 through 7, so each group of three bits fits in one digit and 8 and 9 are never needed.
Does the result start with 0 or 0o?
No. The tool prints bare digits. Add the prefix your language uses for octal literals, such as 0o in Python and modern JavaScript or a leading 0 in C.
Should I use octal or hex for my binary value?
Use hex for bytes and words, since two hex digits make a byte. Use octal when the data naturally falls into 3-bit fields. For the same value, octal needs more digits than hex.