📸 Instagram Shortcode to ID Converter

Convert Instagram shortcodes to numeric media IDs instantly

Convert Shortcode to ID

📌 Try these examples:
INSTAGRAM SHORTCODE
📊 MEDIA ID
📅 CREATION DATE
🔗 INSTAGRAM URL

Instagram Shortcode to ID Converter

Convert Instagram shortcodes to numeric media IDs. Every Instagram post has both a shortcode (used in URLs) and a numeric ID (used in the API). This tool converts between them instantly.

How to Get Instagram Shortcodes

From Instagram URLs:

instagram.com/p/CxOWiQNphlr/

The shortcode is the alphanumeric string between /p/ and the trailing slash.

From Reel URLs:

instagram.com/reel/CxOWiQNphlr/

Reels use the same shortcode format as regular posts.

What is Instagram Shortcode?

Instagram shortcodes are base64-encoded identifiers that represent numeric media IDs. They're shorter and more URL-friendly than the full numeric IDs, making them perfect for sharing links.

Code Examples

JavaScript
// JavaScript - Instagram Shortcode to ID
function shortcodeToMediaId(shortcode) {
  const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
  let mediaId = 0n;
  
  for (let i = 0; i < shortcode.length; i++) {
    const char = shortcode[i];
    const index = alphabet.indexOf(char);
    if (index === -1) throw new Error('Invalid shortcode');
    mediaId = mediaId * 64n + BigInt(index);
  }
  
  return mediaId.toString();
}

// Example usage
const mediaId = shortcodeToMediaId('CxOWiQNphlr');
console.log(mediaId); // 2792188468659568875

// Extract timestamp (Instagram uses Twitter's epoch)
const INSTAGRAM_EPOCH = 1288834974657n;
const timestamp = Number((BigInt(mediaId) >> 22n) + INSTAGRAM_EPOCH);
console.log(new Date(timestamp)); // Post creation date
Python
# Python - Instagram Shortcode to ID
def shortcode_to_media_id(shortcode):
    alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
    media_id = 0
    
    for char in shortcode:
        index = alphabet.index(char)
        media_id = media_id * 64 + index
    
    return media_id

# Example usage
media_id = shortcode_to_media_id('CxOWiQNphlr')
print(media_id)  # 2792188468659568875

# Extract timestamp
from datetime import datetime
INSTAGRAM_EPOCH = 1288834974657
timestamp = ((media_id >> 22) + INSTAGRAM_EPOCH) / 1000
print(datetime.fromtimestamp(timestamp))  # Post creation date

Use Cases

Instagram Shortcode Format

Character Set: A-Z, a-z, 0-9, - (dash), _ (underscore)

Length: Typically 11 characters

Encoding: Base64 variant (URL-safe)

Case Sensitive: Yes - 'A' and 'a' are different

Frequently Asked Questions

Q: Can I convert media ID back to shortcode?

A: Yes! The conversion is reversible. Use our Instagram ID to Shortcode converter for the reverse operation.

Q: Do reels have different shortcodes?

A: No, Instagram reels use the same shortcode format as regular posts. The conversion process is identical.

Q: Can I get the post creation date from the ID?

A: Yes! Instagram media IDs contain timestamps. This tool automatically extracts and displays the creation date.

Q: Is this tool free?

A: Yes, completely free with no signup required. All processing happens in your browser.

🔗 Related Snowflake ID Tools

🐦 Twitter Snowflake Decoder 💬 Discord Snowflake Decoder 📸 Instagram Snowflake Decoder

📚 Learn More About Snowflake IDs

How to Decode Tutorial Real ID Examples Snowflake Calculator ID to Timestamp