Snowflake ID decoder and generator

Read the date, worker and sequence inside Discord, Twitter/X, Instagram or Mastodon IDs, or your own layout with a custom epoch, and generate an ID

loading Snowflake ID decoder and generator
About this tool

What is a Snowflake ID decoder?

A Snowflake ID is a 64-bit number that a distributed system can create on many machines without asking a central database. Twitter (now X) introduced the design, and Discord, Instagram, Mastodon and many other services use their own versions. The trick is that the number is built from parts. The highest bits are the time in milliseconds since a chosen start date (the epoch). Next come a few bits that say which machine, worker or shard made the ID, and the lowest bits are a sequence that counts IDs made in the same millisecond. Because time comes first, IDs sort by creation time, and because the parts are fixed width you can take them apart again with a few shifts.

This tool does that. Choose the platform, paste one or many IDs, and it shows the creation time in UTC with milliseconds, your local time, the Unix time, each field with its meaning, and the full bit layout. Switch to Generate to build an ID for any moment, for tests or to filter by date: IDs created after a given time are simply greater than the ID for that time. For anything not in the list, pick Custom layout and set your own epoch and number of bits for time, the two fields and the sequence.

Everything runs in your browser with exact 64-bit arithmetic, so no digit is lost. Two cautions. The time is what the creating machine believed, so it is not proof of when something happened. And the epoch is a convention: the same number means different dates on different platforms, which is why the tool shows a warning when the result falls before 2006 or in the future and suggests the platform it might come from. Snowflakes are not secret and are easy to guess, so do not use them as tokens. For random identifiers see the UUID generator.

How to use it

  1. Open the page. It loads the example from the Discord documentation, 175928847299117063, with the Discord layout selected.
  2. Choose the platform: Discord, Twitter / X, Instagram, Mastodon or Custom layout. The right epoch and bit split are applied for you.
  3. Paste your IDs, one per line. For one ID you see the date, the Unix time, the fields and the bits. For several you get one row each.
  4. Read the verdict. If the date is before 2006 or in the future the tool tells you this is probably the wrong platform and lists the ones that fit.
  5. For a custom layout, type the epoch (an ISO date or milliseconds) and the number of bits of each part. The four parts must add up to 64 bits or less.
  6. Switch to Generate, type a date (or press Now), set the worker, process or sequence values and how many IDs you want, then copy them.

Examples

The Discord documentation example

175928847299117063
  time:      2016-04-30T11:18:25.796Z
  worker:    1
  process:   0
  increment: 7

Discord counts from 2015-01-01 (epoch 1420070400000). The time is (id >> 22) + 1420070400000, then 5 bits of worker, 5 bits of process and 12 bits of increment.

The first of 2024 on Twitter / X

Generating for 2024-01-01T00:00:00Z with all fields at zero gives 1741610183685046272. Twitter counts from 1288834974657, which is 4 November 2010 at 01:42:54.657 UTC. The layout is 41 bits of time, 5 of datacenter, 5 of worker and 12 of sequence.

Mastodon is plain Unix time

Mastodon uses the Unix epoch and a 16-bit sequence. For the same instant the ID is 111677748019200000, which is just the milliseconds shifted left by 16 bits.

Filtering by date

To find records created after midnight, generate the ID for that moment with fields at zero and use id >= that value in a query. No date column is needed because the IDs are time ordered.

Common mistakes

  • Choosing the wrong platform. The same number gives different dates with different epochs. If the date looks absurd, change the platform.
  • Reading the ID as a floating-point number. In JavaScript and many spreadsheets IDs above 2^53 lose digits. Keep them as text, and use this tool, which works with exact integers.
  • Pasting an ID with spaces or letters. A snowflake is decimal. The tool names the character it cannot read.
  • Forgetting that time is the creator's clock. If the machine clock was wrong the ID is wrong too. Do not use it as proof.
  • Expecting a Twitter ID to hold a user. The worker and datacenter fields identify the machine that made the post, not the author.
  • Custom layouts that do not add up. Time and sequence need at least one bit, and the four parts together must not exceed 64.

Frequently asked questions

Can I get the date from a tweet or Discord ID?

Yes. Choose Twitter / X or Discord and paste the ID. The date shown is when the ID was created, to the millisecond.

Does the tool call any API?

No. The decoding is arithmetic on the number itself, so nothing is sent and the IDs never leave your browser.

What is the epoch?

The start date that the time part counts from. Discord uses 1 January 2015 and Twitter uses a moment in November 2010. Counting from a recent epoch gives the time bits more years to last.

Why do IDs sort by time?

Because the time sits in the highest bits. A later ID is always a bigger number, apart from the small disorder between machines whose clocks differ.

How do I turn the date into other formats?

Press the Date converter button under the result, or open the date converter, to see the same instant as an ISO string, Unix time and more.

Is the ID a secret?

No. It reveals when it was made and is easy to enumerate. For random tokens use the token generator.

Report a problem