Developer Bases
Decimal to octal
Decimal value
Octal 755
Divide by eight, keep the remainders
The same number elsewhere
Decimal 493
Binary 111101101
Binary, grouped 0001 1110 1101
Hexadecimal 1ED
Bits needed 9
Note
Group binary into threes
The same number in each base
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
| 65535 | 1111111111111111 | 177777 | FFFF |
Advertisement
320 × 100
Divide repeatedly by eight and read the remainders backwards. 493 gives 755. Alternatively convert to binary and group the bits into threes from the right — each group is one octal digit.
How to convert decimal to octal
1 Enter the decimal number.
2 Read the octal result.
3 Check the binary form to see the three-bit grouping.
4 Prefix with 0o if pasting into modern code.
Going via binary is usually faster than dividing by eight. Convert to binary, group the bits into threes from the right, and read each group — the grouping is exact because 8 is 2 cubed. This is the same trick that makes hex easy, with three bits instead of four, and it works for any base that is a power of two.
Questions
755, which as Unix permissions is rwxr-xr-x.
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING