Skip to content
noadmin
All guides

For developers · 4 min read

How permission values work

Why permissions is a single number, how it is built, and why you must use 64-bit integers.

Discord represents a set of permissions as one integer. Each permission is a single bit, so its value is a power of two, and a set of permissions is those bits combined with bitwise OR.

text
VIEW_CHANNEL   = 1 << 10 =  1024
SEND_MESSAGES  = 1 << 11 =  2048
EMBED_LINKS    = 1 << 14 = 16384

1024 | 2048 | 16384 = 19456   → permissions=19456

Use BigInt or 64-bit integers

Permissions go past bit 31 (Timeout Members is bit 40, Pin Messages is bit 51). JavaScript's | and & operators truncate numbers to 32 bits, so they silently drop these. Use BigInt, or your library's permission class.
js
// Wrong: truncates to 32 bits
(1 << 40) | 1024 // → 1280

// Right
(1n << 40n) | 1024n // → 1099511628800n

Checking a permission

js
const has = (value, bit) => (BigInt(value) & (1n << BigInt(bit))) !== 0n;

The API returns permission values as strings for the same reason: they can exceed the safe integer range of some languages. Keep them as strings or BigInts end to end.

Keep reading