How Discord Snowflake Bit Shifting Encodes Timestamps

Written by Raheel Ikram | Updated December 5, 2026 | Reading time: 5 minutes

When building a Discord bot or moderating a large community, the Discord API often gives you an 18-digit ID like 175928847299117063 without a separate creation date field. Every Discord user, message, channel, and server ID actually stores its exact millisecond creation time inside its upper binary bits.

Inside the 64-Bit Discord Snowflake Layout

Discord adapts Twitter's Snowflake format into an unsigned 64-bit integer split into four bit segments. You can verify this structure in the Discord Developer Reference.

64-bit Discord Snowflake bit map showing 42 bits timestamp, 5 bits worker ID, 5 bits process ID, and 12 bits increment
Figure 1: Bit segments inside every Discord Snowflake ID.
Bit RangeSizePurpose
Bits 63 to 2242 bitsMilliseconds elapsed since Discord Epoch (2015-01-01T00:00:00Z)
Bits 21 to 175 bitsInternal Worker ID (0 to 31)
Bits 16 to 125 bitsInternal Process ID (0 to 31)
Bits 11 to 012 bitsIncrement counter per process per millisecond (0 to 4095)

The Discord Epoch Constant: 1420070400000

Instead of starting at 1970, Discord begins counting at January 1, 2015 at 00:00:00.000 UTC. That date equals 1,420,070,400,000 Unix milliseconds. Starting at 2015 lets 41 timestamp bits last roughly 69 years from 2015 (until the year 2084) before rolling over.

Code Example: Decode and Generate Snowflakes in Python

Shift the integer right by 22 bits to discard the worker, process, and increment bits, then add 1420070400000:

from datetime import datetime, timezone

DISCORD_EPOCH_MS = 1420070400000
snowflake_id = 175928847299117063

timestamp_ms = (snowflake_id >> 22) + DISCORD_EPOCH_MS
created_at = datetime.fromtimestamp(timestamp_ms / 1000, tz=timezone.utc)
print(created_at.isoformat()) # 2016-04-30T11:19:17.007000+00:00
About the Author: Raheel Ikram

Creator of Timestamp Converter, writing practical guides on timekeeping, SQL schema design, and web utilities. Read full bio.