Telegram ID format

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.

Scale is compressed (log of the magnitude) so all ranges fit. Hatched = reserved for secret chats, which bots never see. Look up an ID above and it is pinned here. Ranges from Telegram's Bot API dialog IDs page.
User or bot

1 … 1,099,511,627,775

Basic group

−1 … −999,999,999,999

Channel / supergroup

−1,000,000,000,001 … −1,997,852,516,352

Secret chat

−1,997,852,516,353 … −2,002,147,483,648

Channel direct messages

−2,002,147,483,649 … −4,000,000,000,000

Converter

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.

Every ID range

From Telegram's own “Bot API dialog IDs” page.

KindFromTo
User11099511627775
Group-999999999999-1
Channel-1997852516352-1000000000001
Secret chat-2002147483648-1997852516353
Monoforum-4000000000000-2002147483649

Conversion rules

As documented by Telegram (core.telegram.org/api/bots/ids). “MTProto ID” is what TDLib, Telethon, Pyrogram and t.me/c links use.

User or botbot_api_id = user_idPositive. The same number in the Bot API and in MTProto.
Basic groupbot_api_id = −chat_idThe MTProto chat ID with a minus sign.
Channel / supergroupbot_api_id = −(1000000000000 + channel_id)−(10¹² + MTProto channel ID). This is the −100 prefix.
Secret chatbot_api_id = secret_chat_id − 2000000000000Secret chats (MTProto ID − 2 × 10¹²). The official Bot API never returns these.
Channel direct messagesbot_api_id = −(1000000000000 + monoforum_id)Direct-message chats of channels (monoforums): −(10¹² + MTProto ID), from their own range.

Why the same chat has two numbers

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.

  • A user or bot keeps its number, up to 1,099,511,627,775.
  • A basic group gets a minus sign: MTProto 123456789 becomes -123456789.
  • A channel or supergroup gets minus (1,000,000,000,000 plus its ID): MTProto 1234567890 becomes -1001234567890. The -100 in front is that offset written out.

A worked example

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.

When a group’s ID changes

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.

Storing IDs

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.

FAQ

What does -100 in a Telegram chat ID mean?

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.

How do I convert a channel ID to a Bot API chat_id?

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.

Is a negative ID always a channel?

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.

Why did my group's ID change?

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.

Do IDs fit in a 32-bit integer?

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⁵².

How do I tell a group ID from a channel ID?

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.

What is the MTProto ID?

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.