Chmod Calculator

Tick read, write and execute for owner, group and others and get the octal mode, the rwx string and a ready-to-copy chmod command.

Permission checkboxes
WhoRead (4)Write (2)Execute (1)OctalBits
Owner (u)7111
Group (g)5101
Public / others (o)5101
Special bits (the optional fourth digit)
Octal755
Octal, four digits0755
Symbolic (ls -l)rwxr-xr-x
chmod symbolicu=rwx,g=rx,o=rx
Binary111 101 101
Umask that yields this0022
chmod 755 deploy.sh

Common modes

Umask preview

A umask lists the bits to take away from new files (which start at 666) and new directories (which start at 777).

new files 644 (rw-r--r--) ยท new directories 755 (rwxr-xr-x)

How chmod numbers work

A Unix mode is twelve bits. The lower nine are three groups of three - read, write and execute for the owner, the group and everyone else - and octal writes each group as one digit, which is the whole reason chmod uses octal. Read is worth 4, write 2 and execute 1, so 7 is rwx, 6 is rw-, 5 is r-x and 4 is r--. The three bits above them are setuid (4), setgid (2) and sticky (1), written as an optional leading digit: 4755, 2775, 1777.

Because each permission is a single bit, setting and clearing them is ordinary masking: mode | 0o020 adds group write and mode & ~0o002 removes world write. The bitmask generator and octal to binary converter show the same bits for any value.

Permission digit reference

DigitBinarySymbolicMeaning
0000---no access
1001--xexecute only
2010-w-write only
3011-wxwrite and execute
4100r--read only
5101r-xread and execute
6110rw-read and write
7111rwxread, write and execute

Common modes and where they belong

ModeSymbolicTypical use
644rw-r--r--Regular file: owner writes, everyone reads
755rwxr-xr-xDirectory or script: owner writes, everyone runs/enters
600rw-------Private file, SSH private key, .env
700rwx------Private directory, ~/.ssh
640rw-r-----Config readable by a service group
775rwxrwxr-xShared team directory
2775rwxrwsr-xShared directory, files inherit the group (setgid)
1777rwxrwxrwt/tmp: world-writable with sticky bit
4755rwsr-xr-xsetuid binary such as passwd
444r--r--r--Read-only for everyone

Code Examples

chmod 755 deploy.sh          # rwxr-xr-x
chmod 600 ~/.ssh/id_ed25519   # rw-------
chmod u=rwx,g=rx,o= app/      # symbolic: 750
chmod -R g+w shared/          # add group write, recursively
chmod 2775 shared/            # setgid: new files inherit the group
stat -c '%a %A %n' deploy.sh  # 755 -rwxr-xr-x deploy.sh (GNU)

Frequently Asked Questions

What does chmod 755 mean?

Each octal digit is three permission bits: read 4, write 2, execute 1. 7 = 4+2+1 = rwx for the owner, and 5 = 4+1 = r-x for the group and for others. So 755 is rwxr-xr-x: the owner can change the file, everyone can read it and run it (or enter it, for a directory).

What is the difference between 644 and 755?

Only the execute bits. 644 (rw-r--r--) suits ordinary files: the owner writes, everyone reads. 755 (rwxr-xr-x) adds execute for everyone, which scripts and programs need to run and directories need so people can cd into them and reach the files inside.

What permissions should an SSH private key have?

600 (rw-------) or 400 (r--------). OpenSSH refuses to use a private key that the group or others can read, with the error "UNPROTECTED PRIVATE KEY FILE". The ~/.ssh directory itself should be 700.

What is the fourth digit in chmod 4755 or 1777?

The special bits: setuid 4, setgid 2 and sticky 1. 4755 is a setuid program that runs with its owner's privileges (passwd works this way). 2775 makes new files in a shared directory inherit its group. 1777 is /tmp: anyone can create files, but only a file's owner can delete it.

What do a capital S or T mean in ls -l output?

That a special bit is set without the execute bit under it. rwSr--r-- is setuid with no owner execute, which does nothing useful on a regular file and is usually a mistake. A lowercase s or t means both the special bit and execute are set.

How does umask relate to chmod?

umask lists the bits to remove from new files. New files start from 666 and new directories from 777, then the umask bits are cleared: the common umask 022 gives 644 files and 755 directories, and 077 gives 600 and 700. umask never adds execute to a file.

Is chmod 777 safe?

Rarely. 777 lets every user on the machine modify or replace the file, and on a web server it lets any compromised process rewrite your code. Fix the ownership with chown instead, and use 755 or 775 for directories and 644 or 664 for files.

Related Tools

This tool runs entirely in your browser - nothing you enter is uploaded or stored.