Skip to content
PC Moment

Free tool

Chmod Calculator

Tick the permissions you want and get the octal mode, the symbolic rwxr-xr-x form and a ready-to-copy chmod command, including setuid, setgid and sticky bits.

WhoRead (4)Write (2)Execute (1)
Owner
Group
Others
Special bits
Presets:
Symbolic
–
Command
–
Command
–

On Linux, macOS and other Unix-like systems, every file and directory has permission bits that say who can read, write and execute it. chmod sets them, either with an octal number such as 755 or with letters such as u=rwx,g=rx,o=rx. This calculator converts between the checkboxes, the octal mode and the symbolic form, and writes the command for you.

How to use the chmod calculator

  1. Tick read, write and execute for the owner, the group and others.
  2. Tick setuid, setgid or sticky under Special bits if you need them.
  3. Or type a 3- or 4-digit octal mode, such as 644 or 4755, in the octal field. The checkboxes update to match, and ticking a box updates the octal field.
  4. Read the symbolic form, such as rwxr-xr-x, the way ls -l shows it.
  5. Copy one of the ready-made commands: the numeric chmod 755 file or the symbolic chmod u=rwx,g=rx,o=rx file.
  6. For a common setting, select a preset: 644, 755, 600, 700 or 777. Choosing 777 shows a warning, because it makes the file writable by everyone.

How it works

The permission bits

The GNU Coreutils manual describes three kinds of permission for three categories of users:

PermissionOn a fileOn a directory
Read (r)Read the fileList the directory’s contents
Write (w)Change the fileCreate and remove files in it
Execute (x)Run it as a programAccess files in it

The categories are the file’s owner (u), other users in the file’s group (g) and everyone else (o).

From checkboxes to octal

Each category is one octal digit, the sum of read = 4, write = 2 and execute = 1. The three digits are written owner, group, others:

DigitPermissionsSymbolic
7read + write + executerwx
6read + writerw-
5read + executer-x
4read onlyr—
0nothing---

An optional fourth digit at the front holds the special bits: 4 = set-user-ID, 2 = set-group-ID, 1 = sticky bit (the restricted deletion flag). GNU chmod reads numeric modes as octal and fills in missing leading digits with zeros, so 55 means 0055.

The special bits

  • Set-user-ID (setuid): a program runs with the user ID of the file’s owner rather than the user who started it.
  • Set-group-ID (setgid): a program runs with the file’s group. On a directory, most systems give new files the directory’s group.
  • Sticky bit: on a directory, users can’t delete or rename other users’ files unless they own the file or the directory. It’s typically set on world-writable directories such as /tmp.

The symbolic form

The string the calculator shows is the permission part of ls -l output, which POSIX defines. When a special bit is set, it takes the place of the execute character:

CharacterPositionMeaning
sowner or groupsetuid or setgid set, and executable
Sowner or groupsetuid or setgid set, but not executable
totherssticky bit set, and others have execute
Totherssticky bit set, but others don’t have execute

The symbolic command uses = to set each category’s permissions exactly: u=rwx,g=rx,o=rx gives the owner rwx, the group r-x and others r-x, whatever the file had before.

Note: The GNU manual treats the set-user-ID and set-group-ID bits of directories as an exception to the rule that a numeric mode sets every bit: a plain numeric mode can leave them as they were. To remove them from a directory, use the symbolic form, for example chmod g-s dir.

Worked examples

755 → rwxr-xr-x

Owner 4 + 2 + 1 = 7, group 4 + 1 = 5, others 4 + 1 = 5. Command: chmod 755 script.sh or chmod u=rwx,g=rx,o=rx script.sh.

644 → rw-r—r—

Owner 4 + 2 = 6, group 4, others 4: everyone can read, only the owner can write, and nobody can execute. Command: chmod 644 notes.txt.

600 → rw-------

Only the owner can read and write. OpenSSH says private keys “should be readable by the user but not accessible by others” and ignores a key that others can access, so this is the mode to use:

chmod 600 ~/.ssh/id_ed25519

4755 → rwsr-xr-x

755 plus the setuid bit (4). The owner’s execute position shows s because the owner also has execute. With 4644 the same position would show S: setuid is set but the file isn’t executable.

1777 → rwxrwxrwt

Everyone can read, write and enter the directory, and the sticky bit (1) stops users from deleting each other’s files: the classic /tmp setup.

Important: chmod 777 (rwxrwxrwx) lets every user on the system change or replace the file and run it. Use it only if you’re sure, and prefer giving write access to a specific owner or group instead.

Common chmod modes

ModeSymbolicTypical use
644rw-r—r—Regular files, web pages, config files
600rw-------Private files, SSH private keys
755rwxr-xr-xScripts, programs and directories
700rwx------Private directories and scripts, such as ~/.ssh
775rwxrwxr-xShared project directories for a group
777rwxrwxrwxAvoid: anyone can modify the file

Frequently asked questions

What does chmod 755 mean?

The owner can read, write and execute (7 = 4 + 2 + 1); the group and everyone else can read and execute (5 = 4 + 1). In symbolic form that is rwxr-xr-x, a common mode for scripts, programs and directories.

What is the difference between 644 and 755?

Both let only the owner write. 755 adds execute permission for everyone, which programs need to run and directories need to be entered; 644 (rw-r--r--) suits ordinary files that are only read.

Why is chmod 777 a bad idea?

777 lets every user on the system read, change and replace the file, and run it if it's a program. Give write access only to the users who need it, for example with 755 or 775, or by changing the file's owner or group.

What permissions should an SSH private key have?

OpenSSH says private key files should be readable by the user but not accessible by others, and ssh ignores a key that others can access. 600 (rw-------) meets that requirement.

What do s, S, t and T mean in a permission string?

s means the set-user-ID or set-group-ID bit is set together with execute; S means it is set without execute. t means the sticky (restricted deletion) bit is set and others have execute; T means it is set without it.

What does the fourth (leading) octal digit do?

It holds the special bits: 4 for set-user-ID, 2 for set-group-ID and 1 for the sticky bit, added together. 4755 is 755 plus setuid; with three digits, that digit is 0.

Related guides

Free Developer and PC Tools

Free formatters, decoders and converters for developers and PC users. Everything runs in your browser, and nothing you type is sent anywhere.

2 min read