Skip to main content

Chmod Calculator

Convert between octal modes, symbolic form, and a ready-to-paste chmod command.

Written by Golam Rabbani, Founder & Lead Engineer

Input mode

3 digits (e.g. 644) or 4 digits with special bits (e.g. 4755).

How to use this chmod calculator

  1. Choose your input mode: type an octal like 755, or tick the read/write/execute boxes per class.
  2. Optionally enable the special bits: setuid, setgid, sticky.
  3. Press Calculate to see the canonical octal, ls -l symbolic form, and the ready-to-paste chmod command.
  4. Click Copy chmod command and paste it into your terminal, replacing <file> with your actual path.

About this chmod calculator

The chmod calculator converts between the two ways Unix expresses file permissions: octal digits (e.g. 644, 755, 4755) and the symbolic "ls -l" string (e.g. rw-r--r--, rwxr-xr-x, rwsr-xr-x). Each of the three permission classes — owner, group, others — gets one octal digit built from read = 4, write = 2, execute = 1, summed in that class. A fourth leading digit, present only when needed, carries the special bits: setuid = 4, setgid = 2, sticky = 1. The tool does the bit arithmetic for you and emits the chmod command verbatim.

For example, 755 decodes as owner = read + write + execute (4+2+1 = 7), group = read + execute (4+1 = 5), others = read + execute (5) — symbolic form "rwxr-xr-x", which is the standard mode for a regular executable. Toggling the setuid bit on a 755 file gives 4755 / "rwsr-xr-x", meaning the program runs with the file owner's privileges (used for tools like /usr/bin/passwd). The chmod sticky bit on a directory (e.g. 1777 / "rwxrwxrwt" on /tmp) restricts deletion of files inside it to each file's owner. Everything is computed locally — no terminal required.

FAQ

What is the difference between octal 755 and 0755?
They mean the same thing. Three-digit chmod modes omit the leading "0" for special bits; "0755" or "755" both grant rwx to the owner and r-x to group and others, with no special bits set.
When should I use 644 vs 755?
644 (rw-r--r--) is the conventional mode for regular files: readable by everyone, writable only by the owner. 755 (rwxr-xr-x) is the conventional mode for executables and directories: same as 644 plus execute (or directory-entry traversal).
What do setuid, setgid, and sticky do?
Setuid on an executable makes it run as the file's owner regardless of who invokes it. Setgid on a file does the same for the group; on a directory it forces new files inside to inherit the directory's group. The sticky bit on a directory means only the file's owner (or root) can delete files inside it — useful for /tmp.
Why does -rw-r--r-- start with a dash in `ls -l`?
That leading character is the file type, not a permission: "-" = regular file, "d" = directory, "l" = symlink, "c"/"b" = char/block device. The remaining nine characters are the permission triples this tool shows.
Is 777 ever a good idea?
Almost never. 777 ("rwxrwxrwx") lets any user on the system modify or execute the file. Use the principle of least privilege: grant only the bits each class actually needs.