Audited ·Last updated 28 Jul 2026·4 citations·Tier 2·0 uses

Chmod Calculator — Octal, Symbolic and ls -l

Convert Unix file permissions between tick boxes, octal (755, 2775), symbolic rwxr-xr-x and ls -l output, including setuid, setgid and the sticky bit.

Chmod Calculator

Work from
Three or four octal digits. A leading zero is optional, so 755, 0755 and 0000755 are the same thing. Only used when 'Work from' is set to octal.
Applies to
Set-user-ID on execution. The program runs as its owner, not as the user who launched it. This is why /usr/bin/passwd can edit /etc/shadow.
Set-group-ID. On a program it runs with the file's group; on a directory, new entries inherit the directory's group instead of the creator's.
POSIX defines this bit only for directories, where it means only a file's own owner (or the directory's owner) may delete or rename it. This is the bit that makes /tmp safe.
Octal mode
0755
The four-digit form: special bits, then owner, group and others. The leading digit is 0 unless setuid, setgid or the restricted deletion flag is set.
Symbolic mode
rwxr-xr-x
As ls -l shows it
-rwxr-xr-x
Command to set it
chmod 755 <file>
Mode word in decimal
493
Special-bit digit
0
Owner digit
7
Group digit
5
Others digit
5
Complementary umask
022
What this actually permits
As a regular file: the owner can read it, write to it and execute it; members of the group can read it and execute it; everyone else can read it and execute it.

Background.

Unix permissions are three sets of three bits plus three special bits, and almost every mistake people make with them comes from one of two places: forgetting that the octal digits are a sum rather than a code, or forgetting that the letters in an ls listing are not a straight rendering of those bits. This calculator handles both directions. Tick the boxes and it gives you the number to type; paste in a number and it tells you what it will do.

The octal side is the easy half. Each digit is read plus write plus execute, worth 4, 2 and 1 — so 7 is all three, 5 is read and execute, 6 is read and write, and 755 means the owner gets everything while group and others get read and execute. Those weights are not convention, they are the values POSIX assigns to the bits themselves: S_IRUSR is 0400, S_IWUSR is 0200, S_IXUSR is 0100, and so on down through the group and other triads. A fourth, leading digit carries the three special bits: 4000 for set-user-ID, 2000 for set-group-ID, 1000 for the restricted deletion flag most people call the sticky bit.

The symbolic side is where tools quietly disagree with reality. The execute column of each triad is overloaded: it shows the special bit when one is set, and its case tells you whether the underlying execute bit is on. POSIX spells this out for ls — a lower-case s in the owner triad means the file is executable and set-user-ID is set, while an upper-case S means set-user-ID is set and the file is not executable. The same distinction applies to t and T in the others triad. So 4755 renders as rwsr-xr-x but 4644 renders as rwSr--r--, and the capital letter is a warning sign: a setuid bit on a non-executable file does nothing at all. Plenty of chmod tools print lower case regardless. This one does not.

The special bits are also the ones worth understanding rather than copying. Set-user-ID on a program makes it run with its owner's privileges instead of the caller's, which is the entire reason a normal user can change their own password. Set-group-ID on a directory makes every new entry inherit the directory's group rather than the creator's, which is what makes a shared project directory actually shared. The restricted deletion flag on a world-writable directory stops one user deleting another's files, which is what makes /tmp workable. POSIX defines the last of those only for directories, so this page reports it honestly rather than inventing a meaning for it on files.

Finally, note the boundary of the mode word. It is twelve bits and nothing more. Access control lists, SELinux labels, Linux capabilities and filesystem attribute flags all live outside it and can grant or deny access regardless of what these bits say — if a chmod appears to have no effect, that is usually why. Everything on this page is sourced to IEEE Std 1003.1-2024, the current POSIX standard, and the specific pages are cited below.

What is chmod calculator?

