Twitter/X User ID Explained: The Number Behind a Handle
Published
Every X account has a permanent numeric user ID behind its @handle. Learn why it survives renames, how the X API uses it, and what the x.com move changed.
A Twitter/X user ID is the numeric identifier assigned to an account at signup, separate from the @handle shown on the profile. The handle can be changed at any time; the numeric ID cannot. X's API addresses accounts by this number, and it is the only identifier that reliably refers to the same account over the long term.
Definition: the numeric account ID on X
The Twitter/X user ID is the decimal integer the platform assigns to an account when it is registered, and it functions as that account's permanent internal key. Its length reflects account age: accounts from the platform's early years carry short numbers, sometimes only a handful of digits, while accounts created after the platform migrated to larger identifier spaces carry long ones, commonly eighteen or nineteen digits. Nothing the account holder does changes it. Renaming the @handle, changing the display name, altering the email address, going private by protecting tweets, deactivating temporarily and returning, or upgrading to a paid tier all leave the numeric ID identical. Because handles on X are released for reuse after being changed or after an account is deleted, the numeric ID is the only identifier that distinguishes one account from a later occupant of the same handle. It is public information, visible in API responses and in page markup, and it grants no access to protected content.
Why the ID survives handle changes and the handle does not
Handles on X are short, memorable and limited to fifteen characters, which makes them scarce and therefore valuable. Users change them when they rebrand, when they want a shorter one, or when they abandon a handle tied to an old project. The platform permits this freely, and the previous handle goes back into the pool.
That last detail is what makes handle-based records dangerous rather than merely fragile. If you record an account as @someproject and that handle is later claimed by an unrelated party, your record now points at a stranger while appearing perfectly valid. Nothing breaks visibly. The link resolves, a profile loads, and the mistake is invisible until someone notices the content does not match.
Storing the numeric ID eliminates that failure mode. The URL form x.com/i/user/1234567890 resolves to whichever account holds that ID, regardless of its current handle. That is the reference you want in any record intended to outlive the next rebrand.
Comparison: handle, numeric ID, and display name
| Property | Numeric user ID | @handle (username) | Display name |
|---|---|---|---|
| Format | Decimal digits | Up to 15 characters, letters, digits, underscore | Free text, including emoji |
| Changeable by the owner | No | Yes, at will | Yes, at will |
| Unique at any moment | Yes | Yes | No, duplicates allowed |
| Reassignable to another account | No | Yes, once released | Always shareable |
| Shown in the profile URL | No, only in /i/user/ form |
Yes | No |
| Used by the X API | Yes, as the canonical reference | Yes, as a lookup convenience | No |
The row about reassignment is the one that matters for anyone keeping records. A numeric ID is never recycled; a handle frequently is.
The twitter.com to x.com transition
The domain change from twitter.com to x.com altered URLs without altering identifiers. An account's numeric ID is the same value it was before the rename, and so is its handle. Old twitter.com links redirect, and both domains refer to the same accounts and the same posts.
The practical implications are mostly cosmetic but worth knowing. Links you stored as twitter.com/... still work through redirection, though canonical URLs now use x.com. Post IDs, which are a separate identifier type from user IDs, were likewise unaffected: a post URL of the form x.com/handle/status/1234567890123456789 carries the post ID at the end, and that number did not change with the domain.
One thing did change in a way that affects anyone who built integrations: API access terms and pricing were substantially revised, and endpoints that were once freely available moved behind paid tiers. That is a commercial change rather than an identifier change, but it determines what approach is available to you.
How the X API refers to users
X's current API, documented at the official X API documentation, exposes user lookup in two shapes. You can request a user by ID, or by username, and both return the same user object containing the numeric ID, the username, the display name and whatever public fields you request.
The convention in responses is that the numeric ID is serialized as a string rather than a number. This is deliberate, and ignoring it causes a real bug: identifiers on X exceed the range that JavaScript's default number type can represent exactly, so parsing one as a number silently rounds it and produces an ID that does not exist. Any code handling X identifiers should treat them as strings end to end. The same caution applies to post IDs, which are longer still.
Access requires authentication and an approved project, and the tier you hold determines which endpoints and what request volume you get. For a simple one-off question such as "what is the numeric ID behind this handle", setting up API access is disproportionate effort, which is why lookup tools exist. The Twitter/X UID finder on 2uid.net resolves a handle to its numeric ID without an API project.
When you actually need the numeric ID
Four situations come up regularly. Building anything on the API means handling user IDs, since that is the canonical reference in request parameters and response payloads. Maintaining monitoring lists of accounts means storing IDs so the list survives rebrands. Verifying identity in a dispute means checking the ID, because an impersonator can take a vacated handle but cannot take the ID that was behind it. And migrating data between tools means mapping accounts by ID, since handle-based mapping drifts.
There is a fifth, quieter case: archival research. If you are looking at older material that references an account by handle, the handle may now belong to someone else entirely. Resolving the historical reference requires the numeric ID, and if you only have the handle there may be no reliable way to recover which account was meant.
For how this compares with other platforms, note that X's model is the simplest of the major networks: one numeric ID, one handle, nothing scoped per application. Facebook adds separate object types for profiles, Pages and Groups, TikTok adds a second encoded identifier alongside the numeric one, and YouTube uses a prefixed string rather than an integer. The cross-platform overview covers the lot.
Frequently asked questions
Where can I see the numeric user ID on an X profile?
Not in the interface. X displays the handle and display name but not the numeric ID. It appears in API responses, in page markup, and in x.com/i/user/ URLs, so a lookup tool or page source inspection is needed to read it.
Does the user ID change when someone changes their @handle?
No. The numeric ID is permanent for the life of the account. Changing the handle, the display name, or the email address does not affect it, which is exactly why it is the identifier worth storing.
Why is the user ID returned as a string in the API?
Because the values exceed what standard JavaScript numbers can represent exactly. Parsing an X identifier as a number rounds it and yields an ID that refers to nothing. Keep identifiers as strings throughout your code.
Did the x.com rename change any user IDs?
No. The domain change affected URLs only. User IDs, post IDs and handles all carried over unchanged, and old twitter.com links redirect to their x.com equivalents.
Can I find the numeric ID of a protected account?
Treat it as unavailable. Protected accounts restrict what the platform serves about them, and claims that a tool retrieves identifiers for locked accounts are not something to rely on. Where an account has chosen restriction, respect it.
Is the long number in a post URL the user ID?
No, that is the post ID, which identifies a single post rather than an account. The account in that URL is identified by the handle that precedes /status/.
What is the fastest way to get the ID behind a handle?
Paste the handle or profile URL into the 2uid.net Twitter/X UID finder. If you already have API access, a user lookup by username returns the same value along with the rest of the user object.