Convert Twitter Snowflake ID to Unix Timestamp

Enter Twitter/X snowflake ID to extract Unix timestamp

Unix Timestamp (milliseconds)
Unix Timestamp (seconds)
Tweet Posted On
ISO 8601 Format

Last updated

Twitter / X Snowflake IDs

Twitter uses Snowflake IDs — 64-bit integers that encode a timestamp, worker ID, and sequence number. This means every tweet, user, and DM has an ID that contains the exact millisecond it was created. Decoding a tweet ID reveals when it was posted, which is useful for research, archiving, and timeline reconstruction.

Snowflake ID Structure

BitsFieldDescription
63–22 (42 bits)TimestampMilliseconds since Twitter epoch (Nov 4, 2010)
21–17 (5 bits)Datacenter ID0–31
16–12 (5 bits)Worker ID0–31
11–0 (12 bits)Sequence0–4095 per millisecond per worker

Decoding a Twitter Snowflake ID

JavaScript
// Twitter epoch: November 4, 2010 01:42:54 UTC
const TWITTER_EPOCH = 1288834974657n;

function decodeTwitterId(idStr) {
  const id = BigInt(idStr);

  // Extract timestamp (top 42 bits)
  const timestamp = (id >> 22n) + TWITTER_EPOCH;
  const date = new Date(Number(timestamp));

  // Extract datacenter and worker IDs
  const datacenterId = (id & 0x3E0000n) >> 17n;
  const workerId     = (id & 0x1F000n)  >> 12n;
  const sequence     = id & 0xFFFn;

  return {
    id: idStr,
    timestamp: Number(timestamp),
    date: date.toISOString(),
    datacenterId: Number(datacenterId),
    workerId: Number(workerId),
    sequence: Number(sequence)
  };
}

// Example: decode tweet ID 1234567890123456789
console.log(decodeTwitterId('1234567890123456789'));

Frequently Asked Questions

Enter the Twitter snowflake ID and click Convert. The tool extracts the embedded timestamp using the formula: (id >> 22) + 1288834974657, returning the Unix timestamp in milliseconds.