chmod octal cheat sheet: digits, symbolic, setuid

Three octal digits are three permission triples. A leading fourth digit adds setuid, setgid and sticky. The chmod calculator on ToolDeck converts both ways; this page is the reference you keep open while chmodding.

One digit = rwx for one class

Mode 644 → rw-r--r--. Mode 755 → rwxr-xr-x. Read left to right: owner, group, others.

  • 0 = --- (0)
  • 1 = --x (1)
  • 2 = -w- (2)
  • 3 = -wx (3)
  • 4 = r-- (4)
  • 5 = r-x (5)
  • 6 = rw- (6)
  • 7 = rwx (7)

Symbolic ↔ octal at a glance

chmod 755 file    # rwxr-xr-x
chmod u=rwx,go=rx file

chmod 664 file    # rw-rw-r--
chmod 640 file    # rw-r-----  (private group-readable)

Four-digit modes (4xxx)

The first digit encodes special bits, not a fourth rwx triple. 4000 setuid on executables, 2000 setgid (often directories for group inheritance), 1000 sticky (typical on world-writable dirs like /tmp).

  • 4755 = setuid + 755 (owner runs as file owner when executed).
  • 2775 = setgid + 775 (new files in the dir inherit the group).
  • 1777 = sticky + 777 (only owner deletes their own files in a shared-writable directory).

Using the calculator

Type octal or symbolic in the chmod tool; it shows the other form and highlights special bits. Nothing leaves the browser.

Questions

How do I get 750 in symbolic form?
u=rwx,g=rx,o= or chmod 750 path. Owner full; group read+execute; others nothing.
When do I need four digits?
When setting or clearing setuid, setgid or sticky. chmod 2755 is not the same as chmod 755.
Does octal work on Windows?
NTFS ACLs are different. Octal chmod applies on Unix, Linux, macOS and in containers; WSL uses the Linux rules inside the distro.

See also

Related tool: chmod calculator. Runs in your browser; input is not uploaded.

More on this tool