Guides

Discord permissions integer

A Discord permissions integer is a bitfield, one number that encodes a set of permissions, where each bit is a single permission. This guide explains what the number means, how the flags combine, and how to build one by hand or with a calculator.

How the bitfield works

  • Every permission is a distinct power of two, a single bit set to 1.
  • Combining permissions means a bitwise OR. Since the bits never overlap, that is the same as adding the values.
  • The result is returned as a string because the value can exceed 253, beyond exact JavaScript number precision.
  • In code, parse it with BigInt before doing any & / | math.

Common permission values

  • Create Invite = 1 (1 << 0)
  • Kick Members = 2 (1 << 1)
  • Ban Members = 4 (1 << 2)
  • Administrator = 8 (1 << 3)
  • Manage Channels = 16 (1 << 4)
  • Send Messages = 2048 (1 << 11)
  • Embed Links = 16384 (1 << 14)
  • Attach Files = 32768 (1 << 15)
  • Manage Messages = 8192 (1 << 13)

Worked example

  • You want a role that can send messages, embed links, and attach files.
  • Send Messages (2048) | Embed Links (16384) | Attach Files (32768)
  • = 51200, the permissions integer you pass when creating the role.
  • To read a value back, check each bit: (BigInt(perms) & 2048n) !== 0n means Send Messages is granted.

How Discord resolves effective permissions

  • Start from the @everyone role's base permissions.
  • OR in every role the member has.
  • If Administrator is set, the member has all permissions. Stop here.
  • Otherwise apply channel overwrites: denies first, then allows, for @everyone, then roles, then the member.
  • The guild owner always has every permission regardless of the bitfield.

FAQ

What is a Discord permissions integer?

It is a bitfield, a single number where each bit represents one permission. Discord returns and accepts it as a string because the value can exceed the range a normal 53-bit number holds. Each permission is a distinct power of two, so combining permissions means OR-ing (adding) their values.

How do I calculate a Discord permission integer?

Take the bit value of each permission and combine them with a bitwise OR. Because every permission is a unique power of two, that is the same as adding them. Send Messages (2048) + Embed Links (16384) + Attach Files (32768) = 51200. The permissions calculator does this for you.

What does the Administrator permission do?

Administrator (value 8) grants every permission and bypasses all channel-level overwrites. Give it only to fully trusted roles.

Why is the value a string, not a number?

The bitfield can exceed 253, the largest integer JavaScript represents exactly, so Discord serializes it as a string. Parse it with BigInt before bitwise math.