Social Media User IDs Explained: Cross-Platform Guide
Published
Compare how Facebook, Instagram, TikTok, X and YouTube identify accounts, which identifier formats they use, and why you should store IDs rather than handles.
Every major social platform gives each account two names: a human-readable handle the owner can change, and a machine identifier that never changes. Facebook, Instagram, TikTok and X use numeric IDs; YouTube uses a 24-character string beginning with UC; TikTok uniquely carries two identifiers at once. Store the machine identifier, display the handle.
Definition: what a social media user ID is
A social media user ID is the immutable identifier a platform assigns to an account at creation and uses internally as that account's primary key. It exists because the visible name, the @handle, the display name and the profile photo are all things users expect to be able to change, and a changeable label cannot serve as a database key. The user ID solves that: it is fixed for the life of the account and is never reassigned to a different account, even after the original is deleted. Handles do not share that property, and on several platforms a released handle can be claimed by someone else, which is why handle-based records can silently come to point at the wrong account. User IDs are generally public information rather than secrets, and they confer no access: knowing one does not reveal restricted content, does not enable messaging, and is not a credential. Their value is precision. When you need to be certain which account you mean, the user ID is the only identifier that answers definitively.
Cross-platform comparison
| Platform | Identifier name | Format | Visible in profile URL | Changeable label alongside it | API identifier for third parties |
|---|---|---|---|---|---|
| UID / user ID | Decimal digits, often 15 to 16 | Only in profile.php?id= form |
Vanity username | App-scoped user ID, per application | |
| User ID, also called PK | Decimal digits, length varies by age | No | @username | Instagram account ID, via authorization | |
| TikTok | Numeric user ID and sec_uid |
Digits for the ID, long encoded string for sec_uid |
No | @handle | open_id and union_id, via Login Kit |
| Twitter / X | User ID | Decimal digits, up to 19 on newer accounts | Only in /i/user/ form |
@handle, reassignable | Numeric user ID, serialized as a string |
| YouTube | Channel ID | 24 characters, UC prefix, base64url-style |
Yes, in /channel/UC... form |
Handle, custom URL, legacy username | Channel ID directly |
Two columns deserve particular attention. The "visible in profile URL" column explains why some lookups are trivial and others are not: YouTube publishes the canonical ID in a URL form anyone can read, while Instagram and TikTok never show it, which is why resolution tools are needed more often for those platforms.
The final column is where the real divergence lies. Three of the five platforms do not hand third-party applications the same identifier that appears in their own internal data. Facebook issues a per-application number, TikTok issues an open_id after user consent, and Instagram works through authorized connections. That design is deliberate: it prevents applications from correlating the same person across unrelated services by matching identifiers.
Facebook: one account, several object types
Facebook's complication is not the ID format but the number of object types sharing the same identifier space. Personal profiles, Pages and Groups each have their own identifiers, each with different API behaviour and different permission rules. A Page ID works for publishing and insights; a profile UID does not, because reading an arbitrary person's timeline is not something Meta permits.
The second complication is app-scoping. Since Graph API v2.0, the user ID an application receives is unique to that application, so the same person appears as different numbers to different apps. This makes bulk-collected Facebook UIDs considerably less useful than vendors of such lists suggest, and it is the leading cause of API calls that fail for no apparent reason.
The details of which identifier goes where are covered in Facebook ID versus Page ID versus Group ID, and the identifier itself in what a Facebook UID is and why it matters. To resolve a profile or Page URL to its numeric identifier, use the Facebook UID finder.
Instagram: the PK, hidden from the interface
Instagram's numeric ID is straightforward in itself. What makes it awkward is that Instagram never displays it. There is no settings screen showing your own ID, and the profile URL carries only the username. The value sits in the data embedded in public profile pages and in API responses.
The field name pk, for primary key, is why developers often say PK rather than user ID. They mean the same number. Instagram's official platform works through authorized professional accounts rather than open lookup, so an integration that needs data about accounts which have not authorized you has limited compliant options.
Practical methods are set out in the guide to finding an Instagram user ID, and the Instagram UID finder handles the resolution step for public accounts.
TikTok: the one platform with two identifiers
TikTok is the outlier and the source of most confusion in this subject. It carries a numeric user ID and a separate sec_uid, an encoded alphanumeric string, and both refer to the same account at the same time. They are not alternative names for one value. Different endpoints accept different ones, and supplying the wrong type typically yields an empty result rather than a clear error, which sends people debugging the wrong problem.
A great deal of published material, including some tool interfaces, labels a sec_uid as a "user ID". That is wrong and it matters: a column filled with a mix of both values is unusable. If you store TikTok identifiers, name the fields explicitly so the type is never in doubt.
On top of that, TikTok's official developer platform uses neither value. Login Kit issues an open_id scoped to your application, plus a union_id for linking a person across apps you own. So TikTok effectively has four identifier types in circulation, which is three more than most platforms. The distinctions are laid out in TikTok user ID versus sec_uid, and the TikTok UID finder resolves a handle without manual source inspection.
Twitter/X: the simplest model, with one coding trap
X has the cleanest arrangement: one numeric user ID per account, one @handle, no per-application scoping. The ID is permanent, the handle is not, and handles are reassignable after release, which makes handle-based records capable of pointing at an entirely different account without anything appearing broken.
The trap is technical rather than conceptual. X serializes identifiers as strings in API responses because the values exceed the range JavaScript numbers represent exactly. Parse one as a number and it rounds, producing an identifier that refers to nothing. Handle them as strings end to end. See the explainer on Twitter/X user IDs for the full picture, and the Twitter/X UID finder for lookups.
YouTube: a string, not a number
YouTube breaks the pattern by using a 24-character identifier with a UC prefix rather than an integer. It also carries the most historical baggage: handles in @name form, older custom URLs at /c/Name, and legacy usernames at /user/Name all still exist in the wild, and only the channel ID is guaranteed to work for every channel forever.
YouTube is also the most transparent of the five, because it publishes the canonical /channel/UC... URL in every channel page's markup, and channel owners can read the ID directly from YouTube Studio's advanced settings. Details are in the guide to finding a YouTube channel ID, and the YouTube channel ID finder resolves handles and custom URLs.
Practical rules that apply across all five platforms
A handful of habits prevent most of the problems described above.
- Store the machine identifier as your key, the handle as a display field. This single change prevents silent record drift as people rename themselves.
- Name the field by its exact identifier type.
tiktok_sec_uidcannot be confused withtiktok_numeric_uid, whiletiktok_idwill be filled with both over time. - Treat identifiers as strings in code. X requires it, and the discipline costs nothing on the other platforms.
- Prefer the official API for anything production-facing. Internal endpoints change without notice and carry terms-of-service questions.
- Do not expect identifiers to unlock private content. They are references, not credentials, on every platform here.
That last point is worth closing on because it is widely misrepresented. An identifier tells you which account. The platform's permission model, not your knowledge of a number, decides what you can see. Where an account has been made private or protected, the honest position is that its data, and often its identifier, is not available to you.
The tools collected on 2uid.net cover resolution for all five platforms, and the blog index holds the rest of this series. The site also offers a 2FA code generator for TOTP secrets, which is unrelated to identifiers but often useful to the same audience managing multiple platform accounts. For the underlying standard there, the authoritative reference is RFC 6238, which specifies TOTP.
Frequently asked questions
Do social media user IDs mean the same thing on every platform?
Conceptually yes, in detail no. Every platform has a permanent machine identifier behind a changeable handle, but the format differs, YouTube uses a prefixed string rather than a number, and TikTok carries two identifiers at once. Treat each platform's scheme separately.
Can two platforms ever assign the same ID to the same person?
No. Each platform maintains its own identifier space with no coordination between them. An account that exists on Facebook, Instagram and TikTok has three unrelated identifiers, and there is no way to derive one from another.
Which platform is hardest to get an identifier from?
TikTok, because of the two-identifier structure and because neither value appears in the profile URL. Instagram is also awkward since nothing is shown in the interface. YouTube is the easiest, publishing the canonical channel ID in page markup.
Are these identifiers private information?
They are generally public, appearing in page markup and API responses. That said, collecting them in bulk and using them for unsolicited contact runs into platform terms of service and, in many jurisdictions, data protection law, regardless of whether each individual value was public.
Why do some APIs give me a different ID than I expected?
Because several platforms issue application-scoped identifiers to third parties rather than their internal keys. Facebook returns an app-scoped user ID and TikTok returns an open_id, neither of which matches the number you might have found elsewhere. This is a privacy measure rather than a bug.
Should I store the handle at all if the ID is more reliable?
Yes, store both. The handle is the only value a human can verify by looking at a profile, so it is what you need for manual checks and for display. It just should not be your key.
Does changing an account's name affect its ID on any platform?
No, on none of the five covered here. Facebook, Instagram, TikTok, X and YouTube all keep the machine identifier fixed through name and handle changes. That stability is the entire reason the identifier exists.