DevToolCase
Sign in Sign in

Calculate chmod permissions

Tick read, write and execute boxes to get the chmod value in octal (755) and symbolic notation (rwxr-xr-x), or decode an existing mode.

Share this result

Encrypted in your browser. The key stays in the link, after “#”: only the people you give it to can read it, not even DevToolCase.

The link works for

Sign in for longer links or links without expiry, and to find them in your account.

Common modes

Permissions of the owner, the group and the others
Read (4) Write (2) Execute (1)Digit
Owner
6
Group
4
Others
4
Special bits

Octal and ls -l modes replace the ticked boxes; symbolic modes such as a+x or go-w change them.

Octal
644
Symbolic
rw-r--r--
Command, octal
chmod 644 file
Command, symbolic
chmod u=rw,g=r,o=r file

Runs entirely in your browser: nothing you type is sent or stored.

Read, write and execute on files and directories

Every file on Linux, macOS and other Unix systems has three sets of permissions: for its owner, for its group, and for all the other users. The same three letters do not mean the same thing on a file and on a directory.

PermissionOn a fileOn a directory
r readread its contentlist the names of its files (ls)
w writechange its contentcreate, delete and rename files in it (with x)
x executerun it as a program or scriptenter it (cd) and reach the files inside

Deleting a file depends on the write permission of its directory, not of the file itself. A directory with r but no x shows the names of its files but none can be opened.

How the octal value is calculated

Each permission is worth a number: read 4, write 2, execute 1. Add them up for each class to get one digit from 0 to 7, then write the owner, group and others digits in this order. 755 is 4 + 2 + 1 = 7 for the owner (rwx), 4 + 1 = 5 for the group (r-x) and 5 for the others, written rwxr-xr-x by ls -l.

Each digit is a number in base 8 whose 3 bits are r, w and x, which is why modes are written in octal: the number base converter shows 755 as the bits 111 101 101. A fourth digit in front holds the special bits.

umask and default permissions

New files are not created with the mode you choose but with 666 for files and 777 for directories, minus the bits of the umask. With the usual umask 022, which removes write for the group and the others, new files get 644 and new directories 755. A umask of 077 gives 600 and 700, nothing for anyone but you.

Type umask in a terminal to see yours, and umask 027 to change it for the session. Symbolic modes without a class, such as chmod +x, also follow the umask, whereas this calculator applies them to all classes.

Setuid, setgid and the sticky bit

Setuid (4000) runs a program with the rights of its owner instead of the user who started it: passwd is -rwsr-xr-x and owned by root so that it can write the password file. Setgid (2000) does the same with the group, and on a directory makes new files inherit its group, handy for a shared project folder. The sticky bit (1000) on a directory lets users delete only their own files, as in /tmp (drwxrwxrwt).

ls -l shows them in place of x: s or t when x is also granted, S or T in capitals when it is not, which is usually a mistake.

Common values

ModeSymbolicTypical use
644rw-r--r--web pages, configuration and most files
600rw-------SSH private keys, files with passwords
755rwxr-xr-xdirectories, scripts and programs
700rwx------private directories, such as ~/.ssh
664rw-rw-r--files edited by a team sharing a group
775rwxrwxr-xdirectories shared with a group
777rwxrwxrwxalmost never: anyone can change or replace the files
1777rwxrwxrwtshared directories such as /tmp

Add this browser’s favorites to your account?

This browser has 0 favorites that your account does not have:

Either way, this browser keeps its favorites: you find them again after signing out.