The Telegram group ID format, channel ID format and user ID format in one place: why a channel ID starts with -100, which number range is which kind of chat, and a converter between the Bot API chat_id, the MTProto ID and t.me/c links.
1 … 1,099,511,627,775
−1 … −999,999,999,999
−1,000,000,000,001 … −1,997,852,516,352
−1,997,852,516,353 … −2,002,147,483,648
−2,002,147,483,649 … −4,000,000,000,000
Bot API chat_id ↔ MTProto ID ↔ private message link. Type in any field. Nothing leaves your browser.
Channel / supergroup. −(10¹² + MTProto channel ID). This is the −100 prefix.
From Telegram's own “Bot API dialog IDs” page.
| Kind | From | To |
|---|---|---|
| User | 1 | 1099511627775 |
| Group | -999999999999 | -1 |
| Channel | -1997852516352 | -1000000000001 |
| Secret chat | -2002147483648 | -1997852516353 |
| Monoforum | -4000000000000 | -2002147483649 |
As documented by Telegram (core.telegram.org/api/bots/ids). “MTProto ID” is what TDLib, Telethon, Pyrogram and t.me/c links use.
Look up a public chat's IDDecode a message linkIDs of private chats and people
Telegram has two APIs. MTProto, used by the apps and by libraries such as Telethon, Pyrogram and TDLib, gives users, groups and channels separate number spaces, all positive. The Bot API needs one number per chat, so it maps them into one range by sign and offset.
-123456789.-1001234567890. The -100 in front is that offset written out.A Telethon script prints a channel’s ID as 1234567890. Your bot needs -1001234567890. A message link from the same channel reads t.me/c/1234567890/45, using the MTProto form again. Type any of the three into the converter and the others fill in.
Upgrading a basic group to a supergroup creates a new chat in the channel range. The last update from the old group carries migrate_to_chat_id with the new -100 ID, and the old ID stops working. Bots that stored the old one get “chat not found” from then on.
Use a 64-bit integer, or a string in systems that cannot hold one. A JavaScript number holds them exactly, because they stay below 2 to the power of 52.
It marks a channel or supergroup. The Bot API ID is −(1,000,000,000,000 + the channel's MTProto ID), so the digits “100” followed by the channel's own number appear after the minus sign.
Write −100 in front of it: MTProto channel ID 1234567890 becomes chat_id −1001234567890. To go back, remove the −100. The converter on this page does both directions.
No. −1 to −999,999,999,999 are basic groups. Channels and supergroups are −1,000,000,000,001 to −1,997,852,516,352. A positive ID is always a user or a bot.
A basic group that is upgraded to a supergroup gets a new ID in the channel range (−100…). The update that announces it carries migrate_to_chat_id with the new value; the old ID stops working.
No. User IDs go up to 1,099,511,627,775 and channel IDs beyond −10¹². Store chat and user IDs as 64-bit integers (or as strings in JSON-only systems); a double-precision float holds them exactly, since they stay below 2⁵².
By the range. A negative ID without the -100 prefix is a basic group. A negative ID starting with -100 is a channel or a supergroup; the Bot API does not distinguish those two by number, getChat’s type field does.
The number the Telegram apps and user-account libraries use internally. For users it equals the Bot API ID; for groups and channels it is the Bot API ID without the sign and the offset.