chmod Calculator

Share:
Developer Tools

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).

By Checked against sources by Last reviewed DEVELOPER PERMISSIONS UNIX
Your browser is too old for this tool’s interactive features. Please update to Safari 13.1, Chrome or Edge 80, Firefox 74 or newer.

chmod Calculator Tool

Owner
Group
Public
Read (4)
Write (2)
Execute (1)
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.

Octal 644
ls -l -rw-r--r--
Command chmod 644 file
Explainer Owner: read, write · Group: read only · Others: read only
    📅 Research current as of 05 Nov 2026 · Sources: POSIX.1-2024 (IEEE Std 1003.1-2024) — <sys/stat.h> mode bits S_ISUID 04000, S_ISGID 02000, S_ISVTX 01000; chmod(1) octal and symbolic modes; ls(1) s/S/t/T. GNU coreutils chmod (gnulib modechange.c) where POSIX is implementation-defined. ssh(1) on private-key permissions; open(2) on BSD vs System V group inheritance
    Standards, published formulas, and reference data are revised over time — check against a current authoritative source before relying on these figures.
    Advertisement
    After results · AD-W1 Responsive · Post-tool — peak engagement

    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.

    Advertisement
    After how-to · AD-W2 Responsive

    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

    01

    The octal digits aren't arbitrary: they map directly to binary. 755 in binary is 111 101 101 — one bit per permission per class.

    02

    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.

    03

    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.

    04

    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.

    05

    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.

    06

    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.

    07

    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.

    08

    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).

    09

    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

    It means the owner has read, write and execute; group and public have read and execute only. Conventionally used for scripts and directories that everyone should be able to enter and read but only the owner can modify.
    Almost never on a production server. 777 means anyone — including a compromised low-privilege account — can read, modify or replace the file. The exceptions are write-by-anyone directories like /tmp, which should additionally have the sticky bit (mode 1777).
    ssh(1) says a private key file "should be readable by the user but not accessible by others" and that ssh "will simply ignore a private key file if it is accessible by others". Any group or other bit counts, so 640 fails just as 644 does. Run chmod 600 ~/.ssh/id_ed25519 (or whatever the key file is named) and try again; 400 works too.
    chmod changes the permission mode (who can do what); chown changes the owner and group (which users the permissions apply to). They are complementary; you usually set the owner first, then the mode.
    Add the execute bit. 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.
    They're the same operation expressed differently. Octal (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.
    Almost never. Recursive chmod replaces the permissions of every file and directory inside — including binaries, config files and SSH keys — with the same mode. You will usually break the system. Use find ... -exec chmod ... \; with type filters instead.
    Yes, in two ways. umask sets the permissions stripped from newly created files, so with 022 a program asking for 666 gets 644 and one asking for 777 gets 755. And a symbolic chmod with no u, g, o or a, such as 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.
    Only on directories, where POSIX calls it the restricted deletion flag: in a writable directory with it set, a file can be removed or renamed only by the file's owner, the directory's owner or a privileged process (POSIX.1-2024, XBD 4.5). On a file other than a directory its effect is unspecified. The /tmp directory on Linux is the textbook example (mode 1777).
    The numeric and symbolic syntax is identical and the twelve bits mean the same thing, so the string this calculator produces is valid on both. The difference is what a new file's group is: the BSD family, including macOS, gives it the directory's group (FreeBSD open(2): "it is assigned the group of the directory"), while Linux open(2) uses the creator's group unless the directory carries the setgid bit, in which case BSD semantics apply. So 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

    What can make this go out of date

    • None at runtime: everything is computed in the browser and nothing typed is sent anywhere.
    Advertisement
    Pre-footer · AD-W3 728 × 90