Resell services with the EthicalSMM API

Chmod Calculator

Convert Linux file permissions between octal (755, 644) and symbolic (rwxr-xr-x) notation and see who can read, write and execute.

Was this tool helpful?

Thanks for the feedback!

This calculator converts Linux and Unix file permissions between octal numbers like 755 and symbolic strings like rwxr-xr-x. It shows a table of who can read, write and execute, explains any setuid, setgid or sticky bit, and gives you the chmod command to copy. It is aimed at developers, students and anyone setting permissions on shared hosting or a VPS.

What you can enter

The one field is Permission (octal like 755, or symbolic like rwxr-xr-x). It accepts:

  • Three octal digits, such as 644, or four, such as 0644 or 4755. Each digit must be 0 to 7.
  • Nine symbolic characters, such as rw-r--r--.
  • The full ten-character string from ls -l, such as -rw-r--r-- or drwxr-xr-x. The first character (file type) is dropped automatically.

How the octal digits work

Each of the three classes, owner, group and others, gets one digit made by adding: read = 4, write = 2, execute = 1. So 7 is rwx, 6 is rw-, 5 is r-x, 4 is r-- and 0 is ---. The tool shows this in a Read / Write / Execute table for Owner (user), Group and Others.

OctalSymbolicTypical use
644rw-r--r--ordinary files: HTML, PHP, images, CSS
755rwxr-xr-xfolders, and scripts that need to run
600rw-------private files like SSH keys and config with passwords
640rw-r-----config files the web server group must read
777rwxrwxrwxeveryone can do everything (avoid)

For a folder, "execute" means permission to enter it and reach the files inside, which is why folders need the x bit even when files do not.

Setuid, setgid and the sticky bit

A fourth, leading digit holds the special bits: setuid = 4, setgid = 2, sticky = 1. In symbolic form they replace the x in one of the three groups:

  • Setuid shows as s in the owner's execute spot. A program with setuid runs with its owner's rights. Typing rwsr-xr-x gives chmod 4755, and the table marks the owner row "Yes + setuid". The passwd command is the classic example.
  • Setgid shows as s in the group's execute spot. On a folder, new files inherit the folder's group, which helps teams share a directory. 2775 shows as rwxrwsr-x.
  • Sticky shows as t in the others' execute spot. In a sticky folder, users can only delete their own files. 1777 shows as rwxrwxrwt, the usual mode of /tmp.

A capital S or T means the special bit is set but the execute bit underneath is not. For example, rwSr--r-- converts to 4644. On a file that cannot be executed, setuid does nothing, so a capital S usually points to a mistake.

Safe defaults for a website

On most Linux web hosting, 644 for files and 755 for folders is the standard advice. The owner can edit, and the web server can read files and enter folders, but other accounts cannot change anything. For files holding database passwords, such as .env or wp-config.php, 600 or 640 is tighter where your host supports it.

Whenever "others" have write permission, the tool adds a warning: "others" can write to this file. You will see it for 777, 666 and also 1777. Setting 777 to fix an upload error is a common shortcut, but it lets any process on the server change the file, which is how many hacked sites get altered. Find out which user the web server runs as and fix ownership instead.

Using the command

The result includes a ready line such as chmod 755 filename with a Copy button. Replace filename with your file or folder. If you entered a leading zero, the tool drops it, so 0640 becomes chmod 640. Add -R to apply a mode to a folder and everything in it, but be careful: running chmod -R 755 makes every file executable too. Many people use find to set folders and files separately.

Inputs with digits 8 or 9, or symbols in the wrong place, give the message "Enter an octal mode like 755 or 0644, or a symbolic one like rwxr-xr-x." To convert between octal, binary and decimal more generally, use the number base converter.

Frequently asked questions

What does chmod 755 mean?
755 is rwxr-xr-x: the owner can read, write and execute, while the group and others can read and execute but not write. It is the usual setting for folders and scripts.
What is the difference between 644 and 755?
644 (rw-r--r--) gives no execute permission to anyone and is used for normal files. 755 adds execute for all three classes, which folders need so they can be opened.
Is chmod 777 safe?
Rarely. It lets every user and process on the server change the file, and the tool shows a warning whenever others have write access. Use 644 for files and 755 for folders instead.
What does the s in rwsr-xr-x mean?
It is the setuid bit, which makes a program run with the rights of its owner. In octal it adds a leading 4, so rwsr-xr-x is 4755.
What is the sticky bit used for?
On a shared folder it stops users from deleting or renaming files that belong to others. It appears as t at the end of the symbolic string, as in 1777 for /tmp.
How do I convert -rw-r--r-- to octal?
Paste the whole string from ls -l into the tool. It drops the first file-type character and gives 644.

Related guides

Related tools

People also used

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.