A Unix file mode is a twelve-bit value attached to every file and directory. The low nine bits are three groups of three: read, write and execute for the owner, for members of the file's group, and for everyone else. The top three are special bits: set-user-ID on execution (04000), set-group-ID on execution (02000), and S_ISVTX (01000), which POSIX defines as the restricted deletion flag on directories. Because the bit values are powers of two within each triad — 4 for read, 2 for write, 1 for execute — each triad reads naturally as a single octal digit, and the whole mode reads as three or four octal digits. That is the number chmod takes. The same mode is displayed a second way in the first field of an ls -l line: an entry-type character followed by nine characters, in which a set bit shows its letter and a clear bit shows a dash, except that the execute position of each triad also encodes the corresponding special bit as s, S, t or T. On a directory the three permissions mean something different from a file: read allows listing the names inside, write allows creating and deleting entries, and execute allows traversing into it and reaching named entries. That difference is why a directory almost always needs the execute bit wherever it has the read bit, and why 644 on a directory is nearly useless.

How to use this calculator.

  1. Pick a direction. 'Tick boxes' builds a mode from permissions and gives you the number; 'octal number' decodes a number you already have. The half of the form you are not using is ignored, so you never have to clear it.
  2. Say whether the target is a file or a directory. It changes the ls entry-type character and, more importantly, changes what read, write and execute actually mean and what the special bits do.
  3. In tick-box mode, set the nine permission switches. Remember that on a directory you almost always want execute wherever you have read, because without execute the directory cannot be traversed.
  4. Set the special bits only if you mean them. setuid and setgid on a program are a privilege escalation surface; setgid on a directory is usually what you actually want for shared group work; the restricted deletion flag belongs on world-writable directories.
  5. In octal mode, type three or four digits. A leading zero is optional. If you paste something that is not octal — a symbolic string, or a digit 8 or 9 — the calculator will say so rather than guess.
  6. Read the symbolic output and check the letter case in the execute columns. An upper-case S or T means you have set a special bit on something that has no execute bit to go with it, which is almost always a mistake.

The formula.

mode = 4000·suid + 2000·sgid + 1000·svtx + 400·r + 200·w + 100·x + 40·r + 20·w + 10·x + 4·r + 2·w + 1·x

Every permission is one bit, and POSIX assigns each bit an octal value in <sys/stat.h>. For the owner: S_IRUSR is 0400, S_IWUSR is 0200, S_IXUSR is 0100. For the group: 040, 020, 010. For everyone else: 04, 02, 01. Add together the bits you want and you have the mode. Because the three values in each triad are 4, 2 and 1, their sum can never carry into the next triad, so each triad is exactly one octal digit and the whole thing reads off cleanly as 755 or 640 or 600.

The special bits sit above them: 04000 for set-user-ID, 02000 for set-group-ID, 01000 for S_ISVTX. They form the fourth digit, which is why chmod 2775 and chmod 0775 differ in exactly one bit. chmod's own specification describes the octal operand as setting the corresponding permission bit for each bit set in the number and clearing everything else — which is the reason chmod 755 is an assignment, not an addition, and why it can silently remove a special bit you had set. Use the symbolic form (chmod g+s) when you want to add without disturbing the rest.

Rendering the symbolic string is where the subtlety lives. The first two characters of each triad are simply r or w or a dash. The third is the execute column, and it carries two pieces of information at once. If no special bit applies it is x or a dash. If the corresponding special bit is set, it becomes a letter instead — s for the owner and group triads, t for the others triad — and the case of that letter reports the execute bit: lower case when execute is also set, upper case when it is not. POSIX's ls specification gives both cases explicitly. So 4755 is rwsr-xr-x, 4644 is rwSr--r--, 1777 is rwxrwxrwt and 1666 is rw-rw-rwT.

Decimal conversion is the same number in another base: 0755 is 7×64 + 5×8 + 5 = 493, and 02775 is 2×512 + 7×64 + 7×8 + 5 = 1533. That is the value a program sees in st_mode once the file-type bits above the mode word are masked away, and it is what you would pass to a chmod() system call written in C or to os.chmod in Python — which is exactly why a Python script that writes os.chmod(path, 755) sets a mode of 0o1363 rather than rwxr-xr-x.

