← Developer

Chmod Calculator

Tick permissions or type an octal or symbolic mode and get the chmod command, the ls -l string, and a plain-English explanation.

Permissions

WhoReadWriteExecute
Owner (u) 4 2 1
Group (g) 4 2 1
Others (o) 4 2 1
3 or 4 digits, e.g. 644, 0755, 4755
9 letters as in ls -l; a leading - or d is ignored

Apply a relative change

Umask helper

New files (666 minus umask)–
New directories (777 minus umask)–

Result

Octal mode
–
Octal (4-digit)–
Symbolic–
chmod (numeric)–
chmod (symbolic)–
Binary–

What it means

    Common modes

    OctalSymbolicTypical use

    Click a row to load it. Directories need the execute bit to be entered, so 644 on a directory makes it unusable.

    About this tool

    This chmod calculator translates Linux and macOS file permissions between the three ways you meet them: the read, write, and execute checkboxes for owner, group, and others; the octal number you pass to chmod (644, 755, 4755); and the symbolic string ls -l prints (rwxr-xr-x). Change any one and the other two update, including the setuid, setgid, and sticky bits that produce the s, S, t, and T letters. It also applies relative changes such as g-w,o+x to the current mode the way chmod would, explains in plain English what each mode allows, lists the common modes for files, scripts, directories, and shared folders, and shows which default permissions a given umask produces. It is for anyone who administers a server, writes deployment scripts, or has been handed a permissions error and wants to understand what to type.

    How it works

    A mode is a 12-bit number. The low nine bits are three groups of three: read = 4, write = 2, execute = 1, for the owner, group, and others in that order, so rwxr-xr-x is 7 5 5. The next three bits are the special permissions: setuid = 4000, setgid = 2000, sticky = 1000, written as an optional fourth leading octal digit. In the symbolic form ls shows setuid and setgid in the execute position of the owner and group as s (or a capital S when the underlying execute bit is off) and the sticky bit in the others position as t or T. Relative changes are parsed as chmod does: who (u, g, o, a, or none meaning all), an operator (+ add, - remove, = set exactly), and permission letters (r w x s t, or u g o to copy another class's bits), separated by commas. The umask helper computes the defaults new files and directories receive: 666 and 777 respectively, with the umask bits cleared.

    Frequently asked questions

    What is the difference between 755 and 644?

    755 (rwxr-xr-x) lets the owner read, write, and execute while everyone else can read and execute; it is the normal mode for directories and for scripts and programs that must run. 644 (rw-r--r--) lets the owner read and write and everyone else only read; it is the normal mode for ordinary files such as documents, images, and configuration. Execute on a directory means permission to enter it and access files inside, which is why directories need the x bits.

    What do the setuid, setgid, and sticky bits do?

    Setuid (4000) on an executable makes it run with the file owner's privileges instead of the user's; passwd is the classic example, and it is a security risk on anything not designed for it. Setgid (2000) on an executable runs it with the file's group; on a directory it makes new files inherit the directory's group, which is what you want for a shared project folder. The sticky bit (1000) on a world-writable directory such as /tmp lets users delete only their own files.

    Why does chmod 777 get warned about?

    777 (rwxrwxrwx) lets every user on the system read, modify, and execute the file, and on a directory create and delete anything inside it. It fixes permission errors by removing all protection, so malware or a compromised web application can then alter your files. The correct fix is almost always to change the owner or group (chown, chgrp) or to use 755 for directories and 644 for files, granting write access only to the account that actually needs it.

    How does umask relate to chmod?

    umask is a mask of bits to remove from the default permissions when a program creates a file (666) or a directory (777). The common umask 022 removes write for group and others, so new files are 644 and new directories 755; 077 removes everything for group and others, giving 600 and 700; 002 gives group write, producing 664 and 775 for collaborative systems. chmod then changes the mode of an existing file explicitly, overriding whatever umask produced.

    Related tools

    JSON Formatter · Base64 Encode / Decode · URL Encode / Decode · Regex Tester · Hash Generator · UUID Generator · JWT Decoder · HTML Entity Encoder · Color Converter · Password Generator · Number Base Converter · QR Code Generator

    Browse all Developer Tools, or go back to every free tool on HeroYears.