Chmod Calculator: Octal, Symbolic and Checkbox Permissions
chmod 755 gives the owner read, write and execute and everyone else read and execute, which `ls -l` shows as rwxr-xr-x. The same mode in symbolic form is `chmod u=rwx,go=rx`. Each octal digit adds read (4), write (2) and execute (1) for the owner, group and others in turn, and a fourth leading digit adds setuid (4), setgid (2) and sticky (1). Tick the boxes, type octal, paste an `ls -l` string or a chmod command, or apply a change like `u+x,go-w` to a starting mode, and every other form updates.
Updated Runs in your browser: nothing you enter is uploadedHow this tool works
Result
Read “755” as an octal mode.
- Octal
- 755
- Octal, four digits
- 0755
- Symbolic
- rwxr-xr-x
- As ls -l shows it
- -rwxr-xr-x
- chmod, numeric
- chmod 755 file
- chmod, symbolic
- chmod u=rwx,go=rx file
What it means
- Owner (u): read, write, execute
- Group (g): read, execute
- Others (o): read, execute
Common chmod modes
| Mode | Symbolic | chmod, symbolic | Typical use | What it allows |
|---|---|---|---|---|
| 644 | rw-r--r-- | chmod u=rw,go=r file | Ordinary files: documents, web pages, configuration | The owner can read and write; everyone else can only read. |
| 755 | rwxr-xr-x | chmod u=rwx,go=rx file | Programs, scripts and directories | The owner can do everything; everyone else can read and run (or enter a directory). |
| 600 | rw------- | chmod u=rw,go= file | Private files such as SSH keys and credentials | Only the owner can read and write. ssh refuses a private key that is more open. |
| 700 | rwx------ | chmod u=rwx,go= file | Private directories and personal scripts (~/.ssh) | Only the owner can read, write, run or enter. |
| 777 | rwxrwxrwx | chmod a=rwx file | Almost never | Warning: every user can read, change and run it. A common “fix” for permission errors that hides the real problem and is a security hole on shared or web-facing systems. |
| 1777 | rwxrwxrwt | chmod ug=rwx,o=rwxt file | Shared scratch directories such as /tmp | Everyone can create files, but the sticky bit stops them deleting or renaming files that belong to others. |
| 2775 | rwxrwsr-x | chmod u=rwx,g=rwxs,o=rx file | A directory shared by a team | Setgid makes new files inherit the directory’s group; owner and group can write, others can only read and enter. |
| 400 | r-------- | chmod u=r,go= file | Read-only secrets | Only the owner can read; nobody can write without changing the mode first. |
| 4755 | rwsr-xr-x | chmod u=rwxs,go=rx file | A program that must run as its owner (like passwd) | Setuid: it runs with the owner’s privileges whoever starts it. Use sparingly. |
Octal digits
| Digit | Bits | Symbolic | Allows |
|---|---|---|---|
| 0 | 000 | --- | no permissions |
| 1 | 001 | --x | execute |
| 2 | 010 | -w- | write |
| 3 | 011 | -wx | write, execute |
| 4 | 100 | r-- | read |
| 5 | 101 | r-x | read, execute |
| 6 | 110 | rw- | read, write |
| 7 | 111 | rwx | read, write, execute |
What read, write and execute mean
| Permission | On a file | On a directory |
|---|---|---|
| Read (r, 4) | View the contents. | List the names inside (ls). |
| Write (w, 2) | Change or truncate the contents. | Create, delete and rename entries (needs execute too). |
| Execute (x, 1) | Run it as a program or script. | Enter it (cd) and reach files by name. |
Special bits
| Bit | Octal | Shown as | On a file | On a directory |
|---|---|---|---|---|
| Setuid | 4000 | s in the owner triad (rwsr-xr-x) | Runs with the owner’s privileges. | Ignored on Linux. |
| Setgid | 2000 | s in the group triad (rwxr-sr-x) | Runs with the group’s privileges. | New files inherit the directory’s group. |
| Sticky | 1000 | t in the others triad (rwxrwxrwt) | Ignored on modern systems. | Only a file’s owner (or the directory’s owner or root) may delete or rename it. |
Symbolic changes worked out
| Change | Starting mode | Result | Result, symbolic | Why |
|---|---|---|---|---|
| u+x | 644 (rw-r--r--) | 744 | rwxr--r-- | Make a script executable by its owner. |
| a+x | 644 (rw-r--r--) | 755 | rwxr-xr-x | Make it executable for everyone (a means u, g and o). |
| go-w | 666 (rw-rw-rw-) | 644 | rw-r--r-- | Take write away from group and others. |
| u+x,go-w | 666 (rw-rw-rw-) | 744 | rwxr--r-- | Several clauses apply left to right, separated by commas. |
| a=r | 755 (rwxr-xr-x) | 444 | r--r--r-- | = replaces: everyone gets exactly read, nothing else. |
| g=u | 740 (rwxr-----) | 770 | rwxrwx--- | Copy the owner’s permissions to the group. |
| u=rwx,go=rx | 000 (---------) | 755 | rwxr-xr-x | Set each class exactly: the symbolic form of 755. |
| a+X | 644 (rw-r--r--) | 644 | rw-r--r-- | X adds execute only if the file is a directory or already executable by someone: no change here. |
| a+X | 744 (rwxr--r--) | 755 | rwxr-xr-x | The owner already had execute, so X adds it for all. |
| g+s | 755 (rwxr-xr-x) | 2755 | rwxr-sr-x | Set the setgid bit; shown as s in the group triad. |
| +t | 777 (rwxrwxrwx) | 1777 | rwxrwxrwt | Add the sticky bit, as on /tmp. |
How to work out chmod permissions
- Add up each class. For the owner, the group and others, add read 4, write 2 and execute 1. Read and write is 4 + 2 = 6; read and execute is 4 + 1 = 5; all three is 7. Owner rwx, group r-x, others r-x is 755.
- Write the three digits. Put the owner’s digit first, then the group’s, then others’: chmod 755 file. Add a leading digit for special bits (4 setuid, 2 setgid, 1 sticky): chmod 2775 dir.
- Or change only what you need. Use symbolic mode to adjust a file without restating the rest: chmod u+x file adds owner execute and leaves everything else as it is; chmod go-w file removes write for group and others. Applied to 666, u+x,go-w gives 744.
- Read the ls -l output. The nine characters after the file type are three triads: owner, group, others. rwxr-xr-x is 755. An s or t replaces the execute letter for a special bit (rwsr-xr-x is 4755), and a capital S or T means the bit is set without execute.
- Check it before you run it. Run ls -l on the file afterwards. Avoid 777: if something fails with “permission denied”, fix the owner (chown) or the group, not the world-writable bit. Add -R only when you really want a whole tree changed.
Frequently asked questions
- What does chmod 755 mean?
- 755 is rwxr-xr-x: the owner can read, write and execute (7 = 4 + 2 + 1), while the group and others can read and execute (5 = 4 + 1) but not write. It is the usual mode for programs, scripts and directories. The symbolic command is chmod u=rwx,go=rx file.
- What does chmod 644 mean?
- 644 is rw-r--r--: the owner can read and write (6), the group and others can only read (4). It is the usual mode for ordinary files. The symbolic command is chmod u=rw,go=r file.
- Is chmod 777 safe?
- No. 777 (rwxrwxrwx) lets every user on the system read, change and run the file, and on a web server it can let an attacker who finds any foothold rewrite your code. It also usually hides the real problem. Give the file to the right owner or group with chown or chgrp and use 755 or 775 for directories and 644 or 664 for files. If many users must write to one directory, use setgid (2775) or the sticky bit (1777, as /tmp has) instead.
- What are setuid, setgid and the sticky bit?
- They are the three special bits, the leading octal digit. Setuid (4000) makes a program run as its owner, so 4755 shows as rwsr-xr-x. Setgid (2000) runs a program with its group, and on a directory makes new files inherit the directory’s group (2775 is rwxrwsr-x). The sticky bit (1000) on a directory stops users deleting each other’s files, so 1777 is rwxrwxrwt.
- Why does ls -l show a capital S or T?
- ls shows a lowercase s or t when the special bit and the matching execute bit are both set, and a capital S or T when the special bit is set but execute is not. 4644 shows as rwSr--r-- and 1776 as rwxrwxrwT. A capital letter is usually a mistake, because setuid without execute does nothing.
- What is the difference between chmod 755 and chmod u=rwx,go=rx?
- None, when you are setting all three classes: the numeric form states the whole mode in one number, and the symbolic form sets each class with = so it also replaces what was there. The symbolic form is easier to read and lets you change just one part (chmod g+w file), which the numeric form cannot do without knowing the current mode.
- How do I make a file executable?
- Use chmod +x file to let everyone run it, or chmod u+x file for the owner only. With no who letters, +x is limited by your umask, but the usual umask of 022 only blocks write, so +x adds execute for all three classes. Applied to 644, u+x gives 744 and a+x gives 755, the same as plain +x (755).
- What does the capital X do in chmod?
- X adds execute only if the target is a directory or already has execute for someone. It is meant for chmod -R a+rX dir: directories become enterable and files that were executable stay so, while plain files do not become executable. Applied to 644 it changes nothing (644); applied to 744 it gives 755.
- Does chmod keep setgid on a directory?
- GNU chmod does, in most cases: on a directory it preserves setuid and setgid unless you clear them explicitly with a symbolic mode such as g-s. A symbolic = clause (chmod g=rx dir) and a short numeric mode (chmod 755 dir) leave the bits as they were, so a setgid shared directory stays setgid. Tick “The target is a directory” to see this in symbolic changes; the result for a plain octal mode is the mode as typed, before this rule.
- What does the calculator do with the umask?
- Only a symbolic clause with no u, g, o or a is affected: for those, chmod leaves out any permission the umask would deny, so +w with the default 022 adds write for the owner but not for group and others. Clauses with who letters, octal modes and ls-style strings ignore the umask. Change the umask field to match your shell (umask prints it).
How it works
The Mode field is read as one of four forms. Digits only are an absolute octal mode of up to four digits (leading zeros allowed). Nine characters, or ten with a leading file-type character, are an ls -l string: each position must be r, w, x or - (and s, S, t or T where a special bit can appear), and s or t means the special bit and execute are both set while S or T means the special bit alone. A line starting with chmod is reduced to its mode argument by skipping options like -R and the file names. Anything else is read as a symbolic mode and applied to the starting mode you give, following POSIX chmod: clauses are separated by commas and applied left to right; each has optional who letters (u, g, o, a), then one or more actions, an operator (+, - or =) with permissions r, w, x, X, s, t or a single letter u, g or o to copy that class’s current permissions. + adds, - removes, and = clears everything the who letters cover (including that class’s setuid, setgid or sticky bit) before adding the new permissions. As GNU chmod does, o also covers the sticky bit, s applies to u and g only, and a clause with no who letters is limited by the umask. X adds execute if the target is marked as a directory or any execute bit is already set. The generated symbolic command sets u, g and o with = (merging classes with identical permissions), so it reproduces the mode from any starting point. Two things are not modelled: a few systems clear setuid and setgid when a file is written or chowned, and GNU chmod keeps a directory’s setuid and setgid bits when it is given a short numeric mode (chmod 755 dir leaves setgid on); clear them with a symbolic mode such as g-s. The calculator follows the same rule for symbolic changes when “The target is a directory” is ticked: = leaves a directory’s setuid and setgid bits alone unless you name them or remove them with -s. A numeric mode typed here is shown exactly as written, because the tool does not know the directory’s current mode. Everything runs in your browser; nothing you type is sent anywhere.
Sources
More free tools
- Number Base ConverterConvert whole numbers between binary, octal, decimal, hex and any base from 2 to 36, up to 5,000 digits, with grouped digits and a two’s-complement view.
- Cron Expression ExplainerPaste a 5-field cron expression and read it in plain English, with the next 10 run times in your time zone or UTC. Handles names, steps and @daily.
- IP Subnet CalculatorWork out the network, broadcast, usable hosts, masks and binary of any IPv4 CIDR block, split it into subnets, and expand or compress IPv6 addresses.
- Text to Binary ConverterConvert text to binary, hex, octal or decimal bytes and back. UTF-8 by default (é is 2 bytes, an emoji 4) or UTF-16, with a per-character breakdown.
- Unix Timestamp ConverterConvert a Unix timestamp to a date and a date to a timestamp. Seconds to nanoseconds, any time zone, plus a live counter of the current Unix time.
- Unit ConverterConvert length, area, volume, weight and temperature with exact factors, plus cubic yards, tons and bags for gravel, soil, sand and concrete.