FreeToGenerate.com

A setuid bit without an execute bit shows as a capital S — set, and doing nothing. Two thirds of the modes that carry a special bit have one.

ReadWriteExecute
Owner
Group
Others

Run the file as its owner rather than as whoever started it. On a directory it does nothing on Linux.

Run the file as its group. On a directory, new files inside inherit that group instead of the creator's.

On a directory, only the owner of a file may delete it — this is what makes a shared /tmp safe. On a regular file it is ignored.

0755
rwxr-xr-x
chmod 0755 filename

Octal with three or four digits, or the permission field from ls -l, with or without its leading type character.

What a umask leaves behind

A umask only ever takes permissions away. The reason the same umask gives a file 644 and a directory 755 is not the umask — it is that programs ask for 666 and 777 respectively, and the umask subtracts from each.

New file
644
New directory
755

Also available in: Español · Português · Français · العربية

Chmod calculator

Permissions to octal and back, with the ls rendering, the command to copy, and a warning when a special bit is switched on and has nothing to act on.

What is a chmod calculator?

On a Unix system every file carries nine permission bits: read, write and execute, for the owner, for the group and for everyone else. The chmod command sets them, and it takes them as an octal number — the famous 755 or 644. A chmod calculator turns the checkboxes you are thinking in into the number chmod wants, and back again.

There are three more bits above those nine. setuid and setgid make a program run as the file's owner or group rather than as whoever launched it; the sticky bit, on a directory, stops people deleting each other's files, which is the whole reason a shared /tmp is safe. Those three make the leading digit, so 1777 is /tmp and 4755 is a setuid binary.

This calculator does both directions. Tick the boxes and read off the number, or paste a mode — 755, 4755, rwxr-xr-x, or the whole permission field copied out of ls -l including its leading d — and the boxes move to match.

How to use it

  1. Tick the permissions you want. Nine boxes for the ordinary permissions and three for the special bits. The octal number and the ls rendering update as you go.
  2. Copy the command, not just the number. The command line is written out ready to paste, so there is nothing to reassemble.
  3. Or paste a mode you already have. Octal or symbolic, both work. This is the direction you want when you are reading an ls listing or a Dockerfile and trying to work out what it actually permits.

The capital letter that means the bit is doing nothing

Each special bit modifies one execute bit. setuid modifies the owner's, setgid the group's, and the sticky bit the one for everyone else. If you switch a special bit on while its execute bit is off, the bit is set and there is nothing for it to act on — and ls tells you so by printing a capital letter instead of a lowercase one. 4755 shows as rwsr-xr-x; 4644 shows as rwSr--r--, with a capital S.

This is not a rare corner. Of the 3,584 possible modes carrying at least one special bit, 2,368 — 66.1 per cent — render at least one capital. Per bit it is exactly half, because a special bit and the execute bit it modifies are set independently of each other. That figure is not an estimate: the whole space is only 4,096 modes, so every one was converted and checked rather than sampled.

Almost every chmod calculator prints a lowercase s or t regardless, which quietly turns a mistake into something that looks correct. This one shows the capital and says which bit is inert and why.

One caveat in the other direction, since it is the thing people get told wrongly: the sticky bit's meaning depends on what it is attached to. On a directory it restricts deletion, which is what you want. On a regular file, every system in current use ignores it.

Honest limits, and the umask question

A umask is not a permission, it is a mask of permissions to remove, and it can only ever subtract. That is why the same umask 022 gives a new file 644 and a new directory 755 — the difference is not the umask at all, it is that programs ask for 666 when creating a file and 777 when creating a directory, and the umask takes the same bits off each. The panel here shows both results so the asymmetry is visible rather than surprising.

What this page cannot tell you is whether a mode is safe on your system, because that depends on things the number does not contain: who owns the file, which groups exist, whether a parent directory lets anyone reach it at all, and whether SELinux or AppArmor has an opinion. A mode of 777 on a file inside a directory nobody can traverse is unreachable; 644 on a file in a world-writable directory can still be replaced.

It also does not model ACLs. If a file has extended access control lists, ls prints a trailing plus sign after the permission field and the nine bits are no longer the whole story. This calculator reads the nine bits and the three special bits, and nothing else — which is the honest scope for a mode calculator.

Finally, this is Unix semantics. Windows permissions are a different model entirely, and a number produced here has no meaning there.

Why is it free?

Because it costs nothing to run. The arithmetic happens in your browser; nothing is uploaded, no server is involved and there is no account.

The rendering is checked against the operating system's own rules rather than against another calculator: every one of the 4,096 possible modes is compared with the output of a POSIX-conformant implementation, and the test that does it is committed alongside the code.