ArticleslgStudy

computer science

Snowflake ID

Snowflake ID is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Snowflake ID rather than just read about it. In short: Snowflake IDs, or snowflakes, are a form of unique identifier used in distributed computing. The format was created by X (formerly Twitter) and is used for the IDs of tweets.

Snowflake ID — main illustration
Snowflake ID — illustration

Key takeaways

  • Snowflake ID belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Snowflake ID to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Snowflake ID from memory before moving on to harder problems.

Reference excerpt

Snowflake IDs, or snowflakes, are a form of unique identifier used in distributed computing. The format was created by X (formerly Twitter) and is used for the IDs of tweets. It is popularly believed that every snowflake has a unique structure, so they took the name "snowflake ID". The format has been adopted by other companies, including Discord and Instagram. The Mastodon social network uses a modified version.

Format A snowflake is composed of 64 bits:

The highest-order bit is always 0. The next 41 bits encode a timestamp, representing milliseconds since the chosen epoch. The next 10 bits represent a machine ID, preventing clashes. The next 12 more bits represent a per-machine sequence number, to allow creation of multiple snowflakes in the same millisecond. Only 63 bits are variable, so that a non-negative number can be processed readily as a 64-bit signed integer; the final number is generally serialized textually as a decimal number. Snowflakes are sortable by time, because they are based on the time they were created. Additionally, the time a snowflake was created can be calculated from the snowflake. This can be used to get snowflakes (and their associated objects) that were created before or after a particular date.

Example A tweet produced by @Wikipedia in February 2025 has the snowflake ID 1888944671579078978. The number may be converted to binary as 0001 1010 0011 0110 1110 0001 0010 1011 1011 0101 11 | 01 0110 1000 | 0001 0100 0010, with pipe symbols denoting the three parts of the ID.

The first 41 (+ 1 top zero bit) bits convert to decimal as 450359504599. Add the value to the X Epoch of 1288834974657 (in Unix time milliseconds), the Unix time of the tweet is therefore 1739194479256: February 10, 2025 13:34:39.256 UTC. The middle 10 bits 01 0110 1000 are the machine ID. The last 12 bits 0001 0100 0010 decode to 322, meaning this tweet is the 322'nd snowflake processed this millisecond.

Usage The format was first announced by Twitter in June 2010. Due to implementation challenges, they waited until later in the year to roll out the update.

X (formerly Twitter) uses snowflake IDs for tweets, direct messages, users, lists, and all other objects available over the API. The 10-bit machine ID field can be further split into sub-fields by a given implementation. For example, the archived version of the original Twitter snowflake library in Scala splits it into a 5-bit data center ID and a 5-bit worker ID. Discord also uses snowflakes, with their epoch set to 1420070400000, which translates to the zeroth second of the year 2015. Instagram uses a modified version of the format, with 41 bits for a timestamp, 13 bits for a shard ID, and 10 bits for a sequence number. Mastodon's modified format has 48 bits for a millisecond-level timestamp, as it uses the UNIX epoch. The remaining 16 bits are for sequence data.

See also Universally unique identifier

References

External links Twitter's reference implementation on GitHub

Worked examples

Example 1 — a first encounter with Snowflake ID

Start with the simplest possible case. Write down what Snowflake ID claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Snowflake ID before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Snowflake ID ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Snowflake ID

In research
Snowflake ID appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Snowflake ID in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Snowflake ID is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer-related introductions in 2010, Distributed data structures, Unique identifiers, so understanding it makes those chapters shorter.
In everyday life
Look for Snowflake ID outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Snowflake ID in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Snowflake ID means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Snowflake ID out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Snowflake ID in simple terms?

Snowflake IDs, or snowflakes, are a form of unique identifier used in distributed computing. The format was created by X (formerly Twitter) and is used for the IDs of tweets.

Why does Snowflake ID matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Snowflake ID?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Snowflake ID.

Tags

  • Computer-related introductions in 2010
  • Distributed data structures
  • Unique identifiers
  • X (social network)

Keep exploring