DEVELOPER TOOL

Chmod Calculator (Octal, Symbolic & Umask)

Tick boxes, type an octal mode like 755 or paste rwxr-xr-x to get the matching permissions and chmod commands, including setuid, setgid, sticky bits and umask.

Presets:
Tick the permissions. Read = 4, write = 2, execute = 1; setuid = 4000, setgid = 2000, sticky = 1000.
WhoReadWriteExecuteSpecialDigit
Owner (u)
Group (g)
Others (o)
Result
Octal
Symbolic
ls -l shows
Numeric command
Symbolic command
Directory note
In words

Apply a symbolic change

Umask calculator

New itemRequestedResultSymbolic
File666
Directory777
umask -S

About this tool

This chmod calculator converts Unix file permissions between the three ways you meet them: checkboxes for owner, group and others, an octal number such as 755, and the symbolic string rwxr-xr-x that ls -l prints. Change any one and the other two follow. Unlike most permission calculators it also handles the three special bits (setuid, setgid and the sticky bit), shows the s, S, t and T letters they produce, writes the matching chmod commands, applies symbolic changes such as g+w,o-rwx, and works out what a umask does to new files and directories. Everything runs in your browser.

How to use the chmod calculator

  1. Enter a mode in whichever form you have: type an octal number (one to four digits), paste a symbolic string from ls -l (with or without the leading - or d), tick the checkboxes, or click a preset.
  2. Choose file or directory. The ls -l line and the directory notes depend on it.
  3. Copy a command. The numeric and symbolic commands set exactly the same mode, so use whichever your script or team prefers.
  4. Optionally apply a change like u+x or go-w to the current mode, or enter your umask to see the default modes for new files and directories.

How chmod numbers work

Each class of user (the file's owner, its group, and everyone else) gets one octal digit. The digit is the sum of read (4), write (2) and execute (1), so 7 is rwx, 5 is r-x and 4 is r--. An optional fourth digit in front holds the special bits: 4 for set-user-ID, 2 for set-group-ID and 1 for the restricted deletion flag, better known as the sticky bit. The GNU coreutils manual on numeric modes lists the same values, and the POSIX chmod specification defines them as S_ISUID (4000), S_ISGID (2000) and S_ISVTX (1000). Leading digits you leave out count as zeros, so chmod 55 means 0055.

BitOwnerGroupOthers
Read (r)400404
Write (w)200202
Execute (x)100101
Special4000 setuid2000 setgid1000 sticky

On a directory, read lets you list the names inside, write lets you create, delete and rename entries, and execute (search) lets you enter it and reach the files inside.

Reading s, S, t and T

The special bits do not get their own column in ls -l. They replace the execute letter of a class, following the rules in the POSIX ls specification: s in the owner or group position means setuid or setgid is set and that class can also execute; S means the special bit is set but execute is not. In the others position, t means the sticky bit plus execute for others, and T means the sticky bit without it. An uppercase letter on a program is usually a mistake, because the bit has nothing to act on.

What the special bits do

One GNU detail catches people out: on a directory, chmod leaves the setuid and setgid bits alone unless you mention them. chmod 755 dir, chmod 0755 dir and chmod u=rwx,go=rx dir all keep an existing setgid bit. To clear it, the GNU manual on directory set-ID bits says to use five or more octal digits (chmod 00755 dir), an operator mode such as =755, or a symbolic mode such as g-s. This is a GNU extension, so the tool shows that form whenever you pick a directory, and the symbolic change box below follows the same rule.

How umask works

A umask lists the permission bits to withhold from new files. Programs usually request 666 for a new file and 777 for a new directory, and the kernel turns off every bit that is set in the umask. The Linux umask(2) manual gives the classic case: 0666 & ~022 = 0644. So a umask of 022 gives files 644 and directories 755, while 077 gives 600 and 700. The POSIX umask utility also defines umask -S, which prints the permissions that remain allowed, such as u=rwx,g=rx,o=rx for 022.

Worked example

The calculator opens on 755. The digits are 7 (4+2+1, rwx) for the owner and 5 (4+1, r-x) for group and others, so the tool shows:

Octal             0755
Symbolic          rwxr-xr-x
ls -l shows       -rwxr-xr-x
Numeric command   chmod 755 file
Symbolic command  chmod u=rwx,g=rx,o=rx file

Click the 2775 preset and the type switches to directory. The leading 2 adds setgid, which replaces the group's x with s: drwxrwsr-x, set with chmod 2775 dir or chmod u=rwx,g=rwxs,o=rx dir.

Common mistakes

Use cases

Need to see the bits behind each digit? The Binary & Hex Converter converts octal, binary and hex. For scheduling the scripts you just made executable, try the Cron Expression Generator.

Related reading

For a longer explanation, read our guide: chmod 777, 755 and 644 explained.

Frequently asked questions

What does chmod +x do?

It adds execute permission. With no u, g, o or a in front, chmod applies the change to all three classes but skips any bit that is set in your umask. With the common 022 umask that means owner, group and others all get execute. Use u+x to add it for the owner only.

How do I change permissions recursively without making every file executable?

Use find to treat files and directories separately: find . -type d -exec chmod 755 {} + and then find . -type f -exec chmod 644 {} +. Another option is chmod -R u=rwX,go=rX, where the capital X adds execute only to directories and to files that are already executable.

Who is allowed to change a file’s permissions?

Only the file’s owner or a privileged user such as root. Being in the file’s group, or having write permission on the file, is not enough. To change who owns a file use chown, which normally needs root, and use chgrp to change its group.

Why does Git only show modes 644 and 755?

Git does not store full Unix permissions for files. It records only whether a regular file is executable, as mode 100755, or not, as 100644. Group and other bits, umask effects and special bits are not tracked. Use git update-index --chmod=+x to mark a file executable in the repository.

Why does SSH say my private key permissions are too open?

OpenSSH refuses to use a private key that other users can read, and prints a warning about an unprotected private key file. Run chmod 600 on the key file so only you can read and write it. Mode 400, read-only for the owner, is accepted too.

Why does chmod have no effect on my USB drive?

Drives formatted with FAT32 or exFAT, common on USB sticks and SD cards, do not store Unix permissions. On Linux the permissions you see are set when the drive is mounted, through mount options such as uid, gid, umask, fmask and dmask, so changing them requires remounting rather than chmod.