Home › Developer Tools › Unix chmod Calculator

Unix chmod Calculator

Tick the permissions for the owner, group and other, or type an octal value, and see the rwx string and the chmod command. Works both ways.

Permissions
Owner
Group
Other
Special bits

One to four digits from 0 to 7, for example 644 or 4755.

Octal 755 is rwxr-xr-x.
Octal value755
rwx stringrwxr-xr-x
chmod commandchmod 755 file
This tool needs JavaScript. Nothing you enter is sent or stored, and it does not change any file. The chmod command is text for you to run on a system you control.

How to use

  1. Tick Read, Write and Execute under Owner, Group and Other. The octal box, the rwx string and the command all update as you tick.
  2. Or work the other way: type a mode such as 640 into the Octal value box and the checkboxes follow. Use one to four digits, each from 0 to 7.
  3. Tick Setuid, Setgid or Sticky if you need a special bit. A fourth digit appears at the front of the octal value.
  4. Press Copy chmod command, then paste it into a terminal and replace file with the real file or folder name.

Worked example

You upload a private notes file to a shared server. You want yourself to read and write it, your group to read it, and nobody else to see it. Tick Owner read and write (4 + 2 = 6), Group read (4) and nothing for Other (0). The tool shows:

Special bits follow the same pattern. Typing 4755 gives rwsr-xr-x: the setuid bit replaces the owner's execute letter with s. Typing 1777 gives rwxrwxrwt, the familiar mode of a shared temporary folder, and 2775 gives rwxrwsr-x, a common mode for a team folder where new files should inherit the group.

How it works

Each permission has a value: read is 4, write is 2 and execute is 1. For each of the owner, group and other, add the values of the permissions that are on. The three digits are the owner, group and other in that order. For example, 755 means owner 7 (4 + 2 + 1, so read, write and execute), group 5 (4 + 1, so read and execute) and other 5 (read and execute).

An optional fourth digit at the front holds the special bits: setuid is 4, setgid is 2 and sticky is 1. Leave it out, or write it as 0, when none are set. Octal values run from 0 to 7777.

The rwx string is the same permissions written as nine characters, as ls -l shows them. A special bit replaces the execute letter in its class. Setuid and setgid show as s when execute is also set and S when it is not. Sticky shows as t or T in the same way.

The model comes from POSIX. The POSIX chmod specification defines the octal and symbolic forms, and the GNU coreutils manual covers the extra behaviour of the Linux version. The kernel stores the whole mode as a 12-bit number, which is why 7777 is the largest value.

What each special bit does

BitOn a fileOn a folder
Setuid (4000)The program runs with the file owner's rights.Ignored on most systems.
Setgid (2000)The program runs with the file's group rights.New files inherit the folder's group.
Sticky (1000)No effect on modern systems.Only a file's owner can delete or rename it.

Common mistakes

Frequently asked questions

What does chmod 755 mean?

The owner can read, write and execute. The group and everyone else can read and execute but not write. It is the usual mode for programs and public folders.

What is the difference between 644 and 664?

Both let the owner read and write and everyone else read. The 664 mode also lets the group write, so it suits files that a team edits together.

Does this tool change my files?

No. It only produces text. You choose whether to run the command, on a system you control.

Why does the tool show a capital S or T?

A capital letter means the special bit is set but the execute bit underneath it is not. That combination is usually a mistake, so the capital is a useful warning.

Can I use this for Windows permissions?

No. Windows uses access control lists rather than the owner, group and other model. The calculator applies to Linux, macOS, BSD and other POSIX systems.

Related tools