· 5 min read

How Instagram Post Shortcodes Work

Every Instagram post link has a short code in it, like CGGOHDXhhK-. It looks random, but the date the post was made is hidden inside it. This guide shows how to read that date by hand, one step at a time, so you can see exactly what a timestamp checker is doing.

What is a shortcode?

It is the part of a post link after /p/ or /reel/. In instagram.com/p/CGGOHDXhhK-/ the shortcode is CGGOHDXhhK-. It is a short way of writing the post's long numeric ID. Instagram turns the big number into letters, digits, a dash and an underscore so the link stays short.

The example in this guide uses the shortcode CGGOHDXhhK- (the link instagram.com/p/CGGOHDXhhK-/). It comes from a 2021 technical write-up that published the post's ID and its stored time, so we can check our decoding against it.

Step 1: turn the letters into numbers

The shortcode uses 64 symbols. Each symbol stands for a number from 0 to 63:

Capital and small letters are different symbols, so the code is case-sensitive. For our example:

SymbolCGGOHDXhhK-
Number26614732333331062

Step 2: read it as a base-64 number

We read these numbers the same way we read the digits of 345 (3×100 + 4×10 + 5), except every place is worth 64 times the one on its right instead of 10 times. Start at zero. For each symbol, multiply what you have by 64 and add the symbol's number. After all 11 symbols you get the post ID:

2415680307434230462

Step 3: find the time inside the ID

Inside the computer, that ID is a 64-bit number. The first 41 bits hold a time. The last 23 bits hold other internal values.

41 bits: time
23 bits: other

The 64 bits of the example ID. Not drawn to exact scale.

Instagram's engineering team described this design in a 2012 post, Sharding & IDs at Instagram: each ID is 64 bits, and the first 41 bits are a time in milliseconds. The 2021 research write-up credited below used the same layout to decode real posts. The decoder only needs the time part.

To get the time part, drop the last 23 bits. That is the same as dividing by 223 (8,388,608) and ignoring the remainder. For our ID, the result is 287,971,533,231. This is a count of milliseconds.

Step 4: add the starting date

That count does not start at 1970. It starts at a date Instagram chose for its IDs and has never published, so researchers estimated it from real posts. In a 2021 study of 1,000 posts, about three in four pointed to 21:07:00 or 21:07:01 UTC on 24 August 2011. Tools, including ours, use 21:07:01.721 UTC, which is 1,314,220,021,721 milliseconds in Unix time. Because the start date is an estimate, a decoded time can be off by about a second. Add the two numbers:

287,971,533,231 + 1,314,220,021,721 = 1,602,191,554,952 milliseconds

Convert that to a date and you get 8 October 2020, 21:12:34.952 UTC. The time stored by that post, as reported in the write-up, was 1,602,191,554 seconds. That is 21:12:34 UTC, the same second.

Check it yourself in Python

ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
shortcode = "CGGOHDXhhK-"

n = 0
for ch in shortcode:
    n = n * 64 + ALPHABET.index(ch)

ms = (n >> 23) + 1314220021721
print(n)   # 2415680307434230462
print(ms)  # 1602191554952  (8 Oct 2020, 21:12:34 UTC)

This is the same calculation the InstaTimestamp checker runs in your browser. The link is not sent to our application server for decoding.

What a shortcode can and cannot tell you

Why a link does not decode

Common questions

Are all shortcodes 11 characters long?

No. Many recent ones are about that long, but older posts can have shorter codes because their ID numbers are smaller. The InstaTimestamp checker accepts codes from 8 to 14 characters.

Does decoding a shortcode contact Instagram?

No. It is arithmetic on the text of a link you already have. It does not log in to anything, and it does not load the post.

Can a private account's post be decoded?

If you have the link, the time part can be decoded. That only gives you a time. It does not let you see the private post.

Why does the calculation start in 2011?

Instagram counts the time inside its IDs from a start date it picked and has never published. Researchers estimated it as 24 August 2011, at about 21:07 UTC. That is why we add that date's Unix time at the end of the calculation.

Sources and further reading

This guide builds on the work below. The explanations are written in our own words, and the worked examples were checked against the sources.

Try it right now — it's free

Paste any Instagram post or reel URL and get the exact timestamp in seconds.

Check a post →

IT
InstaTimestamp
Independent tools and guides for understanding Instagram timestamps and image sizing.