Chmod Calculator: Convert and Explain Unix Permissions
Tick read, write, and execute boxes, type an octal mode such as 755 or 4755, or paste an ls -l string such as drwxrwxrwt. Every view stays in sync, with setuid, setgid, and sticky bits included. Apply a chmod expression like u+x,g-w,o=r one step at a time, see what a umask gives new files and directories, and copy the matching commands. Expressions follow GNU chmod rules. Everything runs in your browser, and no files are read or changed.
Mode
3 or 4 digits from 0 to 7, such as 644, 0755, 0o2775, or 4755.
rwxr-xr-x, or with a type character: - d l c b p s. A pasted ls -l line works too.
Common presets
Result
ls -l
octal
type
Security checks
Who can do what
Commands
Used in the commands. Paths with spaces or shell characters are single-quoted. Leave empty to use file or dir.
Apply a chmod expression
who (u g o a), then an operator (+ - =), then r w x X s t or one copy letter (u g o). Separate clauses with commas. Without a who letter, umask bits are skipped.
Examples
umask calculator
Such as 022, 0027, or 077. It is also the umask used for expression clauses with no who letter.
- New files (666 & ~umask)
- New directories (777 & ~umask)
- umask -S (what stays allowed)
- Bits removed
How it works and limits
- A mode has 12 bits. Read is 4, write is 2, and execute is 1, for each of owner, group, and other. Setuid adds 4000, setgid 2000, and sticky 1000. In ls -l a special bit takes the execute slot: lowercase s or t when execute is also set, and capital S or T when it is not.
- Expressions use the GNU coreutils chmod algorithm, which was checked against GNU chmod 9.4. o owns the sticky bit, so u+t does nothing and o+s does nothing. A clause with no who letter acts like a, but skips bits that are set in the umask. Each copy clause takes one letter, so o=g works and o=gx is rejected, as in GNU.
- X is checked against the mode as it is at that point in the expression, the way GNU does it. POSIX says to check the original mode. Results differ only when an earlier clause in the same expression changed execute bits.
- On directories, GNU chmod keeps existing setuid and setgid bits unless a clause names s, or a numeric mode has 5 or more digits (00755). BSD and macOS chmod do not have this rule.
- The kernel can still change the result: it may clear setgid when you are not in the file's group, and writing to a file clears its setuid and setgid bits. ACLs (the + after a mode), SELinux, mount options such as nosuid and noexec, and file ownership are not modelled.
- The umask defaults assume a program asks for 666 for files and 777 for directories, which most do. Compilers and some programs ask for other modes.
- Nothing leaves this page. The tool does not read or change any file, and nothing is stored.