# chmod calculator

Convert Unix file permissions between octal (755), letters (rwxr-xr-x), ls -l and chmod clauses, with a checkbox grid and the setuid, setgid and sticky bits.

https://codeknife.dev/en/chmod-calculator/

## What it does

Converts Unix file permissions between octal (`755`), permission letters (`rwxr-xr-x`), an `ls -l` line and `chmod` clauses (`u=rwx,g=rx,o=rx`). Tick the grid and every notation follows, including the setuid, setgid and sticky bits.

## How to use it

1. Type a mode in any notation, or tick the boxes.
2. Read it in every notation, and edit any of them.
3. Copy the converted value, or pick a file type to see the `ls -l` line for a directory or a link.

## Examples

`755` is `rwxr-xr-x`: the owner can read, write and execute, everyone else can read and execute. `644` is `rw-r--r--`, the usual mode for a file, and `1777` is `rwxrwxrwt`, a shared directory such as `/tmp`.

## Good to know

- Digits add read 4, write 2 and execute 1 for the owner, the group and everyone else. A fourth digit in front adds setuid 4, setgid 2 and sticky 1.
- In letters the special bits replace the execute place: `s` for setuid and setgid, `t` for sticky. A capital `S` or `T` means the special bit is set without the execute bit.
- Clauses such as `u=rwx,g=rx,o=rx` set each class outright, and a class that no clause names has no permissions. Relative forms such as `u+x` are not read here, because they depend on the current mode of a file.

## What do the numbers in chmod mean?

Each digit adds up read (4), write (2) and execute (1) for one class: the first digit is the owner, the second the group and the third everyone else. So 755 means the owner can read, write and execute, and the others can read and execute. A fourth digit in front adds setuid (4), setgid (2) and sticky (1).

## Frequently asked questions

### What are setuid, setgid and the sticky bit?

Setuid and setgid make a program run with the permissions of its owner or group instead of those of whoever starts it. On a directory, setgid makes new files inherit the group, and the sticky bit (as on /tmp) lets only a file’s owner delete it. In letters they are an s or t in the execute place; a capital S or T means the execute bit is not set.

### Why is 777 a bad idea?

It lets every user on the system change or replace the file. Give the owner what it needs and the group or others only the access they must have: for scripts that is usually 755, for private files 600.

### Does this tool send my input anywhere?

No. Everything happens in your browser. What you type is never sent to our servers.