Telegram Bot API

Telegram MarkdownV2 and HTML Escaper

Paste any text and get it escaped for Telegram MarkdownV2 or HTML parse mode, so sendMessage stops failing with Bad Request: can't parse entities.

MarkdownV2 requires escaping _ * [ ] ( ) ~ ` > # + - = | { } . ! with a backslash; inside code and pre only ` and \; inside the (…) of a link only ) and \. HTML requires < > &.

Test it: send to a chat

The token stays in your browser (localStorage) and is sent only to api.telegram.org.

How to escape Markdown for a Telegram bot

  1. Paste the literal text — a user name, a price, a log line. Do not paste your own formatting markers: escape the data, then wrap it in *bold* or <b> yourself.
  2. Choose the mode: MarkdownV2 plain text, MarkdownV2 inside code/pre, MarkdownV2 inside the (…) of a link, or HTML. The result updates as you type.
  3. Press Copy, or As a JSON string to get the value quoted with backslashes doubled — ready for a JSON body or source code.
  4. Optional: open Test it, enter the bot token and a chat_id and send the result with sendMessage and the matching parse_mode. In code mode the text is wrapped in backticks, in link mode it becomes the URL of [link](…).

Telegram MarkdownV2 escaping rules

The rules come from the Bot API formatting options:

Example: Price: 5.99 (incl. tax) - order #42! becomes:

Price: 5\.99 \(incl\. tax\) \- order \#42\!

The dot and the exclamation mark are the classic surprises: forget one and the whole request fails.

Telegram HTML parse mode

In HTML mode every <, > and & that is not part of a tag or entity must be written as &lt;, &gt; and &amp;. The tool replaces exactly these three characters. Because the rule is so short, HTML is often the safer choice for dynamic text. The list of supported tags is in /guides/telegram-bot-send-message.html.

Privacy

Escaping runs entirely in your browser — no request is made. Only the optional test sends one sendMessage request, directly from your browser to api.telegram.org; the token is kept in localStorage and never reaches our server. You can also build the request in /telegram-bot-api-tester.html#sendMessage. Other error texts are explained in /guides/telegram-bot-api-errors.html.

Frequently asked questions

Which characters must be escaped in Telegram MarkdownV2?

In normal text: _ * [ ] ( ) ~ ` > # + - = | { } . !, each with a preceding backslash (the backslash itself is escaped too). Inside code and pre only ` and \; inside the (…) of a link only ) and \.

Why does sendMessage fail with "can't parse entities"?

The text contains a reserved character that is not escaped, or an entity that is not closed. Telegram's error message usually names the character. Escape the dynamic parts of the text and keep only your own formatting markers unescaped.

Should I use MarkdownV2 or HTML?

For text that comes from users or databases HTML is usually easier: only <, > and & have to be replaced. MarkdownV2 needs 18 characters escaped.

Do I need to escape text inside code blocks?

In MarkdownV2 only ` and \ inside code and pre. Choose the matching mode in the tool. In HTML mode the same three characters as everywhere.

Other utilities

Chat ID finderMini App initData validatorWebhook checkerBot API Tester