Every file and directory on Linux, macOS and other Unix-like systems carries a permission mode: who may read it, write it and execute it. The same mode can be written in two ways. The octal form is a short number such as 755 or 644, used with the chmod command. The symbolic form, such as rwxr-xr-x, is what ls -l prints. Translating between them in your head is easy once you know the trick, but a typo can lock you out of a server or leave a private key readable by everyone.
This chmod calculator converts in every direction. Pick permissions from the menus, type an octal mode, or paste the symbolic column from ls -l, and it returns the octal code, the symbolic string, the ready-to-copy chmod command in numeric and symbolic syntax, the bits in binary and a plain-language explanation of who can do what.
It also handles the three special bits that often confuse people: setuid (4000), setgid (2000) and the sticky bit (1000), including the capital S and T that ls shows when a special bit is set without the execute permission underneath it.
How to use this calculator
- Choose how you want to enter the permissions: Choices (menus for owner, group and others plus the special bits), Octal (for example 0644) or Symbolic (for example rw-r--r--).
- In Choices mode, pick the access for each class; each option shows its digit, its letters and its meaning.
- Optionally type the file or directory name so the command line is ready to paste.
- Read the four-digit octal mode, the symbolic string, the two equivalent chmod commands and the explanation. The table breaks the mode down class by class, and warnings flag risky modes such as world-writable files.
The formula
Each class (owner u, group g, others o) gets one octal digit, the sum of its permission bits:
The full mode places the special digit in front:
where is setuid, setgid and the sticky bit. Because each digit holds exactly three bits, an octal digit maps one-to-one to a group of three letters: 7 = rwx, 6 = rw-, 5 = r-x, 4 = r--, 0 = ---. In the symbolic form the special bits replace the execute letter of a class: s (or S if execute is off) for setuid and setgid, t (or T) for sticky. These values are defined by the POSIX standard and used identically by GNU coreutils, BSD and macOS.
Worked example
chmod 755. Owner: 4 + 2 + 1 = 7 (rwx). Group: 4 + 1 = 5 (r-x). Others: 4 + 1 = 5 (r-x). The mode is rwxr-xr-x, 111 101 101 in binary (decimal 493), and the symbolic command is chmod u=rwx,g=rx,o=rx file. This is the usual mode for scripts, programs and web directories.
More common modes:
| Octal | Symbolic | Typical use |
|---|---|---|
| 644 | rw-r--r-- | ordinary files, web pages |
| 600 | rw------- | private keys, password files |
| 640 | rw-r----- | configuration readable by a service group |
| 4755 | rwsr-xr-x | setuid program such as passwd |
| 2775 | rwxrwsr-x | shared team directory (setgid) |
| 1777 | rwxrwxrwt | /tmp: everyone writes, sticky bit |
Going the other way, the listing rw-r----- converts to 640. And rwxrwxrwT (capital T) means the sticky bit is set while others have no execute permission.
Setuid, setgid and the sticky bit
- Setuid (4000) on an executable makes it run with the rights of the file’s owner rather than the user who launched it. That is how
passwdcan update a file only root may write. On directories it is ignored by most systems. - Setgid (2000) on an executable runs it with the file’s group. On a directory it is far more common: new files created inside inherit the directory’s group instead of the creator’s primary group, which keeps shared project folders consistent.
- Sticky bit (1000) on a directory lets anyone with write access create files but only lets each file’s owner (or the directory owner, or root) delete or rename them. /tmp uses 1777 for this reason.
A capital S or T in ls -l output means the special bit is set but the matching execute bit is not, which is usually a mistake on files.
Numeric versus symbolic chmod
The numeric form sets every bit at once: chmod 640 file replaces whatever was there. The symbolic form can also make relative changes: chmod g+w file adds group write and leaves everything else alone, chmod o-rwx file removes all access for others, and chmod a+x script.sh makes a script executable for everyone. The command the calculator shows uses absolute assignments (=), so both of its commands produce exactly the same mode.
On GNU systems, a numeric mode of three digits does not clear the setuid and setgid bits on a directory; write chmod g-s dir or a five-digit mode starting with 0 (such as 00755) when you really want them gone.
Frequently asked questions
What does chmod 755 mean?
The owner can read, write and execute (7); the group and everyone else can read and execute but not modify (5 and 5). In symbolic form it is rwxr-xr-x. It is the standard mode for programs, scripts and directories that others need to enter.
What is the difference between 644 and 755?
Only the execute bits. 644 (rw-r--r--) suits ordinary files that should not be run. 755 adds execute for all three classes, which programs need to run and directories need so users can open them.
Why should I avoid chmod 777?
777 lets every user on the machine modify or replace the file, which a compromised web process or another account can exploit. Grant write access to the owner or a specific group instead; if a directory really must be shared by everyone, add the sticky bit (1777).
What does a capital S or T mean in ls -l?
The setuid/setgid (S) or sticky (T) bit is set while the execute permission in that position is off. A lowercase s or t means both are on. For example rwSr--r-- is octal 4644.
How do permissions apply to directories?
Read lets you list the names in the directory, write lets you create, delete and rename entries, and execute lets you enter the directory and reach the files inside. A directory usually needs execute wherever it has read, which is why directories are typically 755 or 750.
Sources
- The Open Group, POSIX.1-2017 (IEEE Std 1003.1): chmod — change the file modes
- GNU Coreutils manual: File permissions
- GNU Coreutils manual: Numeric modes
Last updated: