A Telegram share link lets a visitor send your page to any chat, group, or channel they pick. It is a plain URL, https://t.me/share/url, with the page address and an optional message in the query string. You don't need an SDK or an API key: put the link behind a button and Telegram handles the rest. Fill in the generator below to build one.
Telegram Share Link Generator
The link opens Telegram with a chat picker and your URL and text ready to send.
Enter a URL to build the linkKey Takeaways
- 1The share link format is https://t.me/share/url?url=<url>&text=<text>
- 2url is required; text is optional; URL-encode both values
- 3Telegram first asks the user to choose a chat, group, or channel
- 4tg://msg_url?url=&text= is the tg: scheme equivalent of the same share link
- 5Bot start links take a payload of up to 64 characters from A-Z, a-z, 0-9, _ and -
The t.me/share/url Format
This section covers the format from Telegram's sharing button documentation. The link has one base URL and two query parameters, so most problems come down to encoding the values correctly.
https://t.me/share/url?url=https%3A%2F%2Fexample.com%2Farticle&text=Worth%20a%20readRead the table below as the full parameter list for the share link. Telegram's documentation lists only these two, and states that both values should be URL-encoded.
| Parameter | Required | Description |
|---|---|---|
url | Yes | The URL to share, URL-encoded |
text | No | A message that accompanies the link, URL-encoded |
What the User Sees
When someone opens the link, Telegram asks them to choose a chat, group, or channel. After they pick one, the client enters your URL at the beginning of the message field, adds a newline, and then adds your text and selects it. The user can edit the message before sending, so nothing is posted without their action.
Encoding the Values
Encode each value with encodeURIComponent, not encodeURI. The shared URL usually contains its own ?, &, and #, and those characters must not leak into the outer t.me query string.
const pageUrl = 'https://example.com/post?id=42&ref=tg#comments';
const text = 'Worth a read';
const shareUrl =
'https://t.me/share/url?url=' + encodeURIComponent(pageUrl) +
'&text=' + encodeURIComponent(text);
// https://t.me/share/url?url=https%3A%2F%2Fexample.com%2Fpost%3Fid%3D42%26ref%3Dtg%23comments&text=Worth%20a%20readWithout encoding, the &ref=tg part would become a separate parameter of the t.me link, and the #comments part would be dropped, because Telegram ignores the fragment when it parses a deep link.
t.me Links vs tg:// Links
Telegram documents every deep link in two flavors: an HTTPS t.me link and a tg: URI. For sharing, the two forms below do the same thing.
| Form | Example |
|---|---|
| t.me HTTPS link | https://t.me/share/url?url=...&text=... |
| tg: URI | tg://msg_url?url=...&text=... |
For a share button on a website, use the t.me form. It is the one Telegram's sharing button page documents, and it is an ordinary HTTPS URL that any browser can open. The tg: form is a custom URI scheme that only does something when an app has registered it, so keep it for contexts where you know a Telegram client is installed. Telegram also accepts t.me/share?url= and t.me/msg/url?url= as variants, and the telegram.me and telegram.dog domains alongside t.me.
Other Useful t.me Links
Share links send content to a chat the user picks. The links below instead point to one specific chat, group, or bot. The table summarizes the formats from Telegram's deep link reference.
| Link | What it does |
|---|---|
t.me/<username> | Opens the user, group, channel, or bot with that public username |
t.me/<username>?text=Hello | Opens the chat with text pre-entered in the input bar, if the user can write there |
t.me/+<hash> | Chat invite link (legacy form: t.me/joinchat/<hash>) |
t.me/<bot>?start=<payload> | Opens a private chat with a bot and passes a start payload |
t.me/<bot>?startgroup=<payload> | Start link for a group context; the bot receives the payload in the group |
Pre-filled Text for a Chat
The text parameter on a username link puts a draft in the input bar. According to Telegram's reference, clients prepend a space if the text starts with @ and trim it to the maximum message length.
https://t.me/example_support?text=Hi%2C%20I%20have%20a%20question%20about%20order%2012345Bot Start Links
Bot deep links pass a value to your bot when the user presses Start. With https://t.me/your_bot?start=airplane, the bot receives the message /start airplane. In a group, ?startgroup=spaceship arrives as /start@your_bot spaceship.
Start Payload Rules
Allowed characters: A-Z, a-z, 0-9, _ and -. Maximum length: 64 characters.
For binary data or other content, Telegram recommends encoding it as base64url.
// Build a bot start link from an arbitrary string
function botStartLink(botUsername, value) {
const payload = btoa(String.fromCharCode(...new TextEncoder().encode(value)))
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '');
if (payload.length > 64) throw new Error('start payload exceeds 64 characters');
return `https://t.me/${botUsername}?start=${payload}`;
}
botStartLink('your_bot', 'ref:newsletter');
// https://t.me/your_bot?start=cmVmOm5ld3NsZXR0ZXIThis function converts the value to base64url, which uses only the allowed characters, and rejects payloads longer than 64 characters. Your bot decodes the payload after the /start prefix.
Share Button Example
With the formats covered, here is a share button you can drop into a page. The first version is static HTML; the second builds the link from the current page at click time.
<!-- Static link -->
<a href="https://t.me/share/url?url=https%3A%2F%2Fexample.com%2Farticle&text=Worth%20a%20read"
target="_blank"
rel="noopener noreferrer">
Share on Telegram
</a>
<!-- Dynamic: shares the current page -->
<button type="button" id="tg-share">Share on Telegram</button>
<script>
document.getElementById('tg-share').addEventListener('click', () => {
const url = new URL('https://t.me/share/url');
url.searchParams.set('url', window.location.href);
url.searchParams.set('text', document.title);
window.open(url.toString(), '_blank', 'noopener');
});
</script>The dynamic version uses URLSearchParams through url.searchParams.set, which encodes the values for you. It encodes spaces as + rather than %20; both are valid in a query string.
Troubleshooting
Most broken Telegram share links come from a missing parameter or an unencoded value. Check these first.
Only text, no url
The url parameter is required for share links. Put a URL in url; use text for the message.
Shared URL is cut off
An unencoded & or # in your URL ends the url value early. Encode it with encodeURIComponent.
Bot start payload uses other characters
Check that it uses only A-Z, a-z, 0-9, _ and - and is at most 64 characters. Encode other data as base64url.
tg:// link does nothing
A tg: URI needs an installed app that handles it. Use the https://t.me form on web pages.
To inspect a link you already have, paste it into the URL Editor to see each parameter decoded.