Skip to main content

Unix File Permissions Calculator API

REAL DATA

Parse octal Unix modes, apply POSIX symbolic chmod expressions and calculate umask results, including special bits, X and class copying.

Authoritative reference data or standards computation

Base URL
/api/unix-permissions
Capabilities
3 routes
Last updated
July 30, 2026
Data source

GET /api/unix-permissions/parse

Live requestRuns against the public API
No key required
GET/api/unix-permissions/parse?mode=4755

Request parameters

Strict three- or four-digit octal mode from 000 through 7777; output is padded to four digits.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/unix-permissions/parse?mode=4755"
const res = await fetch("https://randomapi.dev/api/unix-permissions/parse?mode=4755");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/unix-permissions/parse?mode=4755").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/unix-permissions/parse?mode=4755"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
mode string required

Strict three- or four-digit octal mode from 000 through 7777; output is padded to four digits.

allowed: 3 – 4
example: mode=4755
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=octal,symbolic
exclude list

Return all fields except these (comma-separated).

example: exclude=sticky
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 8
octal string

Canonical four-digit octal mode.

example: 4755

symbolic string

Nine permission characters with POSIX special-bit notation.

example: rwsr-xr-x

user string

User rwx bits without special-bit substitution.

example: rwx

group string

Group rwx bits without special-bit substitution.

example: r-x

other string

Other rwx bits without special-bit substitution.

example: r-x

setuid boolean

Whether the set-user-ID bit is set.

example: true

setgid boolean

Whether the set-group-ID bit is set.

example: false

sticky boolean

Whether the sticky bit is set.

example: false

Documented examples

Build-generated requests and complete responses
3
Setuid executable
GET /api/unix-permissions/parse?mode=4755
{
  "data": {
    "octal": "4755",
    "symbolic": "rwsr-xr-x",
    "user": "rwx",
    "group": "r-x",
    "other": "r-x",
    "setuid": true,
    "setgid": false,
    "sticky": false
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/parse",
    "params": {
      "mode": "4755"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Sticky directory without other execute
GET /api/unix-permissions/parse?mode=1766
{
  "data": {
    "octal": "1766",
    "symbolic": "rwxrw-rwT",
    "user": "rwx",
    "group": "rw-",
    "other": "rw-",
    "setuid": false,
    "setgid": false,
    "sticky": true
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/parse",
    "params": {
      "mode": "1766"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Ordinary private file
GET /api/unix-permissions/parse?mode=600
{
  "data": {
    "octal": "0600",
    "symbolic": "rw-------",
    "user": "rw-",
    "group": "---",
    "other": "---",
    "setuid": false,
    "setgid": false,
    "sticky": false
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/parse",
    "params": {
      "mode": "0600"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}

GET /api/unix-permissions/apply

Live requestRuns against the public API
No key required
GET/api/unix-permissions/apply?current=0644&symbolic=u%2Bx%2Cg%3Du%2Co-rwx

Request parameters

Existing three- or four-digit octal mode to modify.

Whitespace-free POSIX symbolic mode with at most 32 comma-separated clauses and 64 operations.

Creation mask used when a clause omits ugoa; three octal digits with an optional leading zero.

Makes X grant execute/search when needed and is required for portable sticky-bit operations using t.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/unix-permissions/apply?current=0644&symbolic=u%2Bx%2Cg%3Du%2Co-rwx"
const res = await fetch("https://randomapi.dev/api/unix-permissions/apply?current=0644&symbolic=u%2Bx%2Cg%3Du%2Co-rwx");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/unix-permissions/apply?current=0644&symbolic=u%2Bx%2Cg%3Du%2Co-rwx").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/unix-permissions/apply?current=0644&symbolic=u%2Bx%2Cg%3Du%2Co-rwx"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 4
current string required

Existing three- or four-digit octal mode to modify.

allowed: 3 – 4
example: current=0644
symbolic string required

Whitespace-free POSIX symbolic mode with at most 32 comma-separated clauses and 64 operations.

allowed: 1 – 128
example: symbolic=u+x,g=u,o-rwx
umask string

Creation mask used when a clause omits ugoa; three octal digits with an optional leading zero.

default: 0022
allowed: 3 – 4
example: umask=0022
isDirectory boolean

Makes X grant execute/search when needed and is required for portable sticky-bit operations using t.

default: false
example: isDirectory=true
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=before,expression
exclude list

Return all fields except these (comma-separated).

example: exclude=changed
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 7
before string

Canonical mode before the expression.

example: 0644

expression string

Symbolic expression that was evaluated.

example: u+x,g=u,o-rwx

umask string

Canonical mask used for omitted target classes.

example: 0022

isDirectory boolean

Directory condition used by X and portable sticky-bit validation.

example: false

after string

Canonical mode after all clauses.

example: 0770

symbolic string

Nine-character representation of the result.

example: rwxrwx---

changed boolean

Whether the resulting mode differs from the input mode.

example: true

Documented examples

Build-generated requests and complete responses
3
Add execute, copy user to group, clear other
GET /api/unix-permissions/apply?current=0644&symbolic=u%2Bx%2Cg%3Du%2Co-rwx
{
  "data": {
    "before": "0644",
    "expression": "u+x,g=u,o-rwx",
    "umask": "0022",
    "isDirectory": false,
    "after": "0770",
    "symbolic": "rwxrwx---",
    "changed": true
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/apply",
    "params": {
      "current": "0644",
      "symbolic": "u+x,g=u,o-rwx",
      "umask": "0022",
      "isDirectory": false
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Use X for a directory
GET /api/unix-permissions/apply?current=0644&symbolic=a%2BX&isDirectory=true
{
  "data": {
    "before": "0644",
    "expression": "a+X",
    "umask": "0022",
    "isDirectory": true,
    "after": "0755",
    "symbolic": "rwxr-xr-x",
    "changed": true
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/apply",
    "params": {
      "current": "0644",
      "symbolic": "a+X",
      "umask": "0022",
      "isDirectory": true
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Set all three special bits
GET /api/unix-permissions/apply?current=0755&symbolic=u%2Bs%2Cg%2Bs%2Ca%2Bt&isDirectory=true
{
  "data": {
    "before": "0755",
    "expression": "u+s,g+s,a+t",
    "umask": "0022",
    "isDirectory": true,
    "after": "7755",
    "symbolic": "rwsr-sr-t",
    "changed": true
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/apply",
    "params": {
      "current": "0755",
      "symbolic": "u+s,g+s,a+t",
      "umask": "0022",
      "isDirectory": true
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}

GET /api/unix-permissions/umask

Live requestRuns against the public API
No key required
GET/api/unix-permissions/umask?requested=0666&umask=0022

Request parameters

Requested three-digit permission template, optionally prefixed by 0; special bits are not accepted.

Three octal mask digits, optionally prefixed by 0.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/unix-permissions/umask?requested=0666&umask=0022"
const res = await fetch("https://randomapi.dev/api/unix-permissions/umask?requested=0666&umask=0022");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/unix-permissions/umask?requested=0666&umask=0022").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/unix-permissions/umask?requested=0666&umask=0022"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 2
requested string required

Requested three-digit permission template, optionally prefixed by 0; special bits are not accepted.

allowed: 3 – 4
example: requested=0666
umask string required

Three octal mask digits, optionally prefixed by 0.

allowed: 3 – 4
example: umask=0022
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=requested,umask
exclude list

Return all fields except these (comma-separated).

example: exclude=symbolic
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 4
requested string

Canonical requested permission template.

example: 0666

umask string

Canonical creation mask.

example: 0022

result string

Requested permissions with masked bits removed.

example: 0644

symbolic string

Nine-character representation of the result.

example: rw-r--r--

Documented examples

Build-generated requests and complete responses
3
Typical file permissions
GET /api/unix-permissions/umask?requested=0666&umask=0022
{
  "data": {
    "requested": "0666",
    "umask": "0022",
    "result": "0644",
    "symbolic": "rw-r--r--"
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/umask",
    "params": {
      "requested": "0666",
      "umask": "0022"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Private directory permissions
GET /api/unix-permissions/umask?requested=0777&umask=0077
{
  "data": {
    "requested": "0777",
    "umask": "0077",
    "result": "0700",
    "symbolic": "rwx------"
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/umask",
    "params": {
      "requested": "0777",
      "umask": "0077"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Group-writable shared file
GET /api/unix-permissions/umask?requested=0666&umask=0002
{
  "data": {
    "requested": "0666",
    "umask": "0002",
    "result": "0664",
    "symbolic": "rw-rw-r--"
  },
  "meta": {
    "endpoint": "unix-permissions",
    "route": "/umask",
    "params": {
      "requested": "0666",
      "umask": "0002"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}

About this API

Coverage & behavior

A deterministic POSIX file-mode calculator. Parse three- or four-digit octal modes, apply a symbolic chmod expression to an existing mode, or calculate the permissions left by a file creation mask.

The symbolic engine supports multiple comma-separated clauses and repeated operations, explicit or omitted ugoa targets, +, - and =, conditional X, class copying (g=u), and set-user-ID, set-group-ID and sticky bits. As specified by POSIX, X inspects the original mode (or isDirectory=true), while omitted target classes use umask when adding or removing ordinary permission bits. An equals operation clears the selected classes before adding unmasked bits. To avoid POSIX-unspecified sticky-bit behavior, every operation containing t requires isDirectory=true and either the exact target a or no target; explicit u, g, o and combined targets are rejected.

The nine-character symbolic output uses lowercase s or t when the corresponding execute bit is present and uppercase S or T when it is absent. This API calculates mode bits only; it does not change files and does not model filesystem-specific ACLs.

Use it for

  • Preview chmod changes safely in deployment and administration tools
  • Explain setuid, setgid and sticky-bit modes in a permissions UI
  • Calculate file creation permissions from an application mode and umask

Frequently asked questions

Does the chmod calculator support capital X?

Yes. X adds execute/search only for a directory or when the original mode already has at least one execute bit, matching POSIX symbolic-mode semantics.

Can symbolic permissions copy another class?

Yes. Expressions such as g=u copy the current user rwx bits into the group class; copy operations are evaluated in sequence.

How are setuid, setgid and sticky bits displayed?

They use s/S in user or group execute positions and t/T in the other execute position, depending on whether execute is also set. Portable sticky-bit changes require isDirectory=true with a+t/a-t/a=t, or the corresponding operation with no target.

Standards & references