Quick Answer
To work out a chmod number, add 4 for read, 2 for write and 1 for execute. Do this for the owner, the group and others, in that order. So 755 means the owner has 4 + 2 + 1 = 7 (rwx), and the group and others have 4 + 1 = 5 (r-x). The letter code is rwxr-xr-x.
Embed this calculator
Adjust the size if needed, then copy the code below into your page or blog. The calculator will load in an iframe and stay updated automatically.
Table of Contents
- Chmod Calculator
- Quick Answer
- Related Calculators
- How This Chmod Calculator Works
- How to Use the Chmod Calculator
- Core Rules
- Key Terms
- Worked Example
- Real-Life Examples
- Numbers vs Letters in chmod
- Common chmod Codes
- Directories and Special Bits
- Before You Change Permissions
- Common Mistakes to Avoid
- Frequently Asked Questions
- References & Sources
How This Chmod Calculator Works
On Linux, macOS and other Unix-like systems, each file and directory has permissions for three sets of people: its owner, other people in its group, and everyone else. Each set can have permission to read, write and execute. The chmod command changes these permissions, using either numbers or letters.
To get a command, choose a permission number for each set. You can also enter a code such as 755, rwxr-xr-x or -rwxr-xr-x to see what it means. Want to make a change? Enter the current permissions and a change such as u+x,g-w to see the result first. There is also an option to check the permissions a umask leaves on new files and directories. Choose File or Directory carefully, because read, write and execute work differently for each one.
Quick explanation:
- First digit of 755: the owner’s permissions.
- Second digit: the group’s permissions.
- Third digit: everyone else’s permissions.
How to Use the Chmod Calculator
- Choose what you want to do.
- If asked, choose File or Directory.
- Choose permissions, or enter a code, change or umask.
- Press Calculate or Enter.
- Read the explanation, then copy the command or save the result.
Core Rules
- Each digit: read (4) + write (2) + execute (1)
- Special digit: set user ID (4) + set group ID (2) + sticky bit (1)
- + adds a permission, − removes it, and = sets exactly the ones you list
- New file: 666 with the umask’s permissions turned off
- New directory: 777 with the umask’s permissions turned off
Key Terms
- Mode: the full set of permissions and special bits.
- Octal: a number system that uses the digits 0 to 7.
- Umask: the permissions turned off when new items are created.
- Set user ID (setuid): a special bit that makes a program run with its file owner’s user ID.
- Sticky bit: a special bit that limits who can remove or rename items in a directory.
Worked Example
A script has permissions 644. What happens if you use chmod u+x,g+w?
- 644 is rw-r–r–: the owner can read and write, and everyone else can only read
- u+x adds execute for the owner: 6 + 1 = 7
- g+w adds write for the group: 4 + 2 = 6
- Others stay at 4, so the new code is 764, or rwxrw-r–
- You could also use chmod 764. It sets every permission, while u+x,g+w changes only those two
Real-Life Examples
- Script: 755 lets everyone read and run it, but only the owner can change it.
- Private file: 600 lets only the owner read and change it.
- Shared folder: 2775 lets the group add files. On most systems, new files get the folder’s group.
- Umask 027: new files are 640 and new directories are 750.
Numbers vs Letters in chmod
- Numbers: chmod 644 sets read, write and execute for everyone.
- Letters: chmod g+w can change one permission and leave the rest alone.
- Directories: with GNU chmod, up to four digits can set, but not clear, the set user ID and set group ID bits.
Common chmod Codes
These are examples, not advice for every system. For directories, execute means permission to enter and reach items.
| Number | Letters | Meaning |
|---|---|---|
| 400 | r——– | The owner can read |
| 600 | rw——- | The owner can read and write |
| 640 | rw-r—– | Same as 600, and the group can read |
| 644 | rw-r–r– | The owner can read and write, and everyone else can read |
| 664 | rw-rw-r– | The owner and group can read and write, and others can read |
| 700 | rwx—— | Only the owner has access |
| 750 | rwxr-x— | The owner has full access, and the group can read and execute |
| 755 | rwxr-xr-x | The owner has full access, and everyone else can read and execute |
| 777 | rwxrwxrwx | Everyone has full access, which is rarely a good idea |
| 1777 | rwxrwxrwt | Same as 777, with the sticky bit |
| 2775 | rwxrwsr-x | Set group ID. Owner and group have full access, and others can read and execute |
Directories and Special Bits
For a directory, read lets someone list the names inside. Execute lets them enter it and reach the items inside. Write lets them add, rename and remove items, but they need execute too. That means someone may be able to delete a file they can’t edit, because deleting it depends on the directory’s permissions. Using the same code for every file and directory can make plain files executable or stop people from opening directories.
The special bits also work differently. Set user ID and set group ID on a program file make it run with the file’s owner or group. On most systems, set group ID on a directory gives new items the directory’s group, which is useful for shared folders. On a shared directory, the sticky bit limits who can remove or rename items. /tmp often uses 1777 for this reason. A lowercase s or t means execute is on too, while a capital S or T means it’s off. GNU chmod keeps set user ID and set group ID on a directory unless you clear them, for example with u-s or g-s.
Before You Change Permissions
- Check first: use
ls -l, orls -ldfor a directory. - Give only what’s needed: start with the fewest permissions that will work.
- Take care with -R: it also changes everything inside a directory.
- Try X (capital): it adds execute only to directories and to files where someone already has it.
- Still no access? Check the owner, the group, ACLs and the folders above.
Common Mistakes to Avoid
- Using 777 to fix an access error. It lets everyone change the item. Find the cause instead.
- Using one code for files and directories. Execute works differently for each.
- Putting the digits in the wrong order. The order is owner, group, others.
- Subtracting the umask like a normal number. It turns off permissions: 666 with umask 033 gives 644, not 633.
- Expecting 755 to clear special bits on a directory. GNU chmod keeps set user ID and set group ID.
Frequently Asked Questions
The owner can read, write and execute. The group and others can read and execute.
The owner can read and write. Everyone else can only read.
Only the owner can read and write.
Everyone can read, write and execute. This is risky and rarely needed.
To add execute for the owner only, use chmod u+x followed by the file name.
It normally gives new files 644 and new directories 755.
Split it into rwx, r-x and r-x. Add 4, 2 and 1 for the letters in each part to get 755.
It sets the special bits. Here, 2 is set group ID.
The special bit is on, but execute is off in that position.
Without one of them, chmod also uses your umask, so the result can vary. Use a if you want to change all three sets of people.
No. It only shows the command. Check it before you run it.
Yes. Save each set by name in this browser.
Yes. Use Compare: keep as A.
Yes. Use Share link or Print.
References & Sources
| Source | Used For | Link |
|---|---|---|
| GNU Coreutils manual, Numeric Modes | The value of each permission bit, including set user ID, set group ID and the sticky bit. | https://www.gnu.org/software/coreutils/manual/html_node/Numeric-Modes.html |
| GNU Coreutils manual, Structure of File Mode Bits | What read, write, execute and the special bits do for files and directories. | https://www.gnu.org/software/coreutils/manual/html_node/Mode-Structure.html |
| Linux manual pages, chmod(1) | Number and letter modes, X, and how directories keep their set user ID and set group ID bits. | https://man7.org/linux/man-pages/man1/chmod.1.html |
| Linux manual pages, umask(2) | How a umask turns off permissions for new files and directories. | https://man7.org/linux/man-pages/man2/umask.2.html |
| GNU Gnulib source code, modechange.c | How GNU works out +, – and = changes. We used its rules to check this calculator’s results. | https://github.com/coreutils/gnulib/blob/master/lib/modechange.c |