Chmod Calculator
Turn read/write/execute permissions into an octal chmod value, and back again.
| Read 4 | Write 2 | Execute 1 | |
|---|---|---|---|
| Owner | |||
| Group | |||
| Others |
What this tool does
A chmod calculator turns Unix file permissions into the number you give the chmod command. Tick which of read, write and execute the owner, group and others should have, and it shows the octal value (like 755), the symbolic form (rwxr-xr-x) and the exact command to run. It works both ways - type an octal value and it sets the grid - and handles the special bits (setuid, setgid, sticky). It is pure bit arithmetic, all in your browser.
Converts a read/write/execute grid for owner, group and others into octal and symbolic permission notation, with the chmod command ready to copy.
Works in reverse too - type an octal value like 644 and it sets the grid - and supports the setuid, setgid and sticky special bits.
How to use it
- Tick the boxes for what the owner, group and others may do - or type an octal value like 755.
- Read off the octal, the symbolic form and the plain-English explanation.
- Copy the chmod command and replace 'filename' with your file or folder.
Why use this calculator
Unix permissions are easy to get backwards between the grid, the octal digits and the symbolic form. A calculator converts both ways and gives the command to copy.
Why we built it
We built the chmod calculator to work both ways - tick the grid for the octal or type the octal to set the grid - showing octal, symbolic and the command. Convert numbers with the number base converter and write server rules with the htaccess generator.
Who this tool is for
- Web developers and system administrators
- Students learning Linux permissions
- Anyone setting file access
When to use it
- Setting file and directory permissions.
- Reading a mode such as 755 or 644.
- Understanding setuid, setgid and sticky bits.
- Learning permission notation.
How the numbers work
Read is 4, write is 2, execute is 1.
Each permission has a value: read is 4, write is 2, execute is 1. You add them up for each group of users. Read and write is 4 + 2 = 6; read, write and execute is 4 + 2 + 1 = 7; read and execute (no write) is 4 + 1 = 5. A full permission set is three of those digits in a row, one each for the owner, the group and everyone else - so 755 means the owner has all three (7), and the group and others can read and execute but not write (5).
The symbolic form shows the same thing as letters: r for read, w for write, x for execute, a dash for none. So 755 is rwxr-xr-x. This tool shows both at once, so you can read a permission however you think about it.
The everyday values
A few come up constantly. 644 is the normal setting for a file: the owner can read and write it, everyone else can only read it. 755 is the normal setting for a directory or a script you want to run: the owner can do everything, others can read and enter or run it. 600 keeps a file entirely private to its owner, which is what SSH keys need. 777 gives everyone full control - occasionally a quick fix, but almost never what you actually want, because it lets anyone change or delete the file.
If in doubt, 644 for files and 755 for folders is the safe default pair. Reach for 777 only to rule permissions out while debugging, then set something tighter.
The special bits
An optional fourth digit in front controls three special behaviours. setuid (4) makes a program run as its owner rather than the user who launched it; setgid (2) does the same for the group, and on a directory makes new files inherit that group; the sticky bit (1) on a shared directory stops users deleting each other's files, which is how /tmp works. In symbolic notation these replace an x with s or t. Turn on 'Special bits' to include them - most everyday files never need them.
What you give it, and what you get back
| Item | Details |
|---|---|
| Input | A read, write, execute grid, or an octal value. |
| Output | Octal and symbolic forms with a chmod command. |
| Options | Special bits. |
Issues you may run into
| What you see | Why it happens | What to do |
|---|---|---|
| Permission denied after chmod | Ownership or a parent directory is the issue. | Check the owner and path. |
| 777 seems easy but is risky | It allows everyone to write. | Use the least permission needed. |
| ACLs apply | This covers standard bits only. | Check ACLs and SELinux separately. |
Assumptions and limitations
- It calculates the permission value; it does not change any file. Run the chmod command yourself in a terminal.
- It covers standard Unix permission bits and the special bits, not access-control lists (ACLs) or SELinux contexts, which some systems layer on top.
- Symbolic chmod syntax (like chmod u+x) is not generated - the tool works in the numeric mode people use most.
- Permissions behave slightly differently on files versus directories (execute means 'enter' for a directory); the tool shows the bits, not that nuance per target.
- Windows does not use Unix permissions, so this applies to Linux, macOS and other Unix-like systems.
Frequently asked questions
What does chmod 755 mean?
It gives the owner read, write and execute (7 = 4+2+1), and the group and everyone else read and execute but not write (5 = 4+1). In symbolic form that is rwxr-xr-x. It is the usual setting for directories and for scripts you want to be runnable.
How do I calculate file permissions?
Add up the values for each group of users: read is 4, write is 2, execute is 1. Do it for the owner, the group and others, and put the three digits together. Read-write-execute is 7, read-write is 6, read-execute is 5, read-only is 4. This tool adds them for you as you tick the boxes.
What is the difference between 644 and 755?
644 gives the owner read and write and everyone else read only - the normal setting for a file. 755 adds execute for everyone and keeps write to the owner - the normal setting for a directory or a runnable script. The extra execute bit is what lets you enter a folder or run a program.
What are the read, write and execute numbers?
Read is 4, write is 2, execute is 1. You add them to describe what a user can do: 6 is read and write, 5 is read and execute, 7 is all three, 0 is nothing. Three such digits - owner, group, others - make a full permission like 640.
What are setuid, setgid and the sticky bit?
They are an optional fourth digit. setuid (4) runs a program as its owner; setgid (2) runs it as its group and makes a directory's new files inherit that group; the sticky bit (1) on a shared directory stops people deleting others' files, as on /tmp. Most ordinary files never need them.
How do I use the chmod command?
Copy the command shown - for example 'chmod 755 filename' - replace 'filename' with your file or folder, and run it in a terminal on Linux, macOS or another Unix-like system. Add -R to apply it to everything inside a folder.