Octal and number base tools
Move a number between binary, octal, decimal and hex, read Linux file permissions, or turn text into octal codes.
As a chmod value, 755 means rwxr-xr-x
Runs in your browser. Nothing you type is uploaded.
Number bases
For a number written in one base that you need in another.
Text and file permissions
For octal codes in text, C strings and Unix permissions.
Common chmod values
Each digit is one group of users: owner, then group, then everyone else. Read is 4, write is 2, execute is 1.
| Value | Shown by ls -l | Owner / group / others | Typical use |
|---|---|---|---|
644 | rw-r--r-- | read and write / read / read | Ordinary files, web pages, config files |
600 | rw------- | read and write / none / none | A private SSH key |
400 | r-------- | read / none / none | An AWS .pem key, which SSH refuses if others can read it |
755 | rwxr-xr-x | all / read and run / read and run | Folders and scripts others may run |
700 | rwx------ | all / none / none | The ~/.ssh folder |
775 | rwxrwxr-x | all / all / read and run | A folder a team shares |
777 | rwxrwxrwx | all / all / all | Avoid on a server: any user can change the file |
Writing octal in code
The same 755 means different things depending on where you type it.
| Where | Write it as | What 0755 does there |
|---|---|---|
| chmod in a shell | chmod 755 file | Same as 755; chmod always reads the digits as octal |
| C and C++ | 0755 | Octal, value 493 |
| Python 3 | 0o755 | SyntaxError |
| JavaScript | 0o755 | Error in strict mode and in modules |
Where octal still turns up
Octal is base 8 and uses the digits 0 to 7. Each octal digit stands for exactly three bits, which is why it suits Unix file permissions: read, write and execute are three bits, so one digit covers one group of users. In 755 the owner can read, write and execute, and everyone else can read and execute.
Outside chmod, octal mostly appears in older C code, where a number that starts with 0 is read as octal, so 010 means eight. For any other base, the base converter handles everything from base 2 to base 36.
Frequently asked questions
What does chmod 755 mean?
The owner can read, write and execute (7 = 4 + 2 + 1). The group and everyone else can read and execute but not change the file (5 = 4 + 1). ls -l shows it as rwxr-xr-x.
What does chmod 600 do?
It lets the owner read and write the file and shuts everyone else out, rw-------. SSH expects this on private keys and will refuse to use a key that other users can read.
How do I change file permissions in Linux?
Run chmod 644 file.txt with the number you want, or use letters, such as chmod u+x script.sh to let the owner run a script. Check the result with ls -l. Changing a file you do not own needs sudo.