# Chmod Calculator: Octal, Symbolic & umask

> Convert Unix file permissions between octal (755) and symbolic (rwxr-xr-x), apply changes like u+x and calculate umask, with setuid, setgid and sticky bit.

- Page: https://notadevblog.com/en/tools/developer/chmod/
- German version: https://notadevblog.com/de/tools/developer/chmod.md
- Category: Developer

## At a glance

- **Processing:** Locally in your browser, also offline once the page has been opened. Input never leaves your device.
- **Input:** Octal (755, 4755), symbolic (rwxr-xr-x, ls style) and relative changes like u+x,g-w
- **Also:** Setuid, setgid and sticky bit (s, S, t, T), umask for new files and directories

## For agents

WebMCP: the page registers these functions via document.modelContext in browsers that support it.
ES module: https://notadevblog.com/core/chmod.js
Every function returns { "ok": true, ... } or { "ok": false, "error": { "code", "message" } }.

### chmod_calculate

Convert a Unix file mode between octal and symbolic form and explain it. value is an octal mode ("755", "0755", "4755"), a symbolic mode ("rwxr-xr-x", or ls style with a type character: "-rwxr-xr-x", "drwxrwxrwt") or a relative change ("u+x,g-w", "a=rX", "go-rwx") that needs base, the mode it starts from. Symbolic s/S (setuid, setgid) and t/T (sticky) mean: lowercase = bit set and execute set, uppercase = bit set without execute (the bit then has no effect). Relative changes follow GNU chmod: an empty who means a (the umask is not applied), X sets execute only for directories or if some execute bit is already set, = resets the named classes, s applies to u and g, t to o. Set directory: true to make X work as for a directory and to print "d" in ls. octal has 3 digits, or 4 when a special bit is set. On directories GNU chmod keeps existing setuid/setgid bits with a 3- or 4-digit octal mode; clear them with g-s / u-s or a 5-digit mode such as 00755. warnings lists risks (world_writable, setuid, setgid, sticky_no_execute, owner_weaker, ...) as code and message. mode "umask": value is a umask such as "022" (at most 0777); the result gives the permissions of new files (666 minus umask) in file and of new directories (777 minus umask) in directory, and octal, symbolic, ls, matrix and special describe the directory.

Parameters:
- value (string, required): "755", "rwxr-xr-x", "u+x,g-w" or, in umask mode, "022".
- base (string): Starting mode for a relative change, e.g. "644" or "rw-r--r--".
- mode (string: chmod | umask, default "chmod")
- directory (boolean, default false)

Example input: `{"value":"755"}`

Deep link (options in the query, user data after #): https://notadevblog.com/en/tools/developer/chmod/?value=755

## How to use

1. **Set the permissions:** Tick the boxes, or type an octal mode like 755 or a symbolic one like rwxr-xr-x. All fields follow each other.
2. **Apply a change:** Enter a change such as u+x or go-w and apply it to the current mode.
3. **Copy the command:** Copy the chmod command. Warnings point out risky settings such as world-writable files.

## About this tool

Every Unix file has a mode with read, write and execute bits for the owner, the group and everyone else, plus three special bits. chmod changes it, ls -l shows it.

Relative changes follow GNU chmod. The tool never touches files: it only converts and explains modes.

## Frequently asked questions

### What does chmod 755 mean?

The owner can read, write and execute (7), group and others can read and execute (5 each). It is rwxr-xr-x in symbolic form, the usual mode for programs and directories.

### How do the octal digits add up?

Read is 4, write is 2 and execute is 1. Add them per class: owner, group, others. 6 means read and write, 7 means all three.

### What do s, S, t and T mean?

A lowercase letter means the special bit (setuid, setgid or sticky) is set together with execute. An uppercase letter means the bit is set without execute, which usually has no effect.

### How does umask work?

The umask removes permissions from new files (which start at 666) and directories (777). With umask 022, files get 644 and directories 755.

### Why is 777 a bad idea?

Every user on the system can then change or replace the file. Give write access only to the owner or a group, and use 755 or 644 instead.