The complementary umask is the bitwise inverse of the low nine bits, because a umask names the bits to remove rather than the bits to keep — POSIX describes the octal form of umask as setting the specified bits in the file mode creation mask. Complementing 755 gives 022, and complementing 700 gives 077. One caveat worth knowing: a umask can only take permissions away from the base mode the operating system starts with, which is 0777 for directories and 0666 for regular files. That is why no umask can make a newly created file executable, and why 022 produces 755 directories but 644 files.

A worked example.

Example

chmod 2775 on a shared project directory — the mode that makes group collaboration actually work. Split the digits: special 2, owner 7, group 7, others 5. The special digit 2 is S_ISGID at 02000, so set-group-ID is on and the other two special bits are off. Owner 7 is 4+2+1, all three permissions. Group 7 is also 4+2+1. Others 5 is 4+1, read and execute but not write. Rendering that symbolically gives rwx for the owner; for the group, r and w followed by an execute column that must show the set-group-ID bit — and since group execute is also set, POSIX says it prints as a lower-case s, giving rws; and r-x for others. The result is rwxrwsr-x, which ls -l shows as drwxrwsr-x because the entry is a directory. In decimal the mode word is 2×512 + 7×64 + 7×8 + 5 = 1533. The complementary umask is the inverse of the nine permission bits 775, which is 002. What it does in practice: anyone in the group can create, edit and delete files in the directory, and because set-group-ID is on, every file created inside inherits the directory's group rather than the creator's primary group — so a second group member can actually write to it without anyone running chgrp by hand. Compare it with 0775, which differs by exactly one bit: same access on the day you set it, and a directory that quietly stops being shared as soon as two people with different primary groups start using it.

octal Code2775
input Modeoctal
file Typedirectory

Frequently asked questions.

What does chmod 755 mean?
Owner gets read, write and execute; group and others get read and execute. The digits are sums of 4 for read, 2 for write and 1 for execute, so 7 is 4+2+1 and 5 is 4+1. Symbolically it is rwxr-xr-x, and ls -l shows it as -rwxr-xr-x on a file or drwxr-xr-x on a directory. In decimal the mode word is 493. It is the standard mode for an executable script or program and for a directory that everyone should be able to read and traverse but only the owner should modify. For a non-executable file the equivalent is 644.
What is the difference between 755 and 0755?
Nothing, for chmod. The leading zero is the special-bit digit, and zero means no setuid, no setgid and no restricted deletion flag. Writing it explicitly is a habit worth having because it makes clear that you are assigning all four digits: chmod is an assignment, so chmod 755 on a file that currently has setuid set will clear that bit. In C, Python and most other languages the leading zero (or 0o prefix) matters for a different reason — it tells the compiler the literal is octal. Passing decimal 755 to os.chmod sets mode 0o1363, which is almost certainly not what you wanted.
Why does my listing show a capital S or T instead of s or t?
Because the special bit is set but the matching execute bit is not. POSIX defines the ls output precisely: a lower-case s in the owner triad means the file is executable and set-user-ID is set, while an upper-case S means set-user-ID is set and the file is not executable. The same holds for t and T in the others triad with the restricted deletion flag. A capital letter is almost always a bug in whatever set the mode — a setuid bit on a file nothing can execute has no effect, and it can trip security scanners. 4644 shows as rwSr--r--; add owner execute to make it 4744 and it becomes rwsr--r--.
What does the sticky bit actually do?
On a directory, it restricts deletion: a file inside can only be removed or renamed by its own owner, by the directory's owner, or by a privileged process. That is what makes a world-writable directory such as /tmp safe to share — mode 1777 lets everybody create files there, but nobody can delete anybody else's. POSIX names the bit S_ISVTX and defines it only for directories. Its original meaning on executables — keep the text image in swap after exit, hence 'sticky' — is a historical curiosity that modern kernels ignore, so this calculator does not claim any behaviour for it on regular files.
When should I use setgid on a directory?
Whenever more than one person needs to write into the same tree. Normally a new file gets the creating user's primary group, so if two members of a shared group create files there, each one's files belong to a different group and the other person cannot write to them. Set-group-ID on the directory makes every new entry inherit the directory's group instead, and on Linux new subdirectories inherit the setgid bit too, so the property propagates. The usual mode is 2775 for a group-writable tree, or 2770 to keep everyone outside the group out entirely. Pair it with a umask of 002 so that the group-write bit survives file creation.
How do I get from a permission set to a umask?
Complement the nine permission bits: subtract each octal digit from 7. Permissions 755 give umask 022; 750 gives 027; 700 gives 077. The reason for the inversion is that a umask names the bits to remove — POSIX describes the octal form as setting the specified bits in the file mode creation mask. One limitation is worth knowing: a umask only ever subtracts from the base mode the system starts with, which is 0777 for directories and 0666 for regular files. So a umask of 022 produces 755 directories but 644 files, and no umask can make a newly created file executable.
Why can't anyone enter my directory even though it is readable?
Because on a directory the execute bit is not 'execute', it is 'search'. Read permission lets you list the names in a directory; execute permission lets you traverse it and reach anything named inside. A directory with mode 644 can have its names listed but cannot be entered, so every path through it fails — and a directory with 111 can be traversed by anyone who already knows the exact name, but not listed. This is why directory modes are almost always 755, 750 or 700 rather than 644 or 640, and it is the single most common permission mistake when a mode is copied from a file to a directory.
I ran chmod and it made no difference — what else could be blocking me?
The mode word is only twelve bits, and several other mechanisms sit on top of it. A POSIX access control list can grant or deny access independently, and its presence is usually flagged by a plus sign at the end of the ls permission field. SELinux or AppArmor policy can deny an operation the mode permits. Filesystem attribute flags such as the Linux immutable bit stop even root from writing. The mount options can be read-only or can suppress setuid entirely with nosuid. And on a network filesystem the server's own mapping may override everything. None of those appear in the number this calculator produces, which is exactly why it says so rather than pretending the mode is the whole story.

References& sources.

  1. [1]The Open Group / IEEE. IEEE Std 1003.1-2024, Base Specifications Issue 8 — <sys/stat.h>. Source of every bit value used on this page: S_ISUID 04000 'Set-user-ID on execution', S_ISGID 02000 'Set-group-ID on execution', S_ISVTX 01000 'On directories, restricted deletion flag', S_IRUSR 0400, S_IWUSR 0200, S_IXUSR 0100, S_IRGRP 040, S_IWGRP 020, S_IXGRP 010, S_IROTH 04, S_IWOTH 02, S_IXOTH 01.
  2. [2]The Open Group / IEEE. IEEE Std 1003.1-2024 — chmod utility. Source of the octal-operand rule quoted on this page: 'For each bit set in the octal number, the corresponding file permission bit shown in the following table shall be set; all other file permission bits shall be cleared', together with the symbolic-mode definitions of the who symbols u, g, o and a and the perm symbols r, w, x, s and t.
  3. [3]The Open Group / IEEE. IEEE Std 1003.1-2024 — ls utility. Source of the symbolic rendering rules, including the entry-type character ('d Directory ... - Regular file') and the special-bit substitutions: 'S If in <owner permissions>, the file is not executable and set-user-ID mode is set. s If in <owner permissions>, the file is executable and set-user-ID mode is set', and the equivalent T and t rules for the restricted deletion flag in the other-permissions field.
  4. [4]The Open Group / IEEE. IEEE Std 1003.1-2024 — umask utility. Source of the complementary-umask output: 'In the octal integer form of mode, the specified bits are set in the file mode creation mask', i.e. the bits named in a umask are the bits cleared from newly created files.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 590 calculators remain free
  • No billing is enabled
Coming soon