plain/devtools home

Chmod calculator

Type an octal mode, an ls -l permission string or tick the boxes. All three stay in sync, and you can apply a chmod change such as g+w to see the result before you run it.

tool 20 of 21 []
all shortcuts ?

chmod-calculatorsamplesCtrl↵ run · s sample
WhoReadWriteExecuteSpecial
Owner (u)
Group (g)
Others (o)

never leaves your browser

How to use it

  1. Type a three or four digit octal mode such as 644 or 2775, or a permission string as ls -l prints it, such as rwxr-xr-x or drwxrwxrwt. The other forms update as you type.
  2. Or tick the boxes. Each row is one class of user, and the special column holds setuid, setgid and the sticky bit.
  3. To preview a symbolic chmod, type a change such as u+x, go-w, a=r or g=u (copy the owner's bits to the group) and press Apply change. Tick Directory first if the target is a directory, because capital X only adds execute to directories and to files that are already executable.
  4. Copy the octal value, the ls string or the full chmod command from the result.

How the octal digits work

Each octal digit is three bits: read is 4, write is 2 and execute is 1, so 7 is all three, 6 is read and write, and 5 is read and execute. The three digits are the owner, the group and everyone else, in that order, so 754 means the owner can do everything, the group can read and execute, and others can only read.

An optional fourth digit in front holds the special bits: 4 for setuid, 2 for setgid and 1 for sticky. In ls -l they replace the execute letter: s for setuid or setgid, t for sticky, and a capital S or T when the bit is set but execute is not, which usually means a mistake.

On a directory, read lets you list names, write lets you create, delete and rename entries, and execute lets you enter it and reach files inside. A directory with r but not x lists names you cannot open.

Common modes and what they are for

OctalSymbolicTypical use
644-rw-r--r--Ordinary files: owner edits, everyone reads.
600-rw-------Private files such as SSH private keys and .env files.
640-rw-r-----Config files readable by a service group.
664-rw-rw-r--Files shared for editing with a group.
755-rwxr-xr-xPrograms, scripts and ordinary directories.
700-rwx------Private directories such as ~/.ssh.
750-rwxr-x---Directories open to a group, closed to others.
775-rwxrwxr-xShared group directories.
777-rwxrwxrwxEveryone can do everything. Rarely correct.
444-r--r--r--Read-only for everyone.
400-r--------Read-only for the owner, such as an AWS .pem key.
1777drwxrwxrwtShared scratch directories such as /tmp.
2775drwxrwsr-xGroup project directories: new files inherit the group.
4755-rwsr-xr-xsetuid programs such as passwd.

Octal and symbolic columns are generated by this tool's own code when the page is built. The test suite chmods real files to every mode from 000 to 777, the sticky modes and the setuid and setgid modes such as 2775 and 4755, and compares the result with the real ls output; symbolic changes, including copies such as g=u, are compared with the real chmod command.

Examples

Select an example to load it into the tool.

  • 644 file644
  • 600 private key600
  • /tmp stickydrwxrwxrwt
  • setuid4755
  • u+x,go-wu+x,go-w

Frequently asked questions

What does chmod 755 mean?

Owner read, write and execute (7), group read and execute (5), others read and execute (5). In ls -l it shows as rwxr-xr-x. It is the usual mode for programs and directories.

What is the difference between 644 and 755?

644 (rw-r--r--) has no execute bit, so it is for ordinary files. 755 adds execute for everyone, which scripts need to run and directories need to be entered.

Why does ls show a capital S or T?

The special bit is set but the matching execute bit is not. setuid without owner execute has no effect, so a capital S on a program is usually a mistake.

Should I ever use chmod 777?

Rarely. It lets every user on the system change or replace the file. For a shared directory, 1777 (with the sticky bit) or a group with 2775 is safer.

Does chmod +x without u, g or o add execute for everyone?

It adds it for all three classes except bits masked by your umask. With the common umask 022 that is everyone; the tool applies changes without a who letter as a and says so.

Is anything uploaded?

No. The conversion runs in this tab. The test suite fails the build if this tool contains a network call.

Sources

Related tools

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc