chmod Calculator
chmod Calculator
Calculate Unix file permissions instantly — switch between octal (755), symbolic (-rwxr-xr-x) and a visual checkbox grid. Includes special bits (setuid, setgid, sticky).
chmod Calculator Tool
Advanced — setuid, setgid, sticky bit
setuid runs the executable as the file owner. setgid runs it with the file's group; on a Linux directory, new files inherit the directory's group. sticky on a directory means only a file's owner (or the directory's owner) can delete or rename it (used on /tmp).
Apply a chmod operand
Type what you would give chmod, for example u+x, go-w, a=rX or g=u, and it is applied to the mode above. With no u, g, o or a, the bits in your umask are left alone, as POSIX requires. Where POSIX leaves a case to the implementation, the result is what GNU chmod (Linux) does.
How to use the chmod calculator
Click the permission checkboxes
Tick read, write or execute for owner, group and public independently. The octal and symbolic fields update live.
Or type a value directly
Type an octal mode (e.g. 755) or paste the mode column from ls -l (e.g. drwxr-xr-x.; a trailing ., + or @ is accepted and set aside). A character that cannot appear in its position is named rather than ignored. Set Type to Directory when it is one: it changes the first letter and how X and the setgid bit behave.
Try a preset
The preset pills (644, 755, 600, 1777, …) load common values instantly. Hover for what each is typically used for.
Try a symbolic change, then copy
To see what chmod g+w,o-rwx or a=rX would do to the mode, type it under Apply a chmod operand; the grid moves to the result and the line under it shows before and after. Then use the Copy buttons for the octal, the ls form or the full chmod command.
Understanding Unix file permissions
Every file and directory on a Unix-like system — Linux, macOS, FreeBSD, the BSD-based router and NAS firmware that runs much of the internet — carries a small piece of metadata describing who is allowed to read it, modify it and (for executables) run it. That metadata is the permission mode, and the chmod command (CHange MODe) is how administrators and developers set it. The calculator above is a visual front-end for the same arithmetic that chmod performs.
Three classes, three bits
Unix permissions split the world into three classes: the file's owner (a specific user), the file's group (a specific group of users), and everyone else. For each class, the permission mode records three bits: read (4), write (2) and execute (1). Adding the bits per class gives a digit from 0 (no permissions) to 7 (read + write + execute). The mode is conventionally written as three octal digits — one per class — so 755 means owner has 7 (rwx), group has 5 (r-x) and public has 5 (r-x).
The symbolic form (rwxr-xr-x) writes the same information differently. A dash replaces a missing permission; the order is always read, write, execute for each class. The leading character indicates file type — usually - for a regular file, d for a directory, l for a symbolic link. So the symbolic form -rwxr-xr-x describes a regular file with mode 755.
The fourth digit and the special bits
Fewer developers know that chmod accepts a fourth, leading octal digit for the special bits. Setuid (4) makes an executable run with the owner's user-ID instead of the caller's — this is how sudo and passwd can do privileged work. Setgid (2) does the same for group; on directories it causes newly-created files to inherit the directory's group rather than the creator's primary group. The sticky bit (1) on a directory restricts deletion to the file's owner — Linux's /tmp uses mode 1777 so every user can write but no user can delete another user's files. Special bits combine with the regular bits using the same additive scheme.
The modes worth knowing, and where the rules come from
The presets above are the conventions, not laws: regular files usually want 644 (owner read+write, everyone else read-only) and directories 755 (owner read+write+search, everyone else read+search) because a umask of 022 produces exactly those from a fresh file. One case is enforced by software rather than convention: an SSH private key. ssh(1) says the identity files "contain sensitive data and should be readable by the user but not accessible by others (read/write/execute). ssh will simply ignore a private key file if it is accessible by others" — so 600 and 400 work and 640 fails as surely as 644. World-writable files (666, 777) mean any account on the host can replace the content; outside a sticky /tmp-style directory there is rarely a reason to want that.
Two things this calculator shows that are easy to misread. The ls form begins with -, the regular-file marker, or d when Type is set to Directory; ls -l also prints l for a symbolic link in that slot. And the special bits borrow the execute columns: POSIX ls(1) prints s where setuid or setgid is set on an executable and S where the bit is set but the execute bit is not; t and T do the same for the restricted-deletion (sticky) flag in the "other" column. The upper-case forms are almost always a mistake, and the grid makes the mismatch visible.
What chmod doesn't do
Permission modes are a coarse-grained access control — three classes, three bits. They do not handle "give Alice read access but not Bob" without elaborate group-juggling. For fine-grained control, modern Linux supports access control lists (ACLs) via setfacl and getfacl, which this calculator cannot model; the + that ls -l prints after the mode is the sign that one is present. The mode also does not encrypt anything — it controls who can ask the kernel for a file, not what they can do once they have a copy. And it does not always survive a copy: OpenBSD's scp(1) carries the source's mode bits only with -p, and filesystems such as FAT and exFAT store no Unix mode at all. When in doubt, run ls -la on the destination side and confirm.
The octal is binary, and OpenSSH will refuse you at 601
The octal digits aren't arbitrary: they map directly to binary. 755 in binary is 111 101 101 — one bit per permission per class.
ssh(1) is explicit: it "will simply ignore a private key file if it is accessible by others". Any group or other bit trips it — 640 fails exactly as 644 does — so 600 (or 400) is the whole answer.
The sticky bit's name is older than its meaning. Seventh Edition Unix chmod(2) listed 01000 as "save text image after execution"; POSIX.1-2024 defines S_ISVTX only as the directories' restricted deletion flag.
POSIX chmod(1) leaves it implementation-defined whether clearing every execute bit also clears setuid and setgid, and whether u+s on a file with no execute bit is ignored. Where the bit is set without execute, ls prints an upper-case S, and so does the grid.
The execute bit on a directory is a permission to enter the directory (cd into it, traverse it), not to "execute" files inside. Read alone gives you the file list; execute gives you traversal.
The umask is subtracted from a new file's requested mode: 022 turns a requested 666 into 644 and 777 into 755 — the two most common presets above. It also governs symbolic chmod: POSIX says chmod +x with no who sets execute for every class except the bits in your umask.
Whose group does a new file get? Linux open(2) documents two answers: System V semantics (the creator's group) by default, BSD semantics (the directory's group) when the directory has setgid set — the reason 2775 is the classic shared-project directory.
GNU chmod keeps a directory's setuid and setgid bits through chmod 755 dir, so a shared 2775 directory stays shared. To clear them it takes g-s, =755 or the five-digit 00755 (GNU Coreutils manual §27.5).
The twelve bits have not moved since Seventh Edition Unix (1979): its chmod(2) page lists 04000, 02000, 01000, 00400 … exactly the values POSIX.1-2024 still assigns to S_ISUID, S_ISGID, S_ISVTX and S_IRUSR.
Frequently asked questions
chmod 600 ~/.ssh/id_ed25519 (or whatever the key file is named) and try again; 400 works too.chmod +x script.sh sets it for owner, group and public except any class masked by your umask (POSIX chmod(1): with no who, the bits in the file-mode-creation mask are left alone) — under the usual 022 that is all three. For owner-only execution use chmod u+x script.sh. Type either into Apply a chmod operand above, with your umask, to see the mode it produces.chmod 755 file) sets the mode absolutely. Symbolic (chmod u+rwx,g+rx,o+rx file) adds/removes individual bits. Symbolic is safer when you only want to flip one bit.find ... -exec chmod ... \; with type filters instead.chmod +w, leaves alone the bits your umask masks (POSIX chmod(1)): under 022, +w adds write for the owner only. An octal chmod, or one that names u, g, o or a, ignores the umask.2775 on a shared directory changes behaviour on Linux and is redundant on macOS.Method & sources
How it computes
Mode = setuid 4000 + setgid 2000 + sticky 1000 + rwx per class (POSIX.1-2024 <sys/stat.h>). The ls form follows POSIX ls(1) (s/S, t/T). Symbolic operands (u+x, go=u-w, a=rX) follow the POSIX chmod grammar: no who = all classes less the umask; X only on directories or files already executable. Where POSIX is implementation-defined, GNU chmod (gnulib mode_adjust) is followed and named.
What this tool implements
- POSIX.1-2024 <sys/stat.h>: S_ISUID 04000, S_ISGID 02000, S_ISVTX 01000 ("On directories, restricted deletion flag"); the same twelve values as Seventh Edition Unix chmod(2) (1979).
- POSIX.1-2024 chmod(1) EXTENDED DESCRIPTION and grammar: who u g o a; op + - =; perm r w x X s t or permcopy u g o. With no who, bits in the file mode creation mask are left alone. X applies only to a directory or a file with an execute bit already set. o with s changes nothing. Clearing every execute bit, and u+s with no execute bit, are implementation-defined.
- Implementation-defined cases follow GNU coreutils (gnulib lib/modechange.c mode_compile and mode_adjust), and the page says so: = with a who clears that class's special bit; on a directory, setuid and setgid survive "chmod 755" and are cleared by g-s, =755 or 00755 (GNU Coreutils manual §27.5).
- Checked 2026-11-05 against a real chmod: 612 operands run through the macOS /bin/chmod (BSD setmode) on files and directories under umasks 022, 077 and 002. 588 agree with the calculator and are pinned as a test fixture; the 24 that differ are GNU-versus-BSD choices (BSD keeps setuid/setgid through u=g and go=u, and ignores -X), pinned separately with the gnulib source.
- POSIX ls(1): s / S in the owner or group execute position (set, with or without execute), t / T in the other position for the restricted deletion flag. The ls box now refuses a character that cannot appear in its position, and accepts the trailing "." "+" "@" ls prints for SELinux, ACLs and macOS extended attributes.
- Corrected 2026-11-05: any letter accepted in any ls position; trailing ls markers refused; octal limited to 3-4 digits; fact 04 said POSIX requires clearing all execute bits to clear setuid/setgid (it is implementation-defined); the SSH FAQ said "more permissive than 600" (ssh(1): any access by others; 700 is accepted); a Docker bind mount was said to reset modes.
Sources
- The Open Group / IEEE. POSIX.1-2024 (IEEE Std 1003.1-2024), chmod utility: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/chmod.…
- POSIX.1-2024 <sys/stat.h>: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_sta… ; ls utility: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/ls.html ; XBD 4.5 Directory Protection: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap…
- GNU. gnulib lib/modechange.c (mode_compile, mode_adjust), as run by GNU coreutils chmod: https://raw.githubusercontent.com/coreutils/gnulib/master/lib/mod… ; GNU Coreutils manual §27.5: https://www.gnu.org/software/coreutils/manual/html_node/Directory…
- OpenBSD. ssh(1) FILES, private keys: https://man.openbsd.org/ssh.1 ; scp(1) -p: https://man.openbsd.org/scp.1
- Linux man-pages. open(2), System V and BSD group semantics: https://man7.org/linux/man-pages/man2/open.2.html ; FreeBSD open(2): https://man.freebsd.org/cgi/man.cgi?query=open&sektion=2
- Bell Labs. Unix Seventh Edition chmod(2), 1979: https://man.cat-v.org/unix_7th/2/chmod
What can make this go out of date
- None at runtime: everything is computed in the browser and nothing typed is sent anywhere.