toolqik

93 · Encode & Convert

Octal Converter

Convert octal to decimal, binary or hex and back, and decode chmod permissions.

Runs in your browser
Format
Result

  

About this tool

Convert numbers between octal (base 8) and decimal, binary or hexadecimal, in either direction: choose the bases under From and To. When the input is a three- or four-digit octal number, the tool also explains it as Unix file permissions: 755 → rwxr-xr-x.

How octal works

Octal uses the digits 0–7, and each position is worth 8 times the one to its right: 755 = 7×64 + 5×8 + 5 = 493. Because 8 = 2³, each octal digit maps to exactly three bits (7 = 111, 5 = 101), which is why octal is used for things grouped in threes.

chmod permissions

Each digit describes one group of users, owner, group and others, and is the sum of read (4), write (2) and execute (1):

OctalSymbolicTypical use
755rwxr-xr-xDirectories and scripts: owner can edit, everyone can run
644rw-r--r--Normal files: owner can edit, everyone can read
600rw-------Private files such as SSH keys
700rwx------Private directories like ~/.ssh
777rwxrwxrwxEveryone can do everything: almost never a good idea
4755rwsr-xr-xsetuid program (runs as its owner)

Octal in code

Many languages write octal with a prefix: 0o755 in Python 3, JavaScript and Rust, or a leading zero (0755) in C, Go and older JavaScript. That leading zero is a classic bug: in C, 010 is 8, not 10.

Features

  • Any size: numbers are converted exactly with arbitrary-precision arithmetic, so 64-bit values and even longer numbers never lose digits (a normal calculator rounds anything above 253).
  • Fractions: 3.75 → 11.11. Fractions that don’t end in the target base, like 0.1 in binary, are cut off after the chosen number of digits and marked with ….
  • Negative numbers with a minus sign, or as two’s complement in 8, 16, 32 or 64 bits, the way computers store signed integers.
  • Flexible input: prefixes (0b, 0o, 0x, #), spaces, underscores and thousands separators are ignored. Convert many numbers at once, one per line.
  • The first number is also shown in every base, with the number of bits it needs.

FAQ

How do I convert octal to decimal?

Enter the octal number. Each digit is multiplied by a power of 8 and added, so 755 is 7×64 + 5×8 + 5 = 493.

What does chmod 755 mean?

Owner: read, write and execute (7). Group and others: read and execute (5). Symbolically rwxr-xr-x.

What is the difference between 644 and 755?

644 lets the owner read and write and everyone else only read, which suits ordinary files. 755 adds execute for everyone, which directories and scripts need.

How do I convert decimal to octal?

Set From to Decimal and To to Octal, or click Swap direction.

Why does 010 equal 8 in some languages?

In C, Go and older JavaScript a leading zero means octal. Python 3 and modern JavaScript require 0o10 instead, to avoid this mistake.

esc
↑↓ navigate↵ open