twitterapi.io is an independent third-party service. Not affiliated with X Corp.

Free · no login · both directions

Twitter ID finder: username to user ID, and ID to username

Every X account has a numeric user ID that never changes, even when the username does. Enter a username to get its ID, or paste an ID to see which account it belongs to today. The result comes from the live profile, with a copy button for the ID and for a link that keeps working after a rename.

@

Try , , · 20 free lookups a day

How the lookup works

  • Username → ID. We read the public profile for that username and return the ID X has on record. You can type jack, @jack or paste the profile link.
  • ID → username. We look the account up by its ID and return the username it uses now. If the account was renamed since you saved the ID, you get the new name.
  • When there is nothing to return. A username that does not exist is reported as not found, and a suspended or unavailable account as exactly that. A lookup by ID that finds nothing can mean the account was deleted or is suspended; X does not say which. The tool does not guess.

Protected accounts work too: the ID and the username are public even when the posts are not.

What a Twitter user ID is

The username is a label the owner can change in Settings. The user ID is the account itself as far as X is concerned: it is assigned once, at sign-up, and stays for the life of the account. Early accounts have short IDs (12 is @jack). Newer accounts have long ones, 18 or 19 digits, in the same format X uses for post IDs.

Two accounts can hold the same username at different times, one after the other. They never share an ID. That is the reason anything that has to keep pointing at the same account should store the ID.

When you need the ID instead of the username

JobWhy the ID
Storing accounts in a databaseA username can be changed or handed to someone else. Key your rows on the ID and keep the username as a display field you refresh.
Following a renamed accountIf an account you track changes its handle, the old username stops resolving or points at a different account. The ID still leads to the same one.
Calling an APISeveral endpoints take an ID rather than a username, for example batch profile lookups and follow or unfollow actions.
Sharing a link that will not breakx.com/i/user/<ID> opens the profile under whatever username it has today.

Finding an ID without a tool

  • Your own account. Request your data archive from X (Settings, Your account, Download an archive of your data). The account file in the archive lists your account ID next to your username. It takes X a day or so to prepare the archive.
  • Someone else's account. X does not show the user ID anywhere on a profile page, so there is no reliable way to read it by eye. A lookup like the one above, or an API call, is the practical route.

Converting a whole list?

The tool is for one account at a time. For a spreadsheet of handles or a column of IDs, the same lookups are two API calls. A username lookup returns the ID in data.id; the batch endpoint takes a comma-separated list of IDs and returns each account's current username. Both are pay-as-you-go, and the batch call gets cheaper per account from 100 IDs per request (see pricing).

import requests

HEADERS = {"X-API-Key": "YOUR_API_KEY"}
BASE = "https://api.twitterapi.io/twitter"

def username_to_id(username: str) -> str | None:
    """One profile lookup. The user object is under data; a missing handle is status "error"."""
    body = requests.get(f"{BASE}/user/info", headers=HEADERS,
                        params={"userName": username}, timeout=20).json()
    data = body.get("data") or {}
    if body.get("status") != "success" or data.get("unavailable"):
        return None                      # not found, or suspended
    return data["id"]

def ids_to_usernames(user_ids: list[str]) -> dict[str, str]:
    """Many IDs in one call. Returns {id: current username}."""
    body = requests.get(f"{BASE}/user/batch_info_by_ids", headers=HEADERS,
                        params={"userIds": ",".join(user_ids)}, timeout=30).json()
    return {u["id"]: u["userName"] for u in body.get("users", [])}

print(username_to_id("XDevelopers"))            # 2244994945
print(ids_to_usernames(["12", "11348282"]))
Get a free API key →

Questions

What is a Twitter user ID?

It is the number X assigns to an account when it is created. The username (the @handle) can be changed at any time; the user ID never changes. Apps, the API and X itself refer to accounts by ID for that reason.

How do I find my own Twitter ID?

Type your username in the tool above. If you prefer not to use a tool, request your X data archive in Settings; the account file inside it lists your account ID next to your username.

Can I find a username from a Twitter ID?

Yes. Switch the tool to ID → username and paste the number. It returns the username the account uses today, so it also tells you what a renamed account is called now.

Does the ID change if the account changes its username?

No. The ID stays the same through username and display-name changes. The link x.com/i/user/ followed by the ID opens the account whatever it is called now, which makes it the safe thing to store.

Is a user ID the same as a tweet ID?

No. A tweet ID identifies one post, a user ID identifies an account. They look alike because newer ones are both long numbers in the same format. To read the date inside a tweet ID, use the tweet ID to date tool.

Is the lookup free? What do you store?

Yes, 20 lookups a day per visitor without signing in, more with a free Google sign-in. We log each lookup (time, the value looked up, result) to prevent abuse; we don't sell or publish them. Results for the same account are reused for up to 15 minutes.

More free X tools