Snowflake ID decoder
What is a Snowflake Id Decoder?
Snowflake IDs are 64-bit unique identifiers invented by Twitter and now used by Discord, Instagram, Mastodon and many distributed systems. They can be generated on many servers without coordination, are roughly sortable by time, and contain the creation timestamp. This decoder extracts that timestamp and the other fields.
How to use it
- Paste a Snowflake ID, such as a Discord message, user or server ID, or a tweet ID.
- Choose the platform, because each uses a different epoch.
- Read the creation date and the internal fields.
Structure of a Snowflake
- 41 bits: milliseconds since a custom epoch.
- 10 bits: machine identifier (Discord splits this into 5 bits worker ID and 5 bits process ID).
- 12 bits: sequence number, allowing 4,096 IDs per millisecond per machine.
Epochs: Twitter uses 1288834974657 (4 November 2010); Discord uses 1420070400000 (1 January 2015).
Worked example
Discord ID 175928847299117063: shift right by 22 bits to get 41944705796, add the Discord epoch 1420070400000 to get 1462015105796 ms, which is 2016-04-30 11:18:25.796 UTC. This is the example used in Discord's developer documentation.
Why decode Snowflakes?
- See when a Discord account or server was created.
- Find the exact time of a tweet or message from its URL.
- Debug ordering and ID generation in your own distributed systems.
Developer note
Snowflakes exceed JavaScript's safe integer limit of 2^53, so always handle them as strings or BigInt. Parsing them as numbers silently changes the last digits, which is why Twitter's API returns id_str.
Frequently Asked Questions
How do I get the date from a Discord ID?
Shift the ID right by 22 bits, add the Discord epoch 1420070400000 and convert the milliseconds to a date.
Why do Twitter and Discord dates differ for the same number?
They use different epochs, the starting point from which milliseconds are counted.
Why should Snowflake IDs be treated as strings in JavaScript?
They are larger than the largest safe JavaScript number, so storing them as numbers loses precision.
Are Snowflake IDs sorted by time?
Roughly. The timestamp is in the highest bits, so newer IDs are larger, although IDs from the same millisecond on different machines may interleave